Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(504)

Unified Diff: content/browser/download/download_item_impl.cc

Issue 2811293004: Fix an issue that we didn't clean url request properly. (Closed)
Patch Set: Removed a DCHECK for unit test. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_item_impl.cc
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index b4a1d46dfd2b3f407c0fab0a68a94bf8d7f7bcd5..e46aca2272e6115fa09e8341e83d95172d80d205 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -1061,6 +1061,12 @@ void DownloadItemImpl::UpdateValidatorsOnResumption(
// notified when the download transitions to the IN_PROGRESS state.
}
+void DownloadItemImpl::CancelRequestWithOffset(int64_t offset) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ if (job_)
+ job_->CancelRequestWithOffset(offset);
asanka 2017/04/21 15:09:28 It is possible that this will cancel the only requ
xingliu 2017/04/22 00:07:24 If this call cancelled the only request, the downl
+}
+
void DownloadItemImpl::NotifyRemoved() {
for (auto& observer : observers_)
observer.OnDownloadRemoved(this);
@@ -1313,6 +1319,8 @@ void DownloadItemImpl::StartDownload() {
base::Unretained(download_file_.get()),
base::Bind(&DownloadItemImpl::OnDownloadFileInitialized,
weak_ptr_factory_.GetWeakPtr()),
+ base::Bind(&DownloadItemImpl::CancelRequestWithOffset,
+ weak_ptr_factory_.GetWeakPtr()),
received_slices_));
}

Powered by Google App Engine
This is Rietveld 408576698