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

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

Issue 2376033005: Move GIF decoder's aggressive purge into ImageDecoder (Closed)
Patch Set: Checking more overflow. 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
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 51c81a37251705429adeecc8aa2a694606ffd686..70fba8b3d6a92be752566883c17bb34568ddfde6 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -277,7 +277,8 @@ protected:
ImageDecoder(AlphaOption alphaOption, GammaAndColorProfileOption colorOptions, size_t maxDecodedBytes)
: m_premultiplyAlpha(alphaOption == AlphaPremultiplied)
, m_ignoreGammaAndColorProfile(colorOptions == GammaAndColorProfileIgnored)
- , m_maxDecodedBytes(maxDecodedBytes) { }
+ , m_maxDecodedBytes(maxDecodedBytes)
+ , m_purgeAggressively(false) { }
// Calculates the most recent frame whose image data may be needed in
// order to decode frame |frameIndex|, based on frame disposal methods
@@ -330,6 +331,13 @@ protected:
// memory devices.
const size_t m_maxDecodedBytes;
+ // While decoding, we may learn that there are so many animation frames that
+ // we would go beyond our cache budget.
+ // If that happens, m_purgeAggressively is set to true. This signals
+ // future decodes to purge old frames as it goes.
+ void updateAggressivePurging(size_t index);
+ bool m_purgeAggressively;
+
private:
enum class SniffResult {
JPEG,

Powered by Google App Engine
This is Rietveld 408576698