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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h

Issue 1812273003: Eliminate copies of encoded image data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to (most of) pkasting's comments in patch set 12 Created 4 years, 9 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/image-decoders/ImageDecoder.h
diff --git a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
index 21cc9616ae5159c5e1f62bbe3c868348cf5a06d0..2b876f49e77075bcc7565d1f3c350505b1ea19d4 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -33,6 +33,7 @@
#include "platform/graphics/ImageOrientation.h"
#include "platform/image-decoders/ImageAnimation.h"
#include "platform/image-decoders/ImageFrame.h"
+#include "platform/image-decoders/SegmentReader.h"
#include "public/platform/Platform.h"
#include "wtf/Assertions.h"
#include "wtf/PassOwnPtr.h"
@@ -122,22 +123,29 @@ public:
// we can't sniff a supported type from the provided data (possibly
// because there isn't enough data yet).
// Sets m_maxDecodedBytes to Platform::maxImageDecodedBytes().
- static PassOwnPtr<ImageDecoder> create(const SharedBuffer& data, AlphaOption, GammaAndColorProfileOption);
+ static PassOwnPtr<ImageDecoder> create(const char* data, size_t length, AlphaOption, GammaAndColorProfileOption);
+ static PassOwnPtr<ImageDecoder> create(const SharedBuffer&, AlphaOption, GammaAndColorProfileOption);
+ static PassOwnPtr<ImageDecoder> create(const SegmentReader&, AlphaOption, GammaAndColorProfileOption);
virtual String filenameExtension() const = 0;
bool isAllDataReceived() const { return m_isAllDataReceived; }
- void setData(SharedBuffer* data, bool allDataReceived)
+ void setData(PassRefPtr<SegmentReader> data, bool allDataReceived)
{
if (m_failed)
return;
m_data = data;
m_isAllDataReceived = allDataReceived;
- onSetData(data);
+ onSetData(m_data.get());
}
- virtual void onSetData(SharedBuffer* data) { }
+ void setData(PassRefPtr<SharedBuffer> data, bool allDataReceived)
+ {
+ setData(SegmentReader::createFromSharedBuffer(data), allDataReceived);
+ }
+
+ virtual void onSetData(SegmentReader* data) { }
bool isSizeAvailable()
{
@@ -310,7 +318,7 @@ protected:
// Decodes the requested frame.
virtual void decode(size_t) = 0;
- RefPtr<SharedBuffer> m_data; // The encoded data.
+ RefPtr<SegmentReader> m_data; // The encoded data.
Vector<ImageFrame, 1> m_frameBufferCache;
bool m_premultiplyAlpha;
bool m_ignoreGammaAndColorProfile;

Powered by Google App Engine
This is Rietveld 408576698