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

Unified Diff: third_party/WebKit/Source/platform/graphics/Image.h

Issue 2054643003: Remove duplication of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring Created 4 years, 6 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: third_party/WebKit/Source/platform/graphics/Image.h
diff --git a/third_party/WebKit/Source/platform/graphics/Image.h b/third_party/WebKit/Source/platform/graphics/Image.h
index 841a2ea4ea92d73524c02e32082db48001097da1..0129c5aecdb447421483200774a52fe3255928ab 100644
--- a/third_party/WebKit/Source/platform/graphics/Image.h
+++ b/third_party/WebKit/Source/platform/graphics/Image.h
@@ -28,6 +28,7 @@
#define Image_h
#include "platform/PlatformExport.h"
+#include "platform/SharedBuffer.h"
#include "platform/geometry/IntRect.h"
#include "platform/graphics/Color.h"
#include "platform/graphics/GraphicsTypes.h"
@@ -54,7 +55,6 @@ class FloatRect;
class FloatSize;
class GraphicsContext;
class Length;
-class SharedBuffer;
class Image;
class PLATFORM_EXPORT Image : public RefCounted<Image> {
@@ -108,7 +108,7 @@ public:
virtual void destroyDecodedData() = 0;
- SharedBuffer* data() { return m_encodedImageData.get(); }
+ virtual PassRefPtr<SharedBuffer> data() { return m_encodedImageData; }
// Animation begins whenever someone draws the image, so startAnimation() is not normally called.
// It will automatically pause once all observers no longer want to render the image anywhere.
@@ -131,7 +131,6 @@ public:
// Typically the ImageResource that owns us.
ImageObserver* getImageObserver() const { return m_imageObserverDisabled ? nullptr : m_imageObserver; }
- void clearImageObserver() { m_imageObserver = nullptr; }
// Do not call setImageObserverDisabled() other than from ImageObserverDisabler to avoid interleaved accesses to |m_imageObserverDisabled|.
void setImageObserverDisabled(bool disabled) { m_imageObserverDisabled = disabled; }
@@ -171,6 +170,10 @@ protected:
SkXfermode::Mode, const FloatSize& repeatSpacing);
void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfermode::Mode);
+ // Releases m_encodedImageData when the subclass can have encoded image data
+ // in another way.
+ void resetCachedData() { m_encodedImageData.release(); }
scroggo_chromium 2016/06/28 15:33:44 This method has an awkward name. It's a method on
hajimehoshi 2016/07/04 10:46:25 Agreed. Removed this and overrided setData instead
+
private:
RefPtr<SharedBuffer> m_encodedImageData;
// TODO(Oilpan): consider having Image on the Oilpan heap and

Powered by Google App Engine
This is Rietveld 408576698