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

Unified Diff: chrome/browser/jumplist_win.cc

Issue 11515005: Delay updating jumplist to avoid blocking the file thread at start-up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean up a couple nits Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/browser/jumplist_win.h ('K') | « chrome/browser/jumplist_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/jumplist_win.cc
diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc
index 91c01207d86bfd9a255787bf6b1a0d9a4ba007dd..b80beaad4e23a2bd1be15a193ede8bb66ba729c4 100644
--- a/chrome/browser/jumplist_win.cc
+++ b/chrome/browser/jumplist_win.cc
@@ -37,7 +37,9 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
#include "googleurl/src/gurl.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -488,7 +490,9 @@ 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),
+ first_page_load_(true),
+ update_pending_(false) {
}
JumpList::~JumpList() {
@@ -534,6 +538,9 @@ bool JumpList::AddObserver(Profile* profile) {
// observers are detatched at that time.
registrar_->Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED,
content::Source<Profile>(profile_));
+ // Register for notification of when
+ registrar_->Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
+ content::NotificationService::AllSources());
jeremy 2012/12/12 08:16:09 I think 'content::' should be aligned under 'this'
Cait (Slow) 2012/12/12 17:09:17 Done.
}
tab_restore_service->AddObserver(this);
return true;
@@ -558,6 +565,17 @@ void JumpList::Observe(int type,
Terminate();
break;
}
+ case content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME: {
+ if (first_page_load_) {
+ first_page_load_ = false;
+ if (update_pending_) {
+ update_pending_ = false;
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&JumpList::RunUpdate, this));
+ }
+ }
+ }
jeremy 2012/12/12 08:16:09 break ?
Cait (Slow) 2012/12/12 17:09:17 Done.
default:
NOTREACHED() << "Unexpected notification type.";
}
@@ -695,9 +713,13 @@ 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));
+ if (first_page_load_) {
+ update_pending_ = true;
+ } else {
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ base::Bind(&JumpList::RunUpdate, this));
+ }
return;
}
// Ask FaviconService if it has a favicon of a URL.
« chrome/browser/jumplist_win.h ('K') | « chrome/browser/jumplist_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698