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

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

Issue 2872943003: Reduce unnecessary download interruptions due to parallel requests (Closed)
Patch Set: more restrictions on DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE 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 | « no previous file | 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_file_impl.cc
diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc
index 13ce1604c49dba528a3f28329792b057b0ed7921..edde01e1bc0c42f0cf088cbc103c3a17e36cd7fd 100644
--- a/content/browser/download/download_file_impl.cc
+++ b/content/browser/download/download_file_impl.cc
@@ -441,9 +441,19 @@ void DownloadFileImpl::StreamActive(SourceStream* source_stream) {
break;
case ByteStreamReader::STREAM_COMPLETE:
{
- reason = static_cast<DownloadInterruptReason>(
+ reason = static_cast<DownloadInterruptReason>(
source_stream->stream_reader()->GetStatus());
- SendUpdate();
+ if (source_stream->length() == DownloadSaveInfo::kLengthFullContent &&
+ !received_slices_.empty() &&
+ (source_stream->offset() == received_slices_.back().offset +
+ received_slices_.back().received_bytes) &&
+ reason == DownloadInterruptReason::
+ DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE) {
+ // We are probably reaching the end of the stream, don't treat this
+ // as an error.
+ reason = DOWNLOAD_INTERRUPT_REASON_NONE;
+ }
+ SendUpdate();
}
break;
default:
« no previous file with comments | « no previous file | content/browser/download/download_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698