| 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 b1957ab604da102d286647b0ec1d842cce67eef4..8ab447b5f27c7d7945cf119e27ab766a242c43e8 100644
|
| --- a/content/browser/download/download_item_impl.cc
|
| +++ b/content/browser/download/download_item_impl.cc
|
| @@ -1043,7 +1043,7 @@ void DownloadItemImpl::OnAllDataSaved(
|
| DCHECK(!all_data_saved_);
|
| all_data_saved_ = true;
|
| SetTotalBytes(total_bytes);
|
| - UpdateProgress(total_bytes, 0);
|
| + UpdateProgress(total_bytes, 0, std::vector<DownloadItem::ReceivedSlice>());
|
| SetHashState(std::move(hash_state));
|
| hash_state_.reset(); // No need to retain hash_state_ since we are done with
|
| // the download and don't expect to receive any more
|
| @@ -1062,8 +1062,10 @@ void DownloadItemImpl::MarkAsComplete() {
|
| UpdateObservers();
|
| }
|
|
|
| -void DownloadItemImpl::DestinationUpdate(int64_t bytes_so_far,
|
| - int64_t bytes_per_sec) {
|
| +void DownloadItemImpl::DestinationUpdate(
|
| + int64_t bytes_so_far,
|
| + int64_t bytes_per_sec,
|
| + const std::vector<DownloadItem::ReceivedSlice>& received_slices) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| // If the download is in any other state we don't expect any
|
| // DownloadDestinationObserver callbacks. An interruption or a cancellation
|
| @@ -1079,7 +1081,7 @@ void DownloadItemImpl::DestinationUpdate(int64_t bytes_so_far,
|
| << " per_sec=" << bytes_per_sec
|
| << " download=" << DebugString(true);
|
|
|
| - UpdateProgress(bytes_so_far, bytes_per_sec);
|
| + UpdateProgress(bytes_so_far, bytes_per_sec, received_slices);
|
| if (net_log_.IsCapturing()) {
|
| net_log_.AddEvent(
|
| net::NetLogEventType::DOWNLOAD_ITEM_UPDATED,
|
| @@ -1224,6 +1226,7 @@ void DownloadItemImpl::Start(
|
| hash_state_ = std::move(hash_state);
|
| hash_.clear();
|
| destination_error_ = new_create_info.result;
|
| + received_slices_.clear();
|
| TransitionTo(INTERRUPTED_TARGET_PENDING_INTERNAL);
|
| DetermineDownloadTarget();
|
| return;
|
| @@ -1270,6 +1273,7 @@ void DownloadItemImpl::OnDownloadFileInitialized(
|
| hash_state_.reset();
|
| hash_.clear();
|
| destination_error_ = result;
|
| + received_slices_.clear();
|
| TransitionTo(INTERRUPTED_TARGET_PENDING_INTERNAL);
|
| }
|
|
|
| @@ -1638,8 +1642,9 @@ void DownloadItemImpl::InterruptWithPartialState(
|
| hash_state_.reset();
|
| hash_.clear();
|
| received_bytes_ = 0;
|
| + received_slices_.clear();
|
| } else {
|
| - UpdateProgress(bytes_so_far, 0);
|
| + UpdateProgress(bytes_so_far, 0, std::vector<DownloadItem::ReceivedSlice>());
|
| SetHashState(std::move(hash_state));
|
| }
|
|
|
| @@ -1669,8 +1674,10 @@ void DownloadItemImpl::InterruptWithPartialState(
|
| AutoResumeIfValid();
|
| }
|
|
|
| -void DownloadItemImpl::UpdateProgress(int64_t bytes_so_far,
|
| - int64_t bytes_per_sec) {
|
| +void DownloadItemImpl::UpdateProgress(
|
| + int64_t bytes_so_far,
|
| + int64_t bytes_per_sec,
|
| + const std::vector<DownloadItem::ReceivedSlice>& received_slices) {
|
| received_bytes_ = bytes_so_far;
|
| bytes_per_sec_ = bytes_per_sec;
|
|
|
| @@ -1678,6 +1685,8 @@ void DownloadItemImpl::UpdateProgress(int64_t bytes_so_far,
|
| // revert to 'unknown size mode'.
|
| if (received_bytes_ > total_bytes_)
|
| total_bytes_ = 0;
|
| +
|
| + received_slices_ = received_slices;
|
| }
|
|
|
| void DownloadItemImpl::SetHashState(
|
| @@ -1923,6 +1932,7 @@ void DownloadItemImpl::ResumeInterruptedDownload(
|
| etag_.clear();
|
| hash_.clear();
|
| hash_state_.reset();
|
| + received_slices_.clear();
|
| }
|
|
|
| StoragePartition* storage_partition =
|
|
|