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

Unified Diff: chrome/browser/history/top_sites_impl.cc

Issue 23477033: Implementing URL prefix match for history thumbnail cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fixes. Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
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 c8f04660663ed1d5af5023a1a69a25c9d0876523..c874f1f55fa98a9c039b2b9b41d80358a9073b8b 100644
--- a/chrome/browser/history/top_sites_impl.cc
+++ b/chrome/browser/history/top_sites_impl.cc
@@ -291,6 +291,7 @@ void TopSitesImpl::GetMostVisitedURLs(
bool TopSitesImpl::GetPageThumbnail(
const GURL& url, scoped_refptr<base::RefCountedMemory>* bytes) {
// WARNING: this may be invoked on any thread.
+ // Perform exact match.
{
base::AutoLock lock(lock_);
if (thread_safe_cache_->GetPageThumbnail(url, bytes))
@@ -308,6 +309,15 @@ bool TopSitesImpl::GetPageThumbnail(
}
}
+ // Still not found, so trim query, and perform prefix match.
+ {
+ GURL::Replacements replacements;
+ replacements.ClearQuery();
+ GURL url_no_query(url.ReplaceComponents(replacements));
+ base::AutoLock lock(lock_);
+ if (thread_safe_cache_->GetPageThumbnailForPrefix(url_no_query, bytes))
+ return true;
+ }
return false;
}

Powered by Google App Engine
This is Rietveld 408576698