Chromium Code Reviews| Index: chrome/browser/jumplist_win.cc |
| diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc |
| index 91c01207d86bfd9a255787bf6b1a0d9a4ba007dd..da751af8945ddf5c622313d9aee0bde28755089d 100644 |
| --- a/chrome/browser/jumplist_win.cc |
| +++ b/chrome/browser/jumplist_win.cc |
| @@ -19,6 +19,7 @@ |
| #include "base/path_service.h" |
| #include "base/string_util.h" |
| #include "base/threading/thread.h" |
| +#include "base/time.h" |
| #include "base/utf_string_conversions.h" |
| #include "base/win/scoped_comptr.h" |
| #include "base/win/windows_version.h" |
| @@ -488,7 +489,8 @@ bool UpdateJumpList(const wchar_t* app_id, |
| JumpList::JumpList() |
| : ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)), |
| profile_(NULL), |
| - task_id_(CancelableTaskTracker::kBadTaskId) { |
| + task_id_(CancelableTaskTracker::kBadTaskId), |
| + status_(UPDATE_NOT_RUN) { |
| } |
| JumpList::~JumpList() { |
| @@ -695,9 +697,23 @@ void JumpList::StartLoadingFavicon() { |
| if (icon_urls_.empty()) { |
| // No more favicons are needed by the application JumpList. Schedule a |
| // RunUpdate call. |
| - BrowserThread::PostTask( |
| - BrowserThread::FILE, FROM_HERE, |
| - base::Bind(&JumpList::RunUpdate, this)); |
| + switch (status_) { |
| + case UPDATE_NOT_RUN: |
| + BrowserThread::PostDelayedTask( |
| + BrowserThread::FILE, FROM_HERE, |
| + base::Bind(&JumpList::RunUpdate, this), |
| + base::TimeDelta::FromSeconds(15)); |
|
jeremy
2012/12/11 14:57:22
Some startups are longer than 15 seconds, in other
Cait (Slow)
2012/12/11 15:37:44
In this case, would NOTIFICATION_LOAD_COMPLETED_MA
jeremy
2012/12/11 16:50:02
Only for telling when startup is complete, thanks!
Cait (Slow)
2012/12/11 20:54:34
Done.
|
| + status_ = UPDATE_PENDING; |
| + break; |
| + case UPDATE_PENDING: |
| + break; |
| + case NONE_PENDING: |
| + BrowserThread::PostTask( |
| + BrowserThread::FILE, FROM_HERE, |
| + base::Bind(&JumpList::RunUpdate, this)); |
| + break; |
| + } |
| + |
| return; |
| } |
| // Ask FaviconService if it has a favicon of a URL. |
| @@ -744,6 +760,7 @@ void JumpList::RunUpdate() { |
| { |
| base::AutoLock auto_lock(list_lock_); |
| + status_ = NONE_PENDING; |
| // Make sure we are not out of date: if icon_urls_ is not empty, then |
| // another notification has been received since we processed this one |
| if (!icon_urls_.empty()) |