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

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

Issue 2767593003: Handle early pause, cancel for parallel requests. (Closed)
Patch Set: Move is_canceled_ to subclass. Created 3 years, 9 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_job.h ('k') | content/browser/download/download_worker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/download/download_job.cc
diff --git a/content/browser/download/download_job.cc b/content/browser/download/download_job.cc
index b9dd3a97965c630193f814999e9c08699cf5f324..c527014d189feab81144c923095b97dc493e3c7a 100644
--- a/content/browser/download/download_job.cc
+++ b/content/browser/download/download_job.cc
@@ -33,17 +33,13 @@ void DownloadJob::Interrupt(DownloadInterruptReason reason) {
download_item_->UpdateObservers();
}
-void DownloadJob::AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
+bool DownloadJob::AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
int64_t offset,
int64_t length) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DownloadFile* download_file = download_item_->download_file_.get();
- if (!download_file) {
- // TODO(xingliu): Handle early and late incoming streams, see crbug/702683.
- VLOG(1) << "Download file is released when byte stream arrived. Discard "
- "the byte stream.";
- return;
- }
+ if (!download_file)
+ return false;
// download_file_ is owned by download_item_ on the UI thread and is always
// deleted on the FILE thread after download_file_ is nulled out.
@@ -52,6 +48,7 @@ void DownloadJob::AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
BrowserThread::FILE, FROM_HERE,
base::Bind(&DownloadFile::AddByteStream, base::Unretained(download_file),
base::Passed(&stream_reader), offset, length));
+ return true;
}
bool DownloadJob::UsesParallelRequests() const {
« no previous file with comments | « content/browser/download/download_job.h ('k') | content/browser/download/download_worker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698