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

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

Issue 2799333002: Clear the received slices in DownloadItemImpl when etag changed. (Closed)
Patch Set: Work on feedback. Created 3 years, 8 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
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 5c2286bb11e6e38aafc0ea569ea1ea3040947b3a..991d31c8dcc0767f3da740f65a5b2b70644b2645 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -1028,8 +1028,11 @@ void DownloadItemImpl::UpdateValidatorsOnResumption(
if (chain_iter != new_create_info.url_chain.end())
origin_state |= ORIGIN_STATE_ON_RESUMPTION_ADDITIONAL_REDIRECTS;
if (etag_ != new_create_info.etag ||
- last_modified_time_ != new_create_info.last_modified)
+ last_modified_time_ != new_create_info.last_modified) {
+ received_slices_.clear();
+ received_bytes_ = 0;
qinmin 2017/04/07 23:37:43 you either need to do this after RecordOriginState
xingliu 2017/04/08 02:29:13 Oh, I see, thanks for the suggestion, didn't notic
origin_state |= ORIGIN_STATE_ON_RESUMPTION_VALIDATORS_CHANGED;
+ }
if (content_disposition_ != new_create_info.content_disposition)
origin_state |= ORIGIN_STATE_ON_RESUMPTION_CONTENT_DISPOSITION_CHANGED;
RecordOriginStateOnResumption(received_bytes_ != 0, origin_state);
@@ -1289,7 +1292,8 @@ void DownloadItemImpl::StartDownload() {
// Safe because we control download file lifetime.
base::Unretained(download_file_.get()),
base::Bind(&DownloadItemImpl::OnDownloadFileInitialized,
- weak_ptr_factory_.GetWeakPtr())));
+ weak_ptr_factory_.GetWeakPtr()),
+ received_slices_));
}
void DownloadItemImpl::OnDownloadFileInitialized(
« no previous file with comments | « content/browser/download/download_file_unittest.cc ('k') | content/browser/download/download_item_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698