Update different JumpList categories on demand

The JumpList class is an observer of the TopSites class as well as the
TabRestoreService class. Each time TopSites gets updated or a tab is
removed, the JumpList is updated. Chrome JumpList has two categories,
namely "Most visited" and "Recently closed", whose icon files are
updated altogether in a single JumpList update run. The icon files are
updated in the way that old icons are deleted followed by new icons'
creation.

However, updating icons for both categories together is unnecessary.
When the TopSites class has changes, it affects the "Most visited"
category only; while when the TabRestoreService class has changes, it
affects the "Recently closed" only. In this sense, we should update
each category on demand rather than in every JumpList update even when
there's no change for that category.

Initially, each JumpList update involves 24 icons' deletion and 24
icons' creation. After crrev.com/2816113002 (Fix to not create
jumplist icon files that aren't used by shell) was landed, this number
was reduced from 24*2 to 10*2. This CL further reduced this number to
~4*2 per JumpList update. As each icon file is 28 KB, these two CLs
together have reduced the disk IO from 48*28=1344 KB to 8*28=224 KB by
83% per JumpList update.

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 only one category is updated for almost all the
time, we'll still have icons for the other category if the OS
notification step fails. That says, we'll still have about half of the
icons instead of nothing, which's clearly better.

This CL changes the JumpList related directory. Since the icon files
for the two categories are dealt with separately, it's more efficient
to put them in separate folders rather than in a single JumpListIcons
folder. This CL introduces two new folders JumpListIconsMostVisited
and JumpListIconsRecentClosed for this purpose. As the JumpListIcons
folder is no longer needed, this CL posts a background task to delete
it.

BUG=40407, 179576, 715902, 716115

Review-Url: https://codereview.chromium.org/2836873003
Cr-Commit-Position: refs/heads/master@{#467788}
2 files changed