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

Issue 2859193005: Cache JumpList icons to avoid unnecessary creation and deletion (Closed)

Created:
3 years, 7 months ago by chengx
Modified:
3 years, 7 months ago
Reviewers:
grt (UTC plus 2)
CC:
chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Cache JumpList icons to avoid unnecessary creation and deletion Previously, when a JumpList category ("Mostly visited" or "Recently closed") is updated, new icons are created and written into the corresponding folder after all old icons in the same folder are deleted. However, there's usually a (big) overlap between the new and old icons. This means that we're deleting a lot of icons and then creating the same ones in each update, which is very inefficient. For example, JumpList can show at most 3 items for "Recently closed" category. Therefore, there are usually 3 icons existed for this JumpList category. When a Chrome tab gets closed, the icons for this category is updated. Previously, we delete all 3 existing icons and then create 3 new ones. However, the most efficient way is to create one icon (if it doesn't exist) only for this closed tab and delete the least recent one. If this icon exists already, we don't need to delete and create any icon files at all. To fix this, we introduce two maps to cache the URL-IconFilePath information of the two JumpList categories. With the help of these maps, we are able to avoid deleting and creating the same icons. The JumpList icon folders will be cleaned entirely only in the following situations: 1) The "Most visited" category updates for the first time after Chrome is launched. This actually happens right after Chrome is launched. 2) The "Recently closed" category updates for the first time after Chrome is launched. This happens when a first Chrome tab is closed. 3) The number of icons in the jumplist icon folders has exceeded the limit, which is currently set to 12 for "most visited" category and 6 for "recently closed" category, respectively. This is very important as it prevents the jumplist folders from getting bloated endlessly. Note that some sites change the favicon to indicate status. Since caching is done based on the URL rather than the image itself, the jumplist won't pick up these stats updates. Given the fact that this cache mechanism improves the performance nicely, this is an okay compromise. [Impact on UI side] This CL also relieves the following issue. Currently, notifying the OS about the JumpList update takes place after the old icon files are deleted. This order is critical as it can avoid the JumpList folder from getting accumulated endlessly. On the other hand, if the OS notification step fails which does happen sometimes according to UMA data, the old JumpList will still be used. However, since the old icons have been deleted, there'll be nothing but the background color showing up where the icons should show up. This doesn't look good. With this CL, since we're now only deleting the retired icons rather than all the old icons, we'll still have most of the old icons if the OS notification step fails, which makes the JumpList look much better in this situation. BUG=40407, 179576, 715902, 716115 Review-Url: https://codereview.chromium.org/2859193005 Cr-Commit-Position: refs/heads/master@{#473078} Committed: https://chromium.googlesource.com/chromium/src/+/8127957d51be9220f6d5f64c637cd3a9d5566ea8

Patch Set 1 #

Total comments: 20

Patch Set 2 : Address comments #

Total comments: 24

Patch Set 3 : Git pull #

Patch Set 4 : Address more comments #

Total comments: 6

Patch Set 5 : Fix nits. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+194 lines, -19 lines) Patch
M chrome/browser/win/jumplist.h View 1 2 3 4 5 chunks +20 lines, -4 lines 0 comments Download
M chrome/browser/win/jumplist.cc View 1 2 3 4 6 chunks +85 lines, -14 lines 0 comments Download
M chrome/browser/win/jumplist_file_util.h View 1 2 chunks +9 lines, -0 lines 0 comments Download
M chrome/browser/win/jumplist_file_util.cc View 1 1 chunk +31 lines, -0 lines 0 comments Download
M chrome/browser/win/jumplist_file_util_unittest.cc View 1 1 chunk +44 lines, -0 lines 0 comments Download
M chrome/browser/win/jumplist_updater.h View 1 2 3 4 3 chunks +5 lines, -1 line 0 comments Download

Messages

Total messages: 108 (95 generated)
chengx
Hi Greg, finally I implemented the icon caching idea. PTAL, thanks! Since I need to ...
3 years, 7 months ago (2017-05-06 02:26:53 UTC) #29
grt (UTC plus 2)
hi xi. can you wait a few days for a full review of this? https://codereview.chromium.org/2859193005/diff/240001/chrome/browser/win/jumplist.h ...
3 years, 7 months ago (2017-05-08 09:40:59 UTC) #46
chengx
On 2017/05/08 09:40:59, grt (UTC plus 2) wrote: > hi xi. can you wait a ...
3 years, 7 months ago (2017-05-08 16:25:05 UTC) #47
chengx
Hi Greg, I've landed crrev.com/2870853002/ to just change 4 functions to JumpList class member functions, ...
3 years, 7 months ago (2017-05-10 22:21:35 UTC) #65
chengx
After a second thought, I decided to delete all previous patch sets to avoid any ...
3 years, 7 months ago (2017-05-11 05:03:56 UTC) #67
grt (UTC plus 2)
I love the level of detail in the CL description. One suggestion: consider that the ...
3 years, 7 months ago (2017-05-11 20:29:13 UTC) #68
chengx
Thanks a lot for the feedback! I've addressed all the comments in new patch set. ...
3 years, 7 months ago (2017-05-12 01:04:25 UTC) #77
grt (UTC plus 2)
https://codereview.chromium.org/2859193005/diff/440001/chrome/browser/win/jumplist.cc File chrome/browser/win/jumplist.cc (right): https://codereview.chromium.org/2859193005/diff/440001/chrome/browser/win/jumplist.cc#newcode584 chrome/browser/win/jumplist.cc:584: if (!source_map) remove this check -- it can't be ...
3 years, 7 months ago (2017-05-15 11:28:19 UTC) #83
chengx
Hi Greg, I've addressed all the comments in the new patch set. PTAL, thanks! I ...
3 years, 7 months ago (2017-05-17 21:59:36 UTC) #86
grt (UTC plus 2)
lgtm w/ a question: do you want to add metrics to see how many icons ...
3 years, 7 months ago (2017-05-18 09:00:00 UTC) #91
chengx
On 2017/05/18 09:00:00, grt (UTC plus 2) wrote: > lgtm w/ a question: do you ...
3 years, 7 months ago (2017-05-18 17:21:56 UTC) #94
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/2859193005/510007
3 years, 7 months ago (2017-05-19 00:54:48 UTC) #105
commit-bot: I haz the power
3 years, 7 months ago (2017-05-19 04:05:36 UTC) #108
Message was sent while issue was closed.
Committed patchset #5 (id:510007) as
https://chromium.googlesource.com/chromium/src/+/8127957d51be9220f6d5f64c637c...

Powered by Google App Engine
This is Rietveld 408576698