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

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

Issue 2799333002: Clear the received slices in DownloadItemImpl when etag changed. (Closed)
Patch Set: 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..68a29641a20793b79af074c1acb22be3ff6e333e 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -1028,8 +1028,10 @@ 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();
qinmin 2017/04/07 18:03:49 should we also clear the received_bytes_ after the
xingliu 2017/04/07 20:50:08 Done. Make sense, it's good to clear received sli
xingliu 2017/04/07 22:18:03 Done, Sorry that I somehow misunderstood the comm
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 +1291,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