| Index: ui/gfx/image/image.h
|
| diff --git a/ui/gfx/image/image.h b/ui/gfx/image/image.h
|
| index 01344242d939a20cb9c6f7ca682104bee1d90d69..f5feeb22c6e8e824a096c3e9fcdb46849dafcf18 100644
|
| --- a/ui/gfx/image/image.h
|
| +++ b/ui/gfx/image/image.h
|
| @@ -15,6 +15,18 @@
|
| //
|
| // Images can be empty, in which case they have no backing representation.
|
| // Attempting to use an empty Image will result in a crash.
|
| +//
|
| +// Image is *not thread-safe* for reads or writes. In Debug builds, a thread
|
| +// checker will check that Images are not being used across multiple threads. If
|
| +// you need to pass an image from one thread to another, you have two options:
|
| +// 1. Ensure that you are the sole reference holder of the Image (keeping in
|
| +// mind that if the Image has been copied that the place you copied it from
|
| +// will hold a reference to it), and call DetachFromThread() just before
|
| +// passing the Image to another thread.
|
| +// 2. Get the underlying image representation (e.g., ImageSkia) out of the
|
| +// image, ensure that it is thread-safe (ImageSkia requires special attention
|
| +// to make it thread-safe), pass that to another thread, then create a new
|
| +// Image object on the other side.
|
|
|
| #ifndef UI_GFX_IMAGE_IMAGE_H_
|
| #define UI_GFX_IMAGE_IMAGE_H_
|
| @@ -179,6 +191,18 @@ class GFX_EXPORT Image {
|
| void SetSourceColorSpace(CGColorSpaceRef color_space);
|
| #endif // defined(OS_MACOSX) && !defined(OS_IOS)
|
|
|
| + // Turns off thread checking on this Image (and all Images sharing its backing
|
| + // store). This should be used to mark code that is not currently thread-safe
|
| + // and any usage of this method should be considered a bug and accompanied by
|
| + // a TODO.
|
| + // TODO(mgiuca): Remove this method after all uses of Image are thread-safe.
|
| + void DisableThreadChecking();
|
| +
|
| + // Informs the thread checker that this Image is about to be moved to another
|
| + // thread. Should only be used when this Image is the sole reference holder of
|
| + // its backing store.
|
| + void DetachFromThread();
|
| +
|
| private:
|
| // Returns the type of the default representation.
|
| RepresentationType DefaultRepresentationType() const;
|
|
|