aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkResourceCache.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-08-19 12:25:40 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-19 12:25:41 -0700
commit216b643fc77e754a3fabbb0ed397e7cf55d1954d (patch)
tree32e75226963e5cbeab12a9e4acfd380a7ff7096d /src/core/SkResourceCache.h
parentfea7763140ba74b78f2c30028452e250140b6f21 (diff)
private iterator to visit all resource cache entries
BUG=skia: TBR= Review URL: https://codereview.chromium.org/1271033002
Diffstat (limited to 'src/core/SkResourceCache.h')
-rw-r--r--src/core/SkResourceCache.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h
index b43572f4be..7267c6739b 100644
--- a/src/core/SkResourceCache.h
+++ b/src/core/SkResourceCache.h
@@ -14,7 +14,6 @@
class SkCachedData;
class SkDiscardableMemory;
-class SkMipMap;
/**
* Cache object for bitmaps (with possible scale in X Y as part of the key).
@@ -78,6 +77,10 @@ public:
virtual const Key& getKey() const = 0;
virtual size_t bytesUsed() const = 0;
+ // for memory usage diagnostics
+ virtual const char* getCategory() const = 0;
+ virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return NULL; }
+
// for SkTDynamicHash::Traits
static uint32_t Hash(const Key& key) { return key.hash(); }
static const Key& GetKey(const Rec& rec) { return rec.getKey(); }
@@ -133,6 +136,10 @@ public:
static bool Find(const Key& key, FindVisitor, void* context);
static void Add(Rec*);
+ typedef void (*Visitor)(const Rec&, void* context);
+ // Call the visitor for every Rec in the cache.
+ static void VisitAll(Visitor, void* context);
+
static size_t GetTotalBytesUsed();
static size_t GetTotalByteLimit();
static size_t SetTotalByteLimit(size_t newLimit);
@@ -143,6 +150,8 @@ public:
static void PurgeAll();
+ static void TestDumpMemoryStatistics();
+
/**
* Returns the DiscardableFactory used by the global cache, or NULL.
*/
@@ -194,6 +203,7 @@ public:
*/
bool find(const Key&, FindVisitor, void* context);
void add(Rec*);
+ void visitAll(Visitor, void* context);
size_t getTotalBytesUsed() const { return fTotalBytesUsed; }
size_t getTotalByteLimit() const { return fTotalByteLimit; }