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); |