summaryrefslogtreecommitdiffstats
path: root/components/enhanced_bookmarks/image_store.h
diff options
context:
space:
mode:
authorkkimlabs <kkimlabs@chromium.org>2015-04-03 03:08:09 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-03 10:08:37 +0000
commit16a0d2a22d17e3932432dab4559e63c5134aaccc (patch)
treecb3602e115c8dc531195283d2c417825005f00ad /components/enhanced_bookmarks/image_store.h
parenta4c00a7ec01b3308c98cfad88b4bf3af1b4fde2b (diff)
downloadchromium_src-16a0d2a22d17e3932432dab4559e63c5134aaccc.zip
chromium_src-16a0d2a22d17e3932432dab4559e63c5134aaccc.tar.gz
chromium_src-16a0d2a22d17e3932432dab4559e63c5134aaccc.tar.bz2
Fix crashes due to gfx::Image unsafe thread passing
gfx::Image has |storage_| member which is base::RefCounted, not thread safe. Thus passing around gfx::Image to other threads by copying is incorrect. Workaround by using scoped_ptr and making ImageRecord class RefCountedThreadSafe. Related discussion: https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/8LqVoXQ_2bo BUG=471800 Review URL: https://codereview.chromium.org/1031293002 Cr-Commit-Position: refs/heads/master@{#323720}
Diffstat (limited to 'components/enhanced_bookmarks/image_store.h')
-rw-r--r--components/enhanced_bookmarks/image_store.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/components/enhanced_bookmarks/image_store.h b/components/enhanced_bookmarks/image_store.h
index f4c63fa..e92ba5a 100644
--- a/components/enhanced_bookmarks/image_store.h
+++ b/components/enhanced_bookmarks/image_store.h
@@ -27,8 +27,9 @@ class ImageStore {
// be null indicating that the download of the image at this URL or
// encoding for insertion failed previously. On non-iOS platforms, |image|
// must have exactly one representation with a scale factor of 1.
- virtual void Insert(const GURL& page_url,
- const enhanced_bookmarks::ImageRecord& image_record) = 0;
+ virtual void Insert(
+ const GURL& page_url,
+ scoped_refptr<enhanced_bookmarks::ImageRecord> image_record) = 0;
// Removes an image from the store.
virtual void Erase(const GURL& page_url) = 0;
@@ -38,7 +39,8 @@ class ImageStore {
// image_url where the image was downloaded from or failed to be downloaded
// from. When the image is not empty, the dominant color of the image is also
// filled.
- virtual enhanced_bookmarks::ImageRecord Get(const GURL& page_url) = 0;
+ virtual scoped_refptr<enhanced_bookmarks::ImageRecord> Get(
+ const GURL& page_url) = 0;
// Returns the size of the image stored for this URL or empty size if no
// images are present.