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

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

Issue 2376033005: Move GIF decoder's aggressive purge into ImageDecoder (Closed)
Patch Set: Rebasing. 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 | third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 180ec29bba7c2d0dc0142d04eaaf63ba5e5f78bb..ced7fa20be5d37b52973e14a9092060ed589e8f5 100644
--- a/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
+++ b/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h
@@ -279,7 +279,8 @@ class PLATFORM_EXPORT ImageDecoder {
: 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
@@ -332,6 +333,13 @@ class PLATFORM_EXPORT ImageDecoder {
// 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, PNG, GIF, WEBP, ICO, BMP, Invalid };
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698