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

Unified Diff: Source/platform/graphics/ImageDecodingStore.h

Issue 110273002: Refine memory accounting in ImageDecodingStore for discardable entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Store accounting information in CacheEntry Created 7 years 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 | Source/platform/graphics/ImageDecodingStore.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/ImageDecodingStore.h
diff --git a/Source/platform/graphics/ImageDecodingStore.h b/Source/platform/graphics/ImageDecodingStore.h
index afc4c3312cb13da0e6aff7cea6afca79e34c96d1..07b16728ad1f4acc7e8597d0379f0a40ecbfc80f 100644
--- a/Source/platform/graphics/ImageDecodingStore.h
+++ b/Source/platform/graphics/ImageDecodingStore.h
@@ -161,6 +161,7 @@ private:
: m_generator(generator)
, m_useCount(useCount)
, m_isDiscardable(isDiscardable)
+ , m_isAccountingEnabled(true)
, m_prev(0)
, m_next(0)
{
@@ -177,6 +178,9 @@ private:
void decrementUseCount() { --m_useCount; ASSERT(m_useCount >= 0); }
bool isDiscardable() const { return m_isDiscardable; }
+ void disableAccounting() { m_isAccountingEnabled = false; }
+ bool isAccountingEnabled() const { return m_isAccountingEnabled; }
+
// FIXME: getSafeSize() returns size in bytes truncated to a 32-bits integer.
// Find a way to get the size in 64-bits.
virtual size_t memoryUsageInBytes() const = 0;
@@ -186,6 +190,7 @@ private:
const ImageFrameGenerator* m_generator;
int m_useCount;
bool m_isDiscardable;
+ bool m_isAccountingEnabled;
private:
CacheEntry* m_prev;
@@ -316,6 +321,7 @@ private:
typedef HashMap<const ImageFrameGenerator*, DecoderCacheKeySet> DecoderCacheKeyMap;
DecoderCacheKeyMap m_decoderCacheKeyMap;
+ size_t m_discardableEntriesCount;
size_t m_cacheLimitInBytes;
size_t m_memoryUsageInBytes;
« no previous file with comments | « no previous file | Source/platform/graphics/ImageDecodingStore.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698