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

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: Address on hiroshige's review 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..248f7e74d5709460434dd0e5366764d7947f4938 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.
@@ -171,6 +171,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 resetEncodedImageData() { m_encodedImageData.release(); }
+
private:
RefPtr<SharedBuffer> m_encodedImageData;
// TODO(Oilpan): consider having Image on the Oilpan heap and

Powered by Google App Engine
This is Rietveld 408576698