| Index: third_party/WebKit/Source/platform/graphics/FrameData.h
|
| diff --git a/third_party/WebKit/Source/platform/graphics/FrameData.h b/third_party/WebKit/Source/platform/graphics/FrameData.h
|
| index e64c9318bd54efa3417f2bfbbe91dfd52d9bc8f2..04324fe8845328051bb044f8f13f8cde5ae77aab 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/FrameData.h
|
| +++ b/third_party/WebKit/Source/platform/graphics/FrameData.h
|
| @@ -28,12 +28,44 @@
|
| #ifndef FrameData_h
|
| #define FrameData_h
|
|
|
| +#include "platform/graphics/ColorSpaceFilter.h"
|
| #include "platform/graphics/ImageOrientation.h"
|
| +#include "third_party/skia/include/core/SkColorFilter.h"
|
| #include "third_party/skia/include/core/SkImage.h"
|
| +#include "third_party/skia/include/core/SkPicture.h"
|
| #include "wtf/Allocator.h"
|
| +#include "wtf/HashMap.h"
|
| +#include "wtf/MainThread.h"
|
| #include "wtf/Noncopyable.h"
|
| #include "wtf/RefPtr.h"
|
| #include "wtf/VectorTraits.h"
|
| +#include "wtf/text/StringHash.h"
|
| +#include "wtf/text/WTFString.h"
|
| +
|
| +class ColorTransformImageCache {
|
| + WTF_MAKE_NONCOPYABLE(ColorTransformImageCache);
|
| +public:
|
| + ColorTransformImageCache() { }
|
| +
|
| + void set(const String& key, SkImage* image)
|
| + {
|
| + m_colorImages.set(key, image);
|
| + }
|
| +
|
| + PassRefPtr<SkImage> find(const String& key) const
|
| + {
|
| + HashMap<String, RefPtr<SkImage>>::const_iterator it = m_colorImages.find(key);
|
| + return it != m_colorImages.end() ? it->value : nullptr;
|
| + }
|
| +
|
| + void clear()
|
| + {
|
| + m_colorImages.clear();
|
| + }
|
| +
|
| +private:
|
| + HashMap<String, RefPtr<SkImage>> m_colorImages;
|
| +};
|
|
|
| namespace blink {
|
|
|
| @@ -44,11 +76,28 @@ public:
|
| FrameData();
|
| ~FrameData();
|
|
|
| + PassRefPtr<SkImage> find(SkColorFilter* transform)
|
| + {
|
| + return cache().find(colorSpaceFilterKey(transform));
|
| + }
|
| +
|
| + void cache(SkColorFilter* transform, SkImage* image)
|
| + {
|
| + cache().set(colorSpaceFilterKey(transform), image);
|
| + }
|
| +
|
| + ColorTransformImageCache& cache()
|
| + {
|
| + RELEASE_ASSERT(isMainThread());
|
| + return m_cache;
|
| + }
|
| +
|
| // Clear the cached image data on the frame, and (optionally) the metadata.
|
| // Returns whether there was cached image data to clear.
|
| bool clear(bool clearMetadata);
|
|
|
| RefPtr<SkImage> m_frame;
|
| + ColorTransformImageCache m_cache;
|
| ImageOrientation m_orientation;
|
| float m_duration;
|
| bool m_haveMetadata : 1;
|
|
|