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 |