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

Unified Diff: components/enhanced_bookmarks/image_record.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
Index: components/enhanced_bookmarks/image_record.h
diff --git a/components/enhanced_bookmarks/image_record.h b/components/enhanced_bookmarks/image_record.h
index dde32513ce7942f6b3e9b6285f4bc47371487903..e93f3b83ff422f7ff2ee3091c686f0cd912fef82 100644
--- a/components/enhanced_bookmarks/image_record.h
+++ b/components/enhanced_bookmarks/image_record.h
@@ -5,6 +5,7 @@
#ifndef COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_
#define COMPONENTS_ENHANCED_BOOKMARKS_IMAGE_RECORD_H_
+#include "base/memory/ref_counted.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/image/image.h"
#include "url/gurl.h"
@@ -12,17 +13,25 @@
namespace enhanced_bookmarks {
// Defines a record of a bookmark image in the ImageStore.
-struct ImageRecord {
- ImageRecord() : image(), url(), dominant_color(SK_ColorBLACK) {}
- ImageRecord(const gfx::Image& image, const GURL& url, SkColor dominant_color)
- : image(image), url(url), dominant_color(dominant_color) {}
+class ImageRecord : public base::RefCountedThreadSafe<ImageRecord> {
+ public:
+ ImageRecord(scoped_ptr<gfx::Image> image,
+ const GURL& url,
+ SkColor dominant_color);
+ ImageRecord(scoped_ptr<gfx::Image> image, const GURL& url);
+ ImageRecord();
// The image data.
- gfx::Image image;
+ scoped_ptr<gfx::Image> image;
// The URL that hosts the image.
GURL url;
// The dominant color of the image.
SkColor dominant_color;
+
+ private:
+ friend class base::RefCountedThreadSafe<ImageRecord>;
+
+ ~ImageRecord();
};
} // namespace enhanced_bookmarks
« no previous file with comments | « components/enhanced_bookmarks/bookmark_image_service.cc ('k') | components/enhanced_bookmarks/image_record.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698