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

Side by Side Diff: content/browser/download/download_file_impl.cc

Issue 2872943003: Reduce unnecessary download interruptions due to parallel requests (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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/download/download_file_impl.h" 5 #include "content/browser/download/download_file_impl.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 AddNewSlice(source_stream->offset(), bytes_to_write); 434 AddNewSlice(source_stream->offset(), bytes_to_write);
435 } else { 435 } else {
436 received_slices_[source_stream->index()].received_bytes += 436 received_slices_[source_stream->index()].received_bytes +=
437 bytes_to_write; 437 bytes_to_write;
438 } 438 }
439 } 439 }
440 } 440 }
441 break; 441 break;
442 case ByteStreamReader::STREAM_COMPLETE: 442 case ByteStreamReader::STREAM_COMPLETE:
443 { 443 {
444 reason = static_cast<DownloadInterruptReason>( 444 reason = static_cast<DownloadInterruptReason>(
445 source_stream->stream_reader()->GetStatus()); 445 source_stream->stream_reader()->GetStatus());
446 SendUpdate(); 446 if (source_stream->length() == DownloadSaveInfo::kLengthFullContent &&
447 reason == DownloadInterruptReason::
448 DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE) {
xingliu 2017/05/10 01:40:17 Are errors for non-parallel download also affected
qinmin 2017/05/10 17:47:24 For non-parallel download, if we receive DOWNLOAD_
449 // We are probably reaching the end of the stream, don't treat this
450 // as an error.
451 reason = DOWNLOAD_INTERRUPT_REASON_NONE;
452 }
453 SendUpdate();
447 } 454 }
448 break; 455 break;
449 default: 456 default:
450 NOTREACHED(); 457 NOTREACHED();
451 break; 458 break;
452 } 459 }
453 now = base::TimeTicks::Now(); 460 now = base::TimeTicks::Now();
454 } while (state == ByteStreamReader::STREAM_HAS_DATA && 461 } while (state == ByteStreamReader::STREAM_HAS_DATA &&
455 reason == DOWNLOAD_INTERRUPT_REASON_NONE && now - start <= delta && 462 reason == DOWNLOAD_INTERRUPT_REASON_NONE && now - start <= delta &&
456 !should_terminate); 463 !should_terminate);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 const base::FilePath& new_path, 723 const base::FilePath& new_path,
717 const RenameCompletionCallback& completion_callback) 724 const RenameCompletionCallback& completion_callback)
718 : option(option), 725 : option(option),
719 new_path(new_path), 726 new_path(new_path),
720 retries_left(kMaxRenameRetries), 727 retries_left(kMaxRenameRetries),
721 completion_callback(completion_callback) {} 728 completion_callback(completion_callback) {}
722 729
723 DownloadFileImpl::RenameParameters::~RenameParameters() {} 730 DownloadFileImpl::RenameParameters::~RenameParameters() {}
724 731
725 } // namespace content 732 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/download/download_stats.cc » ('j') | content/browser/download/download_worker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698