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

Unified Diff: src/core/SkResourceCache.h

Issue 1271033002: private iterator to visit all resource cache entries (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add iter for fontcache Created 5 years, 4 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: src/core/SkResourceCache.h
diff --git a/src/core/SkResourceCache.h b/src/core/SkResourceCache.h
index b43572f4bef3d14131c5cb69ee9f3db927652f02..7267c6739b5f7edb65332d7d0e62ab11a4538fed 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; }

Powered by Google App Engine
This is Rietveld 408576698