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

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: 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..c5b8bb22841e2c7e7bf9e6f7d5bc8255d9a806f4 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -245,6 +245,15 @@ void TopSites::GetMostVisitedURLs(CancelableRequestConsumer* consumer,
bool TopSites::GetPageThumbnail(const GURL& url,
scoped_refptr<RefCountedBytes>* bytes) {
+ // The thumbnail may be found in the temporary images.
sky 2011/04/08 15:59:07 This breaks the thread safety of this class.
satorux1 2011/04/09 02:36:51 My bad. I missed WARNING. Moved the lock to the b
+ for (TempImages::iterator i = temp_images_.begin(); i != temp_images_.end();
+ ++i) {
+ if (i->first == url) {
+ *bytes = i->second.thumbnail;
+ return true;
+ }
+ }
+
// WARNING: this may be invoked on any thread.
base::AutoLock lock(lock_);
return thread_safe_cache_->GetPageThumbnail(url, bytes);
@@ -252,6 +261,15 @@ bool TopSites::GetPageThumbnail(const GURL& url,
bool TopSites::GetPageThumbnailScore(const GURL& url,
ThumbnailScore* score) {
+ // 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;
+ }
+ }
+
// WARNING: this may be invoked on any thread.
base::AutoLock lock(lock_);
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