Merge pull request #8678 from liusy182/download-item

only emit `download-item done` event once
This commit is contained in:
Kevin Sawicki 2017-03-06 10:11:22 -08:00 committed by GitHub
commit 479af3c9e2

View file

@ -78,7 +78,6 @@ DownloadItem::~DownloadItem() {
void DownloadItem::OnDownloadUpdated(content::DownloadItem* item) { void DownloadItem::OnDownloadUpdated(content::DownloadItem* item) {
if (download_item_->IsDone()) { if (download_item_->IsDone()) {
Emit("done", item->GetState()); Emit("done", item->GetState());
// Destroy the item once item is downloaded. // Destroy the item once item is downloaded.
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, GetDestroyClosure()); FROM_HERE, GetDestroyClosure());
@ -111,7 +110,6 @@ bool DownloadItem::CanResume() const {
void DownloadItem::Cancel() { void DownloadItem::Cancel() {
download_item_->Cancel(true); download_item_->Cancel(true);
download_item_->Remove();
} }
int64_t DownloadItem::GetReceivedBytes() const { int64_t DownloadItem::GetReceivedBytes() const {