diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 14:55:30 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-03 14:55:30 +0000 |
commit | 50e4d108e53f020aa8029bde69280a41c33f6a9c (patch) | |
tree | 864803e8f958328e91937b340cec0ecc3ea5f060 /chrome/browser/jumplist_win.cc | |
parent | b55a1271b4993794690c18a50220efcc2617149b (diff) | |
download | chromium_src-50e4d108e53f020aa8029bde69280a41c33f6a9c.zip chromium_src-50e4d108e53f020aa8029bde69280a41c33f6a9c.tar.gz chromium_src-50e4d108e53f020aa8029bde69280a41c33f6a9c.tar.bz2 |
NotificationRegistrar dtor must be called on same thread as Add()
fixes a TODO
BUG=109000
TEST=existing tests pass
Review URL: http://codereview.chromium.org/9301036
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/jumplist_win.cc')
-rw-r--r-- | chrome/browser/jumplist_win.cc | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index 2413c9e..dc510c1 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -522,14 +522,15 @@ bool JumpList::AddObserver(Profile* profile) { // your profile is empty. Ask TopSites to update itself when jumplist is // initialized. top_sites->SyncWithHistory(); + registrar_.reset(new content::NotificationRegistrar); // Register for notification when TopSites changes so that we can update // ourself. - registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED, - content::Source<history::TopSites>(top_sites)); + registrar_->Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED, + content::Source<history::TopSites>(top_sites)); // Register for notification when profile is destroyed to ensure that all // observers are detatched at that time. - registrar_.Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, - content::Source<Profile>(profile_)); + registrar_->Add(this, chrome::NOTIFICATION_PROFILE_DESTROYED, + content::Source<Profile>(profile_)); } tab_restore_service->AddObserver(this); return true; @@ -566,12 +567,7 @@ void JumpList::RemoveObserver() { TabRestoreServiceFactory::GetForProfile(profile_); if (tab_restore_service) tab_restore_service->RemoveObserver(this); - registrar_.Remove( - this, chrome::NOTIFICATION_TOP_SITES_CHANGED, - content::Source<history::TopSites>(profile_->GetTopSites())); - registrar_.Remove( - this, chrome::NOTIFICATION_PROFILE_DESTROYED, - content::Source<Profile>(profile_)); + registrar_.reset(); } profile_ = NULL; } |