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

Unified Diff: third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp

Issue 2202473002: DO NOT COMMIT: Experimental removal of encoded image data Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (rebase) Created 4 years, 3 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/DeferredImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
index 62529643b6be1c9b5f514da7ddc461abe057fa29..9b0738885104e6c9d2dba89877b152eda29d443f 100644
--- a/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DeferredImageDecoder.cpp
@@ -87,6 +87,7 @@ DeferredImageDecoder::DeferredImageDecoder(std::unique_ptr<ImageDecoder> actualD
, m_hasColorProfile(false)
, m_canYUVDecode(false)
, m_hasHotSpot(false)
+ , m_isBufferCleared(false)
{
}
@@ -128,6 +129,15 @@ sk_sp<SkImage> DeferredImageDecoder::createFrameAtIndex(size_t index)
return SkImage::MakeFromBitmap(frame->bitmap());
}
+bool DeferredImageDecoder::clear()
+{
+ if (!m_rwBuffer)
+ return false;
+ m_rwBuffer.reset();
+ m_isBufferCleared = true;
+ return true;
+}
+
PassRefPtr<SharedBuffer> DeferredImageDecoder::data()
{
if (!m_rwBuffer)
@@ -165,6 +175,7 @@ void DeferredImageDecoder::setDataInternal(PassRefPtr<SharedBuffer> passData, bo
length; length = data->getSomeData(segment, m_rwBuffer->size())) {
m_rwBuffer->append(segment, length);
}
+ m_isBufferCleared = false;
}
}
@@ -324,6 +335,7 @@ sk_sp<SkImage> DeferredImageDecoder::createFrameImageAtIndex(size_t index, bool
ASSERT(decodedSize.width() > 0);
ASSERT(decodedSize.height() > 0);
+ DCHECK(!m_isBufferCleared);
sk_sp<SkROBuffer> roBuffer(m_rwBuffer->newRBufferSnapshot());
RefPtr<SegmentReader> segmentReader = SegmentReader::createFromSkROBuffer(std::move(roBuffer));
DecodingImageGenerator* generator = new DecodingImageGenerator(m_frameGenerator, imageInfoFrom(decodedSize, knownToBeOpaque), segmentReader.release(), m_allDataReceived, index, m_frameData[index].m_uniqueID);

Powered by Google App Engine
This is Rietveld 408576698