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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp

Issue 2365943005: Cap memory usage in webp catch up (Closed)
Patch Set: Moving aggressive purge update into demuxer update. Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
index 914def5256a8fb57e0b10d6391df3ad6771b1441..04f77db320d55bf62352fec3ffcc6ac3d5fa99f5 100644
--- a/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/webp/WEBPImageDecoder.cpp
@@ -235,6 +235,9 @@ bool WEBPImageDecoder::updateDemuxer() {
if (!setSize(width, height))
return setFailed();
+ size_t frameCount = WebPDemuxGetI(m_demux, WEBP_FF_FRAME_COUNT);
urvang 2016/10/10 21:30:50 No, this is not the right place. "!isDecodedSizeAv
cblume 2016/10/10 21:36:38 Done.
+ updateAggressivePurging(frameCount);
+
m_formatFlags = WebPDemuxGetI(m_demux, WEBP_FF_FORMAT_FLAGS);
if (!(m_formatFlags & ANIMATION_FLAG)) {
m_repetitionCount = cAnimationNone;
@@ -486,6 +489,9 @@ void WEBPImageDecoder::decode(size_t index) {
// We need more data to continue decoding.
if (m_frameBufferCache[*i].getStatus() != ImageFrame::FrameComplete)
break;
+
+ if (m_purgeAggressively)
+ clearCacheExceptFrame(*i);
}
// It is also a fatal error if all data is received and we have decoded all
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698