Index: src/core/SkResourceCache.h |
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h |
index b43572f4bef3d14131c5cb69ee9f3db927652f02..72c574108389af9cdf13ae275d604d16a210a866 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(); } |
@@ -116,6 +119,11 @@ public: |
*/ |
typedef SkDiscardableMemory* (*DiscardableFactory)(size_t bytes); |
+ /** |
+ * Will be called for each rec in the cache. |
+ */ |
+ typedef void (*Visitor)(const Rec&, void* context); |
mtklein_C
2015/08/04 20:27:37
It'd be nice to have Visitor and VisitAll right ne
reed1
2015/08/07 16:19:59
Done.
|
+ |
/* |
* The following static methods are thread-safe wrappers around a global |
* instance of this cache. |
@@ -132,6 +140,7 @@ public: |
*/ |
static bool Find(const Key& key, FindVisitor, void* context); |
static void Add(Rec*); |
+ static void VisitAll(Visitor, void* context); |
static size_t GetTotalBytesUsed(); |
static size_t GetTotalByteLimit(); |
@@ -143,6 +152,8 @@ public: |
static void PurgeAll(); |
+ static void TestDumpMemoryStatistics(); |
+ |
/** |
* Returns the DiscardableFactory used by the global cache, or NULL. |
*/ |
@@ -194,6 +205,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; } |