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

Side by Side Diff: chrome/browser/history/top_sites_impl.cc

Issue 861273002: Make TopSites a RefcountedKeyedService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compilation Created 5 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/history/top_sites_impl.h" 5 #include "chrome/browser/history/top_sites_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 { 366 {
367 DictionaryPrefUpdate update(profile_->GetPrefs(), 367 DictionaryPrefUpdate update(profile_->GetPrefs(),
368 prefs::kNtpMostVisitedURLsBlacklist); 368 prefs::kNtpMostVisitedURLsBlacklist);
369 base::DictionaryValue* blacklist = update.Get(); 369 base::DictionaryValue* blacklist = update.Get();
370 blacklist->Clear(); 370 blacklist->Clear();
371 } 371 }
372 ResetThreadSafeCache(); 372 ResetThreadSafeCache();
373 NotifyTopSitesChanged(); 373 NotifyTopSitesChanged();
374 } 374 }
375 375
376 void TopSitesImpl::Shutdown() { 376 void TopSitesImpl::ShutdownOnUIThread() {
377 profile_ = NULL; 377 profile_ = NULL;
378 // Cancel all requests so that the service doesn't callback to us after we've 378 // Cancel all requests so that the service doesn't callback to us after we've
379 // invoked Shutdown (this could happen if we have a pending request and 379 // invoked Shutdown (this could happen if we have a pending request and
380 // Shutdown is invoked). 380 // Shutdown is invoked).
381 cancelable_task_tracker_.TryCancelAll(); 381 cancelable_task_tracker_.TryCancelAll();
382 backend_->Shutdown(); 382 registrar_.RemoveAll();
383 // The TopSitesBackend may not be created during unit tests.
384 if (backend_)
385 backend_->Shutdown();
383 } 386 }
384 387
385 // static 388 // static
386 void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list, 389 void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list,
387 const MostVisitedURLList& new_list, 390 const MostVisitedURLList& new_list,
388 TopSitesDelta* delta) { 391 TopSitesDelta* delta) {
389 392
390 // Add all the old URLs for quick lookup. This maps URLs to the corresponding 393 // Add all the old URLs for quick lookup. This maps URLs to the corresponding
391 // index in the input. 394 // index in the input.
392 std::map<GURL, size_t> all_old_urls; 395 std::map<GURL, size_t> all_old_urls;
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 base::TimeDelta::FromSeconds(kUpdateIntervalSecs)); 922 base::TimeDelta::FromSeconds(kUpdateIntervalSecs));
920 } 923 }
921 924
922 void TopSitesImpl::OnTopSitesAvailableFromHistory( 925 void TopSitesImpl::OnTopSitesAvailableFromHistory(
923 const MostVisitedURLList* pages) { 926 const MostVisitedURLList* pages) {
924 DCHECK(pages); 927 DCHECK(pages);
925 SetTopSites(*pages); 928 SetTopSites(*pages);
926 } 929 }
927 930
928 } // namespace history 931 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/history/top_sites_impl.h ('k') | chrome/browser/history/top_sites_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698