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

Issue 1691543002: [Downloads] Enforce state transition integrity and state invariants. (Closed)

Created:
4 years, 10 months ago by asanka
Modified:
4 years, 10 months ago
CC:
asanka, chromium-reviews, darin-cc_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[Downloads] Enforce state transition integrity and state invariants. DownloadItemImpl is getting pretty complicated and it's hard to keep track of possible races. This CL tries to make things a little easier by constraining state transitions and also asserting the state of the DownloadItem as each state is entered. This CL introduces two new intermediate states to DownloadItemImpl: - TARGET_PENDING_INTERNAL - TARGET_RESOLVED_INTERNAL Of these, only TARGET_RESOLVED_INTERNAL is allowed to transition to an interrupted state. TARGET_PENDING_INTERNAL is entered when the download target determination cascade begins and defers any interruptions until TARGET_RESOLVED_INTERNAL. This state also blocks download completion. Hence transitions to INTERRUPTED and COMPLETED states must now step over the target determination state. Also introduce a set of tests that are designed to exercise the various permutations of events that can occur during the target determination phase. BUG=7648 Committed: https://crrev.com/45579ca4f8334797d90ea510c7a74dee41e96f3b Cr-Commit-Position: refs/heads/master@{#375275}

Patch Set 1 #

Patch Set 2 : Add a state transition map for SavePackage. #

Total comments: 10

Patch Set 3 : Clarify comments. #

Total comments: 48

Patch Set 4 : Address comments and fix DownloadsExtensionTest #

Total comments: 3

Patch Set 5 : #

Total comments: 4

Patch Set 6 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1089 lines, -341 lines) Patch
M chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc View 1 2 3 1 chunk +12 lines, -21 lines 0 comments Download
M content/browser/download/download_item_impl.h View 1 2 3 4 5 5 chunks +117 lines, -52 lines 0 comments Download
M content/browser/download/download_item_impl.cc View 1 2 3 4 28 chunks +359 lines, -173 lines 0 comments Download
M content/browser/download/download_item_impl_unittest.cc View 1 2 3 4 5 43 chunks +601 lines, -95 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 18 (6 generated)
asanka
This is the CL that will block the state transition rework.
4 years, 10 months ago (2016-02-10 20:04:14 UTC) #2
Randy Smith (Not in Mondays)
I think I'm going to send initial comments here and switch back to the other ...
4 years, 10 months ago (2016-02-11 17:19:18 UTC) #3
asanka
https://codereview.chromium.org/1691543002/diff/20001/content/browser/download/download_item_impl.cc File content/browser/download/download_item_impl.cc (right): https://codereview.chromium.org/1691543002/diff/20001/content/browser/download/download_item_impl.cc#newcode1044 content/browser/download/download_item_impl.cc:1044: // updates in a non-in-progress state. This issue should ...
4 years, 10 months ago (2016-02-11 21:12:05 UTC) #4
Randy Smith (Not in Mondays)
Ok, this looks basically good, though several comments below. But I presume I can stamp ...
4 years, 10 months ago (2016-02-12 00:03:11 UTC) #5
asanka
+benjhayden: Could you look at downloads_api_browsertest.cc? https://codereview.chromium.org/1691543002/diff/40001/content/browser/download/download_item_impl.cc File content/browser/download/download_item_impl.cc (left): https://codereview.chromium.org/1691543002/diff/40001/content/browser/download/download_item_impl.cc#oldcode411 content/browser/download/download_item_impl.cc:411: if (!is_save_package_download_ && ...
4 years, 10 months ago (2016-02-12 05:04:27 UTC) #7
asanka
https://codereview.chromium.org/1691543002/diff/40001/content/browser/download/download_item_impl.cc File content/browser/download/download_item_impl.cc (right): https://codereview.chromium.org/1691543002/diff/40001/content/browser/download/download_item_impl.cc#newcode1855 content/browser/download/download_item_impl.cc:1855: #if DCHECK_IS_ON() On 2016/02/12 05:04:26, asanka wrote: > On ...
4 years, 10 months ago (2016-02-12 15:53:37 UTC) #8
benjhayden
downloads_api_browsertest lgtm
4 years, 10 months ago (2016-02-12 17:20:53 UTC) #10
Randy Smith (Not in Mondays)
LGTM; you can do what you want with all of my comments except that you ...
4 years, 10 months ago (2016-02-12 17:37:02 UTC) #11
asanka
Thanks Randy and Ben! (hey Ben! there's another one!) https://codereview.chromium.org/1691543002/diff/20001/content/browser/download/download_item_impl.h File content/browser/download/download_item_impl.h (right): https://codereview.chromium.org/1691543002/diff/20001/content/browser/download/download_item_impl.h#newcode270 content/browser/download/download_item_impl.h:270: ...
4 years, 10 months ago (2016-02-12 20:21:24 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1691543002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1691543002/100001
4 years, 10 months ago (2016-02-12 20:56:36 UTC) #15
commit-bot: I haz the power
Committed patchset #6 (id:100001)
4 years, 10 months ago (2016-02-12 23:18:26 UTC) #16
commit-bot: I haz the power
4 years, 10 months ago (2016-02-16 22:45:37 UTC) #18
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/45579ca4f8334797d90ea510c7a74dee41e96f3b
Cr-Commit-Position: refs/heads/master@{#375275}

Powered by Google App Engine
This is Rietveld 408576698