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

Issue 2799333002: Clear the received slices in DownloadItemImpl when etag changed. (Closed)

Created:
3 years, 8 months ago by xingliu
Modified:
3 years, 8 months ago
CC:
chromium-reviews, jam, David Trainor- moved to gerrit, darin-cc_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Clear the received slices in DownloadItemImpl when etag changed. For parallel download, the received slices are currently passed in the constructor of DownloadFileImpl, which is earlier than the etag check logic in DownloadItemImpl. This raises an issue that the DownloadFileImpl will use the out-dated received slices data. It will block the download to refresh the data with new strong validators, and download won't complete. This CL cleared the received slices in DownloadItemImpl, and pass the received slices to DownloadFileImpl via Initialize call instead of the ctor. Alternatively we may do it in DownloadManagerImpl, but it's probably better to do this kind of clean up in DownloadItemImpl. When etag changes, currently for a normal download, we update the etag in DownloadItemImpl::UpdateValidatorsOnResumption, and DownloadSaveInfo::offset is set to 0 in DownloadRequestCore::HandleSuccessfulServerResponse, where we pass this 0 offset to BaseFile::Initialize to truncate the file size to 0. BUG=706182, 644352 Review-Url: https://codereview.chromium.org/2799333002 Cr-Commit-Position: refs/heads/master@{#463417} Committed: https://chromium.googlesource.com/chromium/src/+/583a61ad6d736c81b9f82c9e24676af19ce868e9

Patch Set 1 #

Total comments: 3

Patch Set 2 : Work on feedback. #

Patch Set 3 : Work on feedback. #

Total comments: 2

Patch Set 4 : Address the uma issue. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+88 lines, -56 lines) Patch
M content/browser/download/download_browsertest.cc View 10 chunks +4 lines, -12 lines 0 comments Download
M content/browser/download/download_file.h View 2 chunks +4 lines, -1 line 0 comments Download
M content/browser/download/download_file_factory.h View 2 chunks +0 lines, -2 lines 0 comments Download
M content/browser/download/download_file_factory.cc View 1 chunk +1 line, -3 lines 0 comments Download
M content/browser/download/download_file_impl.h View 1 chunk +2 lines, -2 lines 0 comments Download
M content/browser/download/download_file_impl.cc View 3 chunks +4 lines, -3 lines 0 comments Download
M content/browser/download/download_file_unittest.cc View 3 chunks +6 lines, -6 lines 0 comments Download
M content/browser/download/download_item_impl.cc View 1 2 3 2 chunks +8 lines, -3 lines 0 comments Download
M content/browser/download/download_item_impl_unittest.cc View 1 2 9 chunks +47 lines, -8 lines 0 comments Download
M content/browser/download/download_manager_impl.cc View 1 chunk +1 line, -2 lines 0 comments Download
M content/browser/download/download_manager_impl_unittest.cc View 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/download/mock_download_file.h View 1 chunk +3 lines, -1 line 0 comments Download
M content/browser/download/mock_download_file.cc View 2 chunks +3 lines, -3 lines 0 comments Download
M content/public/test/test_file_error_injector.cc View 8 chunks +5 lines, -9 lines 0 comments Download

Messages

Total messages: 27 (14 generated)
xingliu
Hi, PTAL, thanks.
3 years, 8 months ago (2017-04-06 20:25:46 UTC) #5
qinmin
https://codereview.chromium.org/2799333002/diff/1/content/browser/download/download_item_impl.cc File content/browser/download/download_item_impl.cc (right): https://codereview.chromium.org/2799333002/diff/1/content/browser/download/download_item_impl.cc#newcode1032 content/browser/download/download_item_impl.cc:1032: received_slices_.clear(); should we also clear the received_bytes_ after the ...
3 years, 8 months ago (2017-04-07 18:03:49 UTC) #8
xingliu
Thanks for the review. PTAL. https://codereview.chromium.org/2799333002/diff/1/content/browser/download/download_item_impl.cc File content/browser/download/download_item_impl.cc (right): https://codereview.chromium.org/2799333002/diff/1/content/browser/download/download_item_impl.cc#newcode1032 content/browser/download/download_item_impl.cc:1032: received_slices_.clear(); On 2017/04/07 18:03:49, ...
3 years, 8 months ago (2017-04-07 20:50:08 UTC) #9
qinmin
On 2017/04/07 20:50:08, xingliu wrote: > Thanks for the review. PTAL. > > https://codereview.chromium.org/2799333002/diff/1/content/browser/download/download_item_impl.cc > ...
3 years, 8 months ago (2017-04-07 21:01:47 UTC) #10
xingliu
PTAL, thanks. https://codereview.chromium.org/2799333002/diff/1/content/browser/download/download_item_impl.cc File content/browser/download/download_item_impl.cc (right): https://codereview.chromium.org/2799333002/diff/1/content/browser/download/download_item_impl.cc#newcode1032 content/browser/download/download_item_impl.cc:1032: received_slices_.clear(); On 2017/04/07 18:03:49, qinmin wrote: > ...
3 years, 8 months ago (2017-04-07 22:18:03 UTC) #11
qinmin
https://codereview.chromium.org/2799333002/diff/40001/content/browser/download/download_item_impl.cc File content/browser/download/download_item_impl.cc (right): https://codereview.chromium.org/2799333002/diff/40001/content/browser/download/download_item_impl.cc#newcode1033 content/browser/download/download_item_impl.cc:1033: received_bytes_ = 0; you either need to do this ...
3 years, 8 months ago (2017-04-07 23:37:44 UTC) #12
xingliu
https://codereview.chromium.org/2799333002/diff/40001/content/browser/download/download_item_impl.cc File content/browser/download/download_item_impl.cc (right): https://codereview.chromium.org/2799333002/diff/40001/content/browser/download/download_item_impl.cc#newcode1033 content/browser/download/download_item_impl.cc:1033: received_bytes_ = 0; On 2017/04/07 23:37:43, qinmin wrote: > ...
3 years, 8 months ago (2017-04-08 02:29:14 UTC) #13
qinmin
lgtm
3 years, 8 months ago (2017-04-08 05:55:18 UTC) #14
xingliu
alexmos@chromium.org: Please review changes in content/public/test/test_file_error_injector.cc Thank you.
3 years, 8 months ago (2017-04-10 19:02:25 UTC) #20
David Trainor- moved to gerrit
lgtm
3 years, 8 months ago (2017-04-10 20:18:06 UTC) #21
alexmos
content/public LGTM
3 years, 8 months ago (2017-04-10 20:24:08 UTC) #22
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2799333002/60001
3 years, 8 months ago (2017-04-10 21:27:04 UTC) #24
commit-bot: I haz the power
3 years, 8 months ago (2017-04-10 22:13:40 UTC) #27
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://chromium.googlesource.com/chromium/src/+/583a61ad6d736c81b9f82c9e2467...

Powered by Google App Engine
This is Rietveld 408576698