| Index: chrome/browser/win/jumplist.cc
|
| diff --git a/chrome/browser/win/jumplist.cc b/chrome/browser/win/jumplist.cc
|
| index 7ebb5eab0553e7be09175a4f82c941bac03e2de6..d6d5596bcfb398b568ccb39fbb82b380bb72ae52 100644
|
| --- a/chrome/browser/win/jumplist.cc
|
| +++ b/chrome/browser/win/jumplist.cc
|
| @@ -275,8 +275,13 @@ void JumpList::TopSitesChanged(history::TopSites* top_sites,
|
| // If we have a pending favicon request, cancel it here as it's out of date.
|
| CancelPendingUpdate();
|
|
|
| - // Initialize the one-shot timer to update the JumpList in a while.
|
| - InitializeTimerForUpdate();
|
| + // When the first tab is closed in one session, it doesn't trigger an update
|
| + // but a TopSites sync. This sync will trigger an update for both mostly
|
| + // visited and recently closed categories. We don't delay this TopSites sync.
|
| + if (has_topsites_sync)
|
| + InitializeTimerForUpdate();
|
| + else
|
| + ProcessNotifications();
|
| }
|
|
|
| void JumpList::TabRestoreServiceChanged(sessions::TabRestoreService* service) {
|
| @@ -312,12 +317,13 @@ void JumpList::InitializeTimerForUpdate() {
|
| timer_.Reset();
|
| } else {
|
| // base::Unretained is safe since |this| is guaranteed to outlive timer_.
|
| - timer_.Start(FROM_HERE, kDelayForJumplistUpdate,
|
| - base::Bind(&JumpList::OnDelayTimer, base::Unretained(this)));
|
| + timer_.Start(
|
| + FROM_HERE, kDelayForJumplistUpdate,
|
| + base::Bind(&JumpList::ProcessNotifications, base::Unretained(this)));
|
| }
|
| }
|
|
|
| -void JumpList::OnDelayTimer() {
|
| +void JumpList::ProcessNotifications() {
|
| DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
| DCHECK(!update_in_progress_);
|
|
|
| @@ -330,6 +336,17 @@ void JumpList::OnDelayTimer() {
|
| if (tab_restore_has_pending_notification_) {
|
| tab_restore_has_pending_notification_ = false;
|
| ProcessTabRestoreServiceNotification();
|
| +
|
| + // Force a TopSite history sync when closing a first tab in one session.
|
| + if (!has_tab_closed_) {
|
| + has_tab_closed_ = true;
|
| + scoped_refptr<history::TopSites> top_sites =
|
| + TopSitesFactory::GetForProfile(profile_);
|
| + if (top_sites) {
|
| + top_sites->SyncWithHistory();
|
| + return;
|
| + }
|
| + }
|
| }
|
|
|
| // If TopSites has updates, retrieve the URLs asynchronously, and on its
|
| @@ -354,6 +371,8 @@ void JumpList::ProcessTopSitesNotification() {
|
| return;
|
| }
|
|
|
| + has_topsites_sync = true;
|
| +
|
| scoped_refptr<history::TopSites> top_sites =
|
| TopSitesFactory::GetForProfile(profile_);
|
| if (top_sites) {
|
| @@ -400,15 +419,6 @@ void JumpList::ProcessTabRestoreServiceNotification() {
|
| }
|
|
|
| recently_closed_should_update_ = true;
|
| -
|
| - // Force a TopSite history sync when closing a first tab in one session.
|
| - if (!has_tab_closed_) {
|
| - has_tab_closed_ = true;
|
| - scoped_refptr<history::TopSites> top_sites =
|
| - TopSitesFactory::GetForProfile(profile_);
|
| - if (top_sites)
|
| - top_sites->SyncWithHistory();
|
| - }
|
| }
|
|
|
| void JumpList::OnMostVisitedURLsAvailable(
|
|
|