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

Unified Diff: components/enhanced_bookmarks/bookmark_image_service.h

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/BUILD.gn ('k') | components/enhanced_bookmarks/bookmark_image_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/enhanced_bookmarks/bookmark_image_service.h
diff --git a/components/enhanced_bookmarks/bookmark_image_service.h b/components/enhanced_bookmarks/bookmark_image_service.h
index 87b14e49e8550777e66d0d8af37357a1da516320..9cc0b73a9fc32d9fa3bd3805ffee951ff153f318 100644
--- a/components/enhanced_bookmarks/bookmark_image_service.h
+++ b/components/enhanced_bookmarks/bookmark_image_service.h
@@ -40,7 +40,7 @@ class BookmarkImageService : public KeyedService,
~BookmarkImageService() override;
- typedef base::Callback<void(const ImageRecord&)> ImageCallback;
+ typedef base::Callback<void(scoped_refptr<ImageRecord>)> ImageCallback;
// KeyedService:
void Shutdown() override;
@@ -89,11 +89,11 @@ class BookmarkImageService : public KeyedService,
void ProcessNewImage(const GURL& page_url,
bool update_bookmarks,
const GURL& image_url,
- const gfx::Image& image);
+ scoped_ptr<gfx::Image> image);
// Resizes large images to proper size that fits device display. This method
// should _not_ run on the UI thread.
- virtual gfx::Image ResizeImage(gfx::Image image) = 0;
+ virtual scoped_ptr<gfx::Image> ResizeImage(const gfx::Image& image) = 0;
// Sets a new image for a bookmark. If the given page_url is bookmarked and
// the image is retrieved from the image_url, then the image is locally
@@ -123,31 +123,32 @@ class BookmarkImageService : public KeyedService,
ImageCallback stack_callback);
// Processes the requests that have been waiting on an image.
- void ProcessRequests(const GURL& page_url, const ImageRecord& image);
+ void ProcessRequests(const GURL& page_url, scoped_refptr<ImageRecord> image);
// Once an image is retrieved this method calls ResizeImage() and updates the
// store with the smaller image, then returns the newly formed ImageRecord.
// This is typically called on |pool_|, the background sequenced worker pool
// for this object.
- ImageRecord ResizeAndStoreImage(const gfx::Image& image,
- const GURL& image_url,
- const GURL& page_url);
+ scoped_refptr<ImageRecord> ResizeAndStoreImage(
+ scoped_refptr<ImageRecord> image_info,
+ const GURL& page_url);
// Calls |StoreImage| in the background. This should only be called from the
// main thread.
- void PostTaskToStoreImage(const gfx::Image& image,
+ void PostTaskToStoreImage(scoped_ptr<gfx::Image> image,
const GURL& image_url,
const GURL& page_url);
// Called when |StoreImage| as been posted. This should only be called from
// the main thread.
- void OnStoreImagePosted(const GURL& page_url, const ImageRecord& image);
+ void OnStoreImagePosted(const GURL& page_url,
+ scoped_refptr<ImageRecord> image);
// Called when retrieving an image from the image store fails, to trigger
// retrieving the image from the url stored in the bookmark (if any).
void FetchCallback(const GURL& page_url,
ImageCallback original_callback,
- const ImageRecord& record);
+ scoped_refptr<ImageRecord> record);
// Remove the image stored for this bookmark (if it exists). Called when a
// bookmark is deleted.
« no previous file with comments | « components/enhanced_bookmarks/BUILD.gn ('k') | components/enhanced_bookmarks/bookmark_image_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698