| Index: chrome/browser/history/top_sites_impl.cc
|
| diff --git a/chrome/browser/history/top_sites_impl.cc b/chrome/browser/history/top_sites_impl.cc
|
| index 2cad9e33fbef645cfcc91427f0957dfaae3cf286..64299647b298f1175016d0aa3bde5736da767354 100644
|
| --- a/chrome/browser/history/top_sites_impl.cc
|
| +++ b/chrome/browser/history/top_sites_impl.cc
|
| @@ -625,7 +625,7 @@ bool TopSitesImpl::AddForcedURL(const GURL& url, const base::Time& time) {
|
| new_list.insert(mid, new_url);
|
| mid = new_list.begin() + num_forced; // Mid was invalidated.
|
| std::inplace_merge(new_list.begin(), mid, mid + 1, ForcedURLComparator);
|
| - SetTopSites(new_list);
|
| + SetTopSites(new_list, false);
|
| return true;
|
| }
|
|
|
| @@ -752,7 +752,8 @@ void TopSitesImpl::Observe(int type,
|
| }
|
| }
|
|
|
| -void TopSitesImpl::SetTopSites(const MostVisitedURLList& new_top_sites) {
|
| +void TopSitesImpl::SetTopSites(
|
| + const MostVisitedURLList& new_top_sites, bool startup) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| MostVisitedURLList top_sites(new_top_sites);
|
| @@ -762,7 +763,7 @@ void TopSitesImpl::SetTopSites(const MostVisitedURLList& new_top_sites) {
|
| TopSitesDelta delta;
|
| DiffMostVisited(cache_->top_sites(), top_sites, &delta);
|
| if (!delta.deleted.empty() || !delta.added.empty() || !delta.moved.empty()) {
|
| - backend_->UpdateTopSites(delta);
|
| + backend_->UpdateTopSites(delta, startup);
|
| }
|
|
|
| last_num_urls_changed_ = delta.added.size() + delta.moved.size();
|
| @@ -879,7 +880,7 @@ void TopSitesImpl::OnGotMostVisitedThumbnails(
|
| // Set the top sites directly in the cache so that SetTopSites diffs
|
| // correctly.
|
| cache_->SetTopSites(thumbnails->most_visited);
|
| - SetTopSites(thumbnails->most_visited);
|
| + SetTopSites(thumbnails->most_visited, true);
|
| cache_->SetThumbnails(thumbnails->url_to_images_map);
|
|
|
| ResetThreadSafeImageCache();
|
| @@ -894,7 +895,7 @@ void TopSitesImpl::OnGotMostVisitedThumbnails(
|
| void TopSitesImpl::OnTopSitesAvailableFromHistory(
|
| const MostVisitedURLList* pages) {
|
| DCHECK(pages);
|
| - SetTopSites(*pages);
|
| + SetTopSites(*pages, false);
|
| }
|
|
|
| void TopSitesImpl::OnURLsDeleted(HistoryService* history_service,
|
| @@ -906,7 +907,7 @@ void TopSitesImpl::OnURLsDeleted(HistoryService* history_service,
|
| return;
|
|
|
| if (all_history) {
|
| - SetTopSites(MostVisitedURLList());
|
| + SetTopSites(MostVisitedURLList(), false);
|
| backend_->ResetDatabase();
|
| } else {
|
| std::set<size_t> indices_to_delete; // Indices into top_sites_.
|
| @@ -923,7 +924,7 @@ void TopSitesImpl::OnURLsDeleted(HistoryService* history_service,
|
| i != indices_to_delete.rend(); i++) {
|
| new_top_sites.erase(new_top_sites.begin() + *i);
|
| }
|
| - SetTopSites(new_top_sites);
|
| + SetTopSites(new_top_sites, false);
|
| }
|
| StartQueryForMostVisited();
|
| }
|
|
|