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

Unified Diff: src/core/SkResourceCache.h

Issue 825263005: notify resource caches when pixelref genID goes stale (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 883ed189de2ede2094eb51ab8884fe2ea60fed5a..d2df35e7d511da17c1ba440c22b487d6617afabc 100644
--- a/src/core/SkResourceCache.h
+++ b/src/core/SkResourceCache.h
@@ -35,6 +35,8 @@ public:
// length must be a multiple of 4
void init(void* nameSpace, size_t length);
+ void* getNamespace() const { return fNamespace; }
+
// This is only valid after having called init().
uint32_t hash() const { return fHash; }
@@ -124,6 +126,13 @@ public:
static size_t SetSingleAllocationByteLimit(size_t);
static size_t GetSingleAllocationByteLimit();
+ /**
+ * Visit all Rec that match the specified namespace:
+ * true : Rec is valid
mtklein 2015/01/07 21:52:43 I think everything might read more clearly if we h
reed1 2015/01/07 22:20:41 I agree 0.499999, but Find uses the same VisitorPr
mtklein 2015/01/08 14:11:12 Do you think we'll ever want to pass the same func
reed1 2015/02/18 17:30:32 Changed to new signature.
+ * false : Rec is "stale" -- the cache will purge it.
+ */
+ static void PurgeVisitor(const void* nameSpace, VisitorProc, void* context);
+
static void PurgeAll();
/**
@@ -193,6 +202,8 @@ public:
*/
size_t setTotalByteLimit(size_t newLimit);
+ void purgeVisitor(const void* nameSpace, VisitorProc, void* context);
+
void purgeAll() {
this->purgeAsNeeded(true);
}

Powered by Google App Engine
This is Rietveld 408576698