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

Issue 2931573003: Fix stability and data racing issues, coalesce more updates for JumpList (Closed)

Created:
3 years, 6 months ago by chengx
Modified:
3 years, 6 months ago
CC:
chromium-reviews, brucedawson
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Fix stability and data racing issues, coalesce more updates for JumpList This CL contains the following five main changes plus lots of updates on variable/method names and comments. 1. Fix the JumpList data-racing issue by separating different thread tasks. There are two threads involved in updating the JumpList. The UI thread lives the module to collect JumpList data for update, and a non-UI thread lives the RunUpdateJumpList module which updates the JumpList and notifies the shell. Previously, the two modules were interleaved to some extent, which required the JumpList data to be shared between the two threads. This caused the data racing issue and was solved by introducing a lock. The interleaving of these two modules complicates the code and makes it very difficult to add unit tests. This CL separates these two modules. In more details, the JumpList data is now only accessible to the UI thread. Local copies of the data are made and sent to the non-UI thread to run the update task. Once that update task finishes on the non-UI thread, the update results are transferred to the UI thread via PostTaskAndReply. The UI thread then decides how to update the JumpList data according to the update results. 2. Fix the JumpList stability issue by making the RunUpdateJumpList API static so it outlives the JumpList instance. When a JumpList::RunUpdateJumpList task is posted on a non-UI thread and about to run, the JumpList instance may have already been destructed. This caused stability issues as the RunUpdateJumpList API was non-static. This CL fixes it by making this API and other APIs it calls static. 3. Coalesce JumpList updates from two services by keeping only one timer. Previously, there were two timers to coalesce updates from the TopSites service and the TabRestore service, respectively. When notifications from both services came, even at the same time, multiple RunUpdateJumpList tasks were posted where they should be coalesced into one. This caused a waste of many shell notification runs. Note that there was no wasted work on icon operations as different JumpList categories were processed on demand. This CL trims out this waste by keeping only one timer to coalesce updates triggered by different services. 4. Cancel fetching most-visited URLs when Jumplist is destroyed. This CL makes it possible to cancel the tasks of fetching most-visited URLs when JumpList is destroyed, which otherwise is wasted. This also avoids unnecessary favicon loading triggered upon the completion of the URL fetch. 5. Make JumpList not refcounted. JumpList is owned by BrowserView. It is RefCounted but there doesn't appear to be a reason for that. This CL changes JumpList to be not refcounted by making it a regular keyed service, rather than a refcounted keyed service as it was. BUG=40407, 179576, 498987, 717236, 720028, 732586 Review-Url: https://codereview.chromium.org/2931573003 Cr-Original-Commit-Position: refs/heads/master@{#479095} Committed: https://chromium.googlesource.com/chromium/src/+/4a5397999a0f493c47632e1a8bd93686de54adbf Review-Url: https://codereview.chromium.org/2931573003 Cr-Commit-Position: refs/heads/master@{#479848} Committed: https://chromium.googlesource.com/chromium/src/+/f1c120eb244a567ec94bec0e8f43e076963bf550

Patch Set 1 #

Total comments: 106

Patch Set 2 : Address comments #

Total comments: 6

Patch Set 3 : Remove refcounting for jumplist KeyedService, fix nits. #

Total comments: 20

Patch Set 4 : Fix nits and update comments #

Total comments: 6

Patch Set 5 : Address comments from grt@ #

Patch Set 6 : Git pull #

Total comments: 4

Patch Set 7 : Obtain the pointer value before calling base::Passed() #

Total comments: 4

Patch Set 8 : Remove null check #

Unified diffs Side-by-side diffs Delta from patch set Stats (+435 lines, -474 lines) Patch
M chrome/browser/ui/views/frame/browser_view.h View 1 2 3 4 5 3 chunks +2 lines, -9 lines 0 comments Download
M chrome/browser/ui/views/frame/browser_view.cc View 1 2 3 4 5 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/browser/win/jumplist.h View 1 2 3 5 chunks +153 lines, -148 lines 0 comments Download
M chrome/browser/win/jumplist.cc View 1 2 3 4 5 6 7 22 chunks +265 lines, -306 lines 0 comments Download
M chrome/browser/win/jumplist_factory.h View 1 2 3 4 2 chunks +7 lines, -5 lines 0 comments Download
M chrome/browser/win/jumplist_factory.cc View 1 2 3 4 3 chunks +5 lines, -4 lines 0 comments Download

Messages

Total messages: 122 (102 generated)
chengx
Hi Greg, this CL is ready for review now. PTAL, thanks! I want to specifically ...
3 years, 6 months ago (2017-06-09 05:18:09 UTC) #38
grt (UTC plus 2)
round one! https://codereview.chromium.org/2931573003/diff/140001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2931573003/diff/140001/chrome/browser/win/jumplist.cc#newcode229 chrome/browser/win/jumplist.cc:229: scoped_refptr<history::TopSites> top_sites = nit: move this down ...
3 years, 6 months ago (2017-06-09 10:42:59 UTC) #39
chengx
Hi Greg, thanks a lot for the highly detailed feedback! I've addressed all the 49 ...
3 years, 6 months ago (2017-06-10 05:56:19 UTC) #49
grt (UTC plus 2)
looking awesome. https://codereview.chromium.org/2931573003/diff/140001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2931573003/diff/140001/chrome/browser/win/jumplist.cc#newcode297 chrome/browser/win/jumplist.cc:297: On 2017/06/10 05:56:17, chengx wrote: > On ...
3 years, 6 months ago (2017-06-12 07:15:33 UTC) #52
chengx
Hi Greg, I've removed refcounting for jumplist KeyedService in the new patch set, together with ...
3 years, 6 months ago (2017-06-12 19:13:24 UTC) #55
grt (UTC plus 2)
down to the nits. maybe do the reordering in its own CL that contains no ...
3 years, 6 months ago (2017-06-12 20:43:39 UTC) #58
chengx
Hi Greg, I've address all the comments in the new patch set. PTAL, thanks! +pkasting@ ...
3 years, 6 months ago (2017-06-12 22:05:30 UTC) #66
Peter Kasting
browser_view.* LGTM with caveat https://codereview.chromium.org/2931573003/diff/380001/chrome/browser/ui/views/frame/browser_view.h File chrome/browser/ui/views/frame/browser_view.h (right): https://codereview.chromium.org/2931573003/diff/380001/chrome/browser/ui/views/frame/browser_view.h#newcode692 chrome/browser/ui/views/frame/browser_view.h:692: JumpList* jumplist_ = nullptr; I'm ...
3 years, 6 months ago (2017-06-12 22:21:54 UTC) #68
grt (UTC plus 2)
lgtm w/ nit/q below https://codereview.chromium.org/2931573003/diff/280001/chrome/browser/win/jumplist_factory.h File chrome/browser/win/jumplist_factory.h (right): https://codereview.chromium.org/2931573003/diff/280001/chrome/browser/win/jumplist_factory.h#newcode9 chrome/browser/win/jumplist_factory.h:9: #include "chrome/browser/win/jumplist.h" On 2017/06/12 22:05:30, ...
3 years, 6 months ago (2017-06-13 07:32:27 UTC) #78
chengx
I've addressed all the comments in the new patch set. Thanks for reviewing this CL! ...
3 years, 6 months ago (2017-06-13 19:16:01 UTC) #87
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/2931573003/420001
3 years, 6 months ago (2017-06-13 19:16:52 UTC) #90
commit-bot: I haz the power
Committed patchset #6 (id:420001) as https://chromium.googlesource.com/chromium/src/+/4a5397999a0f493c47632e1a8bd93686de54adbf
3 years, 6 months ago (2017-06-13 19:25:17 UTC) #93
chengx
A revert of this CL (patchset #6 id:420001) has been created in https://codereview.chromium.org/2937993002/ by chengx@chromium.org. ...
3 years, 6 months ago (2017-06-14 17:27:38 UTC) #94
grt (UTC plus 2)
https://codereview.chromium.org/2931573003/diff/420001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2931573003/diff/420001/chrome/browser/win/jumplist.cc#newcode480 chrome/browser/win/jumplist.cc:480: incognito_availability, update_results.get()), oh, snap! update_results.get() returns nullptr since the ...
3 years, 6 months ago (2017-06-14 20:11:32 UTC) #95
brucedawson
https://codereview.chromium.org/2931573003/diff/420001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2931573003/diff/420001/chrome/browser/win/jumplist.cc#newcode480 chrome/browser/win/jumplist.cc:480: incognito_availability, update_results.get()), On 2017/06/14 20:11:32, grt (UTC plus 2) ...
3 years, 6 months ago (2017-06-14 20:16:13 UTC) #97
chengx
PTAL the new patch set which fixes the crash issue. The pattern of obtaining the ...
3 years, 6 months ago (2017-06-15 02:53:56 UTC) #110
grt (UTC plus 2)
lgtm provided that you remove the null check https://codereview.chromium.org/2931573003/diff/500001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2931573003/diff/500001/chrome/browser/win/jumplist.cc#newcode475 chrome/browser/win/jumplist.cc:475: auto* ...
3 years, 6 months ago (2017-06-15 09:36:44 UTC) #111
chengx
Comments addressed. Thanks for the suggestions! https://codereview.chromium.org/2931573003/diff/500001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2931573003/diff/500001/chrome/browser/win/jumplist.cc#newcode475 chrome/browser/win/jumplist.cc:475: auto* update_results_raw = ...
3 years, 6 months ago (2017-06-15 21:24:47 UTC) #116
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/2931573003/490007
3 years, 6 months ago (2017-06-15 21:32:03 UTC) #119
commit-bot: I haz the power
3 years, 6 months ago (2017-06-15 21:36:53 UTC) #122
Message was sent while issue was closed.
Committed patchset #8 (id:490007) as
https://chromium.googlesource.com/chromium/src/+/f1c120eb244a567ec94bec0e8f43...

Powered by Google App Engine
This is Rietveld 408576698