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

Unified Diff: src/gpu/GrResourceCache.h

Issue 26734003: Proactive SkPixelRef invalidation (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: tweaks Created 7 years, 2 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/gpu/GrResourceCache.h
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h
index a9adf91b6f7216124c7b2e7f408def9b3b690200..38378ac77130ffdf45c522ef24ee9474d2aa0bb3 100644
--- a/src/gpu/GrResourceCache.h
+++ b/src/gpu/GrResourceCache.h
@@ -15,6 +15,7 @@
#include "GrTypes.h"
#include "GrTHashTable.h"
#include "GrBinHashKey.h"
+#include "SkMessageBus.h"
#include "SkTInternalLList.h"
class GrResource;
@@ -141,6 +142,11 @@ private:
Key fKey;
};
+// The cache listens for these messages to purge junk resources proactively.
+struct GrResourceInvalidatedMessage {
+ GrResourceKey key;
+};
+
///////////////////////////////////////////////////////////////////////////////
class GrResourceEntry {
@@ -395,6 +401,10 @@ private:
void internalPurge(int extraCount, size_t extraBytes);
+ // Listen for messages that a resource has been invalidated and purge cached junk proactively.
+ SkMessageBus<GrResourceInvalidatedMessage>::Inbox fInvalidationInbox;
+ void purgeInvalidated();
+
#ifdef SK_DEBUG
static size_t countBytes(const SkTInternalLList<GrResourceEntry>& list);
#endif

Powered by Google App Engine
This is Rietveld 408576698