| 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 6bc0b6e9b9864971181cbaad4a222f76465a592f..f81a7744f1de4296b5dde27cc839ee844ba0a4a3 100644
|
| --- a/content/browser/download/download_item_impl.cc
|
| +++ b/content/browser/download/download_item_impl.cc
|
| @@ -190,6 +190,7 @@ DownloadItemImpl::DownloadItemImpl(
|
| etag_(etag),
|
| received_slices_(received_slices),
|
| net_log_(net_log),
|
| + received_bytes_if_content_length_mismatch_(-1),
|
| weak_ptr_factory_(this) {
|
| delegate_->Attach();
|
| DCHECK(state_ == COMPLETE_INTERNAL || state_ == INTERRUPTED_INTERNAL ||
|
| @@ -234,6 +235,7 @@ DownloadItemImpl::DownloadItemImpl(DownloadItemImplDelegate* delegate,
|
| last_modified_time_(info.last_modified),
|
| etag_(info.etag),
|
| net_log_(net_log),
|
| + received_bytes_if_content_length_mismatch_(-1),
|
| weak_ptr_factory_(this) {
|
| delegate_->Attach();
|
| Init(true /* actively downloading */, SRC_ACTIVE_DOWNLOAD);
|
| @@ -270,6 +272,7 @@ DownloadItemImpl::DownloadItemImpl(
|
| delegate_(delegate),
|
| current_path_(path),
|
| net_log_(net_log),
|
| + received_bytes_if_content_length_mismatch_(-1),
|
| weak_ptr_factory_(this) {
|
| job_ =
|
| base::MakeUnique<DownloadJobImpl>(this, std::move(request_handle), false);
|
| @@ -937,6 +940,7 @@ DownloadItemImpl::ResumeMode DownloadItemImpl::GetResumeMode() const {
|
| switch(last_reason_) {
|
| case DOWNLOAD_INTERRUPT_REASON_FILE_TRANSIENT_ERROR:
|
| case DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT:
|
| + case DOWNLOAD_INTERRUPT_REASON_SERVER_CONTENT_LENGTH_MISMATCH:
|
| break;
|
|
|
| case DOWNLOAD_INTERRUPT_REASON_SERVER_NO_RANGE:
|
| @@ -1106,6 +1110,17 @@ void DownloadItemImpl::OnAllDataSaved(
|
| // the download and don't expect to receive any more
|
| // data.
|
|
|
| + if (received_bytes_if_content_length_mismatch_ > 0) {
|
| + if (total_bytes > received_bytes_if_content_length_mismatch_) {
|
| + RecordDownloadCount(
|
| + MORE_BYTES_RECEIVED_AFTER_CONTENT_LENGTH_MISMATCH_COUNT);
|
| + } else if (total_bytes == received_bytes_if_content_length_mismatch_) {
|
| + RecordDownloadCount(
|
| + NO_BYTES_RECEIVED_AFTER_CONTENT_LENGTH_MISMATCH_COUNT);
|
| + } else {
|
| + // This could happen if the content changes on the server.
|
| + }
|
| + }
|
| DVLOG(20) << __func__ << "() download=" << DebugString(true);
|
| UpdateObservers();
|
| }
|
| @@ -1796,6 +1811,9 @@ void DownloadItemImpl::InterruptWithPartialState(
|
| RecordDownloadInterrupted(reason, received_bytes_, total_bytes_,
|
| job_ && job_->IsParallelizable(),
|
| IsParallelDownloadEnabled());
|
| + if (reason == DOWNLOAD_INTERRUPT_REASON_SERVER_CONTENT_LENGTH_MISMATCH)
|
| + received_bytes_if_content_length_mismatch_ = received_bytes_;
|
| +
|
| if (!GetWebContents())
|
| RecordDownloadCount(INTERRUPTED_WITHOUT_WEBCONTENTS);
|
|
|
|
|