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

Unified Diff: chrome/browser/history/top_sites.cc

Issue 6901110: GTK: Query TopSites for the Most Visited pages and populate fill in the global History menu. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make TopSites broadcast its change notification on all blacklist/pinned url changes. Created 9 years, 8 months 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
Index: chrome/browser/history/top_sites.cc
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index f985259f1e6e7e06d9c3e56461343e4de33493b0..134db043fc21bb9798a34cd9d77ef5f6d82e027b 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -832,11 +832,9 @@ void TopSites::SetTopSites(const MostVisitedURLList& new_top_sites) {
MostVisitedURLList top_sites(new_top_sites);
AddPrepopulatedPages(&top_sites);
- bool changed = false;
TopSitesDelta delta;
DiffMostVisited(cache_->top_sites(), top_sites, &delta);
if (!delta.deleted.empty() || !delta.added.empty() || !delta.moved.empty()) {
- changed = true;
backend_->UpdateTopSites(delta);
}
@@ -860,7 +858,6 @@ void TopSites::SetTopSites(const MostVisitedURLList& new_top_sites) {
SetPageThumbnailEncoded(mv.url,
it->second.thumbnail,
it->second.thumbnail_score);
- changed = true;
temp_images_.erase(it);
break;
}
@@ -871,15 +868,8 @@ void TopSites::SetTopSites(const MostVisitedURLList& new_top_sites) {
if (top_sites.size() >= kTopSitesNumber)
temp_images_.clear();
- ResetThreadSafeCache();
ResetThreadSafeImageCache();
sky 2011/04/28 22:31:43 We need to set the images after the cache.
Elliot Glaysher 2011/04/28 23:08:35 Reworked so sending the notification is its own fu
-
- if (changed) {
- NotificationService::current()->Notify(
- NotificationType::TOP_SITES_CHANGED,
- Source<TopSites>(this),
- NotificationService::NoDetails());
- }
+ ResetThreadSafeCache();
// Restart the timer that queries history for top sites. This is done to
// ensure we stay in sync with history.
@@ -920,10 +910,19 @@ void TopSites::MoveStateToLoaded() {
}
void TopSites::ResetThreadSafeCache() {
- base::AutoLock lock(lock_);
- MostVisitedURLList cached;
- ApplyBlacklistAndPinnedURLs(cache_->top_sites(), &cached);
- thread_safe_cache_->SetTopSites(cached);
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ {
+ base::AutoLock lock(lock_);
+ MostVisitedURLList cached;
+ ApplyBlacklistAndPinnedURLs(cache_->top_sites(), &cached);
+ thread_safe_cache_->SetTopSites(cached);
+ }
+
+ NotificationService::current()->Notify(
+ NotificationType::TOP_SITES_CHANGED,
Evan Stade 2011/04/28 22:40:21 p.s. this is something the most visited handler fo
Elliot Glaysher 2011/04/28 23:08:35 sky added this notification earlier today. I was s
+ Source<TopSites>(this),
+ NotificationService::NoDetails());
}
void TopSites::ResetThreadSafeImageCache() {
« no previous file with comments | « no previous file | chrome/browser/ui/gtk/global_history_menu.h » ('j') | chrome/browser/ui/gtk/global_history_menu.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698