Chromium Code Reviews| 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() { |