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

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

Issue 2901383007: Don't create parallel request until download file is initialized (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « content/browser/download/download_item_impl.h ('k') | content/browser/download/download_job.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1132560218034b46a8b1e4f9f82f8c51bc726877..cda8b841a34ecab3ef48c12d10752bd7f15034b5 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -1063,12 +1063,6 @@ 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);
-}
-
void DownloadItemImpl::NotifyRemoved() {
for (auto& observer : observers_)
observer.OnDownloadRemoved(this);
@@ -1324,20 +1318,10 @@ void DownloadItemImpl::Start(
TransitionTo(TARGET_PENDING_INTERNAL);
- job_->Start();
-}
-
-void DownloadItemImpl::StartDownload() {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&DownloadFile::Initialize,
- // Safe because we control download file lifetime.
- base::Unretained(download_file_.get()),
- base::Bind(&DownloadItemImpl::OnDownloadFileInitialized,
- weak_ptr_factory_.GetWeakPtr()),
- base::Bind(&DownloadItemImpl::CancelRequestWithOffset,
- weak_ptr_factory_.GetWeakPtr()),
- received_slices_, job_ && job_->IsParallelizable()));
+ job_->Start(download_file_.get(),
+ base::Bind(&DownloadItemImpl::OnDownloadFileInitialized,
+ weak_ptr_factory_.GetWeakPtr()),
+ GetReceivedSlices());
}
void DownloadItemImpl::OnDownloadFileInitialized(
« no previous file with comments | « content/browser/download/download_item_impl.h ('k') | content/browser/download/download_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698