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

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

Issue 6813040: Add TopSites::GetTemporaryThumbnailScore(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/history/top_sites_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/top_sites.cc
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index 71d3316cbb1bfe15adc2b82dad942d7e1fd858e7..2d38aec9cb70246119483b253a67ade92772f047 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -247,6 +247,15 @@ bool TopSites::GetPageThumbnail(const GURL& url,
scoped_refptr<RefCountedBytes>* bytes) {
// WARNING: this may be invoked on any thread.
base::AutoLock lock(lock_);
sky 2011/04/11 14:31:09 The rest of the class doesn't lock around lock_ wh
satorux1 2011/04/11 15:19:09 That makes a lot of sense. I've updated the patch
+
+ // The thumbnail may be found in the temporary images.
+ for (TempImages::iterator i = temp_images_.begin(); i != temp_images_.end();
+ ++i) {
+ if (i->first == url) {
+ *bytes = i->second.thumbnail;
+ return true;
+ }
+ }
return thread_safe_cache_->GetPageThumbnail(url, bytes);
}
@@ -254,6 +263,15 @@ bool TopSites::GetPageThumbnailScore(const GURL& url,
ThumbnailScore* score) {
// WARNING: this may be invoked on any thread.
base::AutoLock lock(lock_);
+
+ // The thumbnail score may be found in the temporary images.
+ for (TempImages::iterator i = temp_images_.begin(); i != temp_images_.end();
+ ++i) {
+ if (i->first == url) {
+ *score = i->second.thumbnail_score;
+ return true;
+ }
+ }
return thread_safe_cache_->GetPageThumbnailScore(url, score);
}
« no previous file with comments | « no previous file | chrome/browser/history/top_sites_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698