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

Unified Diff: components/enhanced_bookmarks/test_image_store.cc

Issue 1031293002: Fix crashes due to gfx::Image unsafe thread passing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary Pass() Created 5 years, 9 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 | « components/enhanced_bookmarks/test_image_store.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/enhanced_bookmarks/test_image_store.cc
diff --git a/components/enhanced_bookmarks/test_image_store.cc b/components/enhanced_bookmarks/test_image_store.cc
index 9b11cdfdb36fb9f6435c2b9aa730a94b9a91bd3b..28c8de086240fc0e72810bd027f2296e2a2435a9 100644
--- a/components/enhanced_bookmarks/test_image_store.cc
+++ b/components/enhanced_bookmarks/test_image_store.cc
@@ -17,12 +17,13 @@ bool TestImageStore::HasKey(const GURL& page_url) {
return store_.find(page_url) != store_.end();
}
-void TestImageStore::Insert(const GURL& page_url,
- const enhanced_bookmarks::ImageRecord& image) {
+void TestImageStore::Insert(
+ const GURL& page_url,
+ scoped_refptr<enhanced_bookmarks::ImageRecord> image_record) {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
Erase(page_url);
- store_.insert(std::make_pair(page_url, image));
+ store_.insert(std::make_pair(page_url, image_record));
}
void TestImageStore::Erase(const GURL& page_url) {
@@ -31,11 +32,14 @@ void TestImageStore::Erase(const GURL& page_url) {
store_.erase(page_url);
}
-enhanced_bookmarks::ImageRecord TestImageStore::Get(const GURL& page_url) {
+scoped_refptr<enhanced_bookmarks::ImageRecord> TestImageStore::Get(
+ const GURL& page_url) {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
- if (store_.find(page_url) == store_.end())
- return enhanced_bookmarks::ImageRecord();
+ if (store_.find(page_url) == store_.end()) {
+ return scoped_refptr<enhanced_bookmarks::ImageRecord>(
+ new enhanced_bookmarks::ImageRecord());
+ }
return store_[page_url];
}
@@ -47,7 +51,7 @@ gfx::Size TestImageStore::GetSize(const GURL& page_url) {
if (pair_enumerator == store_.end())
return gfx::Size();
- return store_[page_url].image.Size();
+ return store_[page_url]->image->Size();
}
void TestImageStore::GetAllPageUrls(std::set<GURL>* urls) {
@@ -72,10 +76,10 @@ int64 TestImageStore::GetStoreSizeInBytes() {
size += sizeof(it->first);
size += it->first.spec().length();
size += sizeof(it->second);
- SkBitmap bitmap = it->second.image.AsBitmap();
+ SkBitmap bitmap = it->second->image->AsBitmap();
size += bitmap.getSize();
- size += it->second.url.spec().length();
- size += sizeof(it->second.dominant_color);
+ size += it->second->url.spec().length();
+ size += sizeof(it->second->dominant_color);
}
return size;
}
« no previous file with comments | « components/enhanced_bookmarks/test_image_store.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698