Index: ui/gfx/image/image_skia.h |
diff --git a/ui/gfx/image/image_skia.h b/ui/gfx/image/image_skia.h |
index 24422d2f09a5559c1f28a53532925a83daa35130..f7d8c6e7e697ae4d452a97c1650fa55fe4550068 100644 |
--- a/ui/gfx/image/image_skia.h |
+++ b/ui/gfx/image/image_skia.h |
@@ -37,6 +37,7 @@ class UI_EXPORT ImageSkia { |
// Creates an instance that will use the |source| to get the image |
// for scale factors. |size| specifes the size of the image in DIP. |
+ // ImageSkia owns |source|. |
ImageSkia(ImageSkiaSource* source, const gfx::Size& size); |
// Adds ref to passed in bitmap. |
@@ -69,6 +70,11 @@ class UI_EXPORT ImageSkia { |
~ImageSkia(); |
+ // Returns a deep copy of this ImageSkia which has its own storage with |
+ // the same ImageSkiaRep instances. This can be safely passed to and |
+ // manipulated by another thread. |
+ ImageSkia DeepCopy() const; |
+ |
// Returns true if this object is backed by the same ImageSkiaStorage as |
// |other|. Will also return true if both images are isNull(). |
bool BackedBySameObjectAs(const gfx::ImageSkia& other) const; |
@@ -97,6 +103,11 @@ class UI_EXPORT ImageSkia { |
std::vector<ImageSkiaRep> GetRepresentations() const; |
#endif // OS_MACOSX |
+ // Make the image skia read only. Once it becomes read only, |
+ // it can be safely accessed by any threads. |
+ void SetReadOnly(); |
+ bool IsReadOnly() const; |
+ |
// Returns true if this is a null object. |
// TODO(pkotwicz): Merge this function into empty(). |
bool isNull() const { return storage_ == NULL; } |
@@ -120,6 +131,15 @@ class UI_EXPORT ImageSkia { |
// when source is used. |
std::vector<gfx::ImageSkiaRep> image_reps() const; |
+ // Delete the ImageSkiaSource if any. It will make GetRepresentation |
+ // thread safe because it will no longer update the storage. |
+ void DeleteSource(); |
+ |
+ // When the source is available, generates all ImageReps for |
+ // supported scale factors. This method is defined as const as |
+ // the state change in the storage is agnostic to the caller. |
+ void EnsureRepsForSupportedScaleFactors() const; |
+ |
private: |
// Initialize ImageSkiaStorage with passed in parameters. |
// If the image rep's bitmap is empty, ImageStorage is set to NULL. |