| Index: chrome/browser/history/top_sites.cc
|
| diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
|
| index 668c4df50e0e98d0f767663733edfb86b3f268ca..48bcc4d07e7c094dc5e41326f5c52faa31c5b1b6 100644
|
| --- a/chrome/browser/history/top_sites.cc
|
| +++ b/chrome/browser/history/top_sites.cc
|
| @@ -181,8 +181,8 @@ bool TopSites::SetPageThumbnail(const GURL& url,
|
| }
|
|
|
| bool add_temp_thumbnail = false;
|
| - if (!cache_->IsKnownURL(url)) {
|
| - if (cache_->top_sites().size() < kTopSitesNumber) {
|
| + if (!IsKnownURL(url)) {
|
| + if (!IsFull()) {
|
| add_temp_thumbnail = true;
|
| } else {
|
| return false; // This URL is not known to us.
|
| @@ -237,6 +237,13 @@ bool TopSites::GetPageThumbnail(const GURL& url,
|
| return thread_safe_cache_->GetPageThumbnail(url, bytes);
|
| }
|
|
|
| +bool TopSites::GetPageThumbnailScore(const GURL& url,
|
| + ThumbnailScore* score) {
|
| + // WARNING: this may be invoked on any thread.
|
| + base::AutoLock lock(lock_);
|
| + return thread_safe_cache_->GetPageThumbnailScore(url, score);
|
| +}
|
| +
|
| // Returns the index of |url| in |urls|, or -1 if not found.
|
| static int IndexOf(const MostVisitedURLList& urls, const GURL& url) {
|
| for (size_t i = 0; i < urls.size(); i++) {
|
| @@ -449,6 +456,14 @@ CancelableRequestProvider::Handle TopSites::StartQueryForMostVisited() {
|
| return 0;
|
| }
|
|
|
| +bool TopSites::IsKnownURL(const GURL& url) {
|
| + return loaded_ && cache_->IsKnownURL(url);
|
| +}
|
| +
|
| +bool TopSites::IsFull() {
|
| + return loaded_ && cache_->top_sites().size() >= kTopSitesNumber;
|
| +}
|
| +
|
| TopSites::~TopSites() {
|
| }
|
|
|
| @@ -724,7 +739,7 @@ void TopSites::Observe(NotificationType type,
|
| }
|
| StartQueryForMostVisited();
|
| } else if (type == NotificationType::NAV_ENTRY_COMMITTED) {
|
| - if (cache_->top_sites().size() < kTopSitesNumber) {
|
| + if (!IsFull()) {
|
| NavigationController::LoadCommittedDetails* load_details =
|
| Details<NavigationController::LoadCommittedDetails>(details).ptr();
|
| if (!load_details)
|
|
|