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

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

Issue 369503007: Remove dead code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 void TopSitesImpl::Init(const base::FilePath& db_name) { 123 void TopSitesImpl::Init(const base::FilePath& db_name) {
124 // Create the backend here, rather than in the constructor, so that 124 // Create the backend here, rather than in the constructor, so that
125 // unit tests that do not need the backend can run without a problem. 125 // unit tests that do not need the backend can run without a problem.
126 backend_ = new TopSitesBackend; 126 backend_ = new TopSitesBackend;
127 backend_->Init(db_name); 127 backend_->Init(db_name);
128 backend_->GetMostVisitedThumbnails( 128 backend_->GetMostVisitedThumbnails(
129 base::Bind(&TopSitesImpl::OnGotMostVisitedThumbnails, 129 base::Bind(&TopSitesImpl::OnGotMostVisitedThumbnails,
130 base::Unretained(this)), 130 base::Unretained(this)),
131 &cancelable_task_tracker_); 131 &backend_task_tracker_);
132 } 132 }
133 133
134 bool TopSitesImpl::SetPageThumbnail(const GURL& url, 134 bool TopSitesImpl::SetPageThumbnail(const GURL& url,
135 const gfx::Image& thumbnail, 135 const gfx::Image& thumbnail,
136 const ThumbnailScore& score) { 136 const ThumbnailScore& score) {
137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 137 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
138 138
139 if (!loaded_) { 139 if (!loaded_) {
140 // TODO(sky): I need to cache these and apply them after the load 140 // TODO(sky): I need to cache these and apply them after the load
141 // completes. 141 // completes.
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 } 371 }
372 ResetThreadSafeCache(); 372 ResetThreadSafeCache();
373 NotifyTopSitesChanged(); 373 NotifyTopSitesChanged();
374 } 374 }
375 375
376 void TopSitesImpl::Shutdown() { 376 void TopSitesImpl::Shutdown() {
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 history_consumer_.CancelAllRequests(); 381 history_task_tracker_.TryCancelAll();
382 backend_task_tracker_.TryCancelAll();
382 backend_->Shutdown(); 383 backend_->Shutdown();
383 } 384 }
384 385
385 // static 386 // static
386 void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list, 387 void TopSitesImpl::DiffMostVisited(const MostVisitedURLList& old_list,
387 const MostVisitedURLList& new_list, 388 const MostVisitedURLList& new_list,
388 TopSitesDelta* delta) { 389 TopSitesDelta* delta) {
389 390
390 // Add all the old URLs for quick lookup. This maps URLs to the corresponding 391 // Add all the old URLs for quick lookup. This maps URLs to the corresponding
391 // index in the input. 392 // index in the input.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 438
438 // Any member without the special marker in the all_old_urls list means that 439 // Any member without the special marker in the all_old_urls list means that
439 // there wasn't a "new" URL that mapped to it, so it was deleted. 440 // there wasn't a "new" URL that mapped to it, so it was deleted.
440 for (std::map<GURL, size_t>::const_iterator i = all_old_urls.begin(); 441 for (std::map<GURL, size_t>::const_iterator i = all_old_urls.begin();
441 i != all_old_urls.end(); ++i) { 442 i != all_old_urls.end(); ++i) {
442 if (i->second != kAlreadyFoundMarker) 443 if (i->second != kAlreadyFoundMarker)
443 delta->deleted.push_back(old_list[i->second]); 444 delta->deleted.push_back(old_list[i->second]);
444 } 445 }
445 } 446 }
446 447
447 CancelableRequestProvider::Handle TopSitesImpl::StartQueryForMostVisited() { 448 base::CancelableTaskTracker::TaskId TopSitesImpl::StartQueryForMostVisited() {
448 DCHECK(loaded_); 449 DCHECK(loaded_);
449 if (!profile_) 450 if (!profile_)
450 return 0; 451 return base::CancelableTaskTracker::kBadTaskId;
451 452
452 HistoryService* hs = HistoryServiceFactory::GetForProfile( 453 HistoryService* hs = HistoryServiceFactory::GetForProfile(
453 profile_, Profile::EXPLICIT_ACCESS); 454 profile_, Profile::EXPLICIT_ACCESS);
454 // |hs| may be null during unit tests. 455 // |hs| may be null during unit tests.
455 if (hs) { 456 if (hs) {
456 return hs->QueryMostVisitedURLs( 457 return hs->QueryMostVisitedURLs(
457 num_results_to_request_from_history(), 458 num_results_to_request_from_history(),
458 kDaysOfHistory, 459 kDaysOfHistory,
459 base::Bind(&TopSitesImpl::OnTopSitesAvailableFromHistory, 460 base::Bind(&TopSitesImpl::OnTopSitesAvailableFromHistory,
460 base::Unretained(this)), 461 base::Unretained(this)),
461 &cancelable_task_tracker_); 462 &history_task_tracker_);
blundell 2014/07/03 08:29:12 is this a bugfix?
sdefresne 2014/07/22 14:29:06 This is unnecessary and removed.
462 } 463 }
463 return 0; 464 return base::CancelableTaskTracker::kBadTaskId;
464 } 465 }
465 466
466 bool TopSitesImpl::IsKnownURL(const GURL& url) { 467 bool TopSitesImpl::IsKnownURL(const GURL& url) {
467 return loaded_ && cache_->IsKnownURL(url); 468 return loaded_ && cache_->IsKnownURL(url);
468 } 469 }
469 470
470 const std::string& TopSitesImpl::GetCanonicalURLString(const GURL& url) const { 471 const std::string& TopSitesImpl::GetCanonicalURLString(const GURL& url) const {
471 return cache_->GetCanonicalURL(url).spec(); 472 return cache_->GetCanonicalURL(url).spec();
472 } 473 }
473 474
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 base::TimeDelta::FromSeconds(kUpdateIntervalSecs)); 930 base::TimeDelta::FromSeconds(kUpdateIntervalSecs));
930 } 931 }
931 932
932 void TopSitesImpl::OnTopSitesAvailableFromHistory( 933 void TopSitesImpl::OnTopSitesAvailableFromHistory(
933 const MostVisitedURLList* pages) { 934 const MostVisitedURLList* pages) {
934 DCHECK(pages); 935 DCHECK(pages);
935 SetTopSites(*pages); 936 SetTopSites(*pages);
936 } 937 }
937 938
938 } // namespace history 939 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698