Index: src/gpu/GrResourceCache.h |
diff --git a/src/gpu/GrResourceCache.h b/src/gpu/GrResourceCache.h |
index b2f91cdbdb8c81d75875eed43464604c0255545c..1a81fe61d125e55d76fd1f560b8fdc1e72986a2a 100644 |
--- a/src/gpu/GrResourceCache.h |
+++ b/src/gpu/GrResourceCache.h |
@@ -19,6 +19,7 @@ |
#include "SkTInternalLList.h" |
class GrCacheable; |
+class GrResourceCache; |
class GrResourceCacheEntry; |
class GrResourceKey { |
@@ -128,12 +129,24 @@ public: |
void validate() const {} |
#endif |
+ /** |
+ * Update the cached size for this entry and inform the resource cache that |
+ * it has changed. Usually invoked from GrCacheable::didChangeGpuMemorySize, |
+ * not directly from here. |
+ */ |
+ void didChangeResourceSize(); |
+ |
private: |
- GrResourceCacheEntry(const GrResourceKey& key, GrCacheable* resource); |
+ GrResourceCacheEntry(GrResourceCache* resourceCache, |
+ const GrResourceKey& key, |
+ GrCacheable* resource); |
~GrResourceCacheEntry(); |
+ GrResourceCache* fResourceCache; |
GrResourceKey fKey; |
GrCacheable* fResource; |
+ size_t fCachedSize; |
+ bool fIsExclusive; |
// Linked list for the LRU ordering. |
SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrResourceCacheEntry); |
@@ -272,6 +285,12 @@ public: |
void makeNonExclusive(GrResourceCacheEntry* entry); |
/** |
+ * Notify the cache that the size of a resource has changed. |
+ */ |
+ void didIncreaseResourceSize(const GrResourceCacheEntry*, size_t amountInc); |
+ void didDecreaseResourceSize(const GrResourceCacheEntry*, size_t amountDec); |
+ |
+ /** |
* Remove a resource from the cache and delete it! |
*/ |
void deleteResource(GrResourceCacheEntry* entry); |