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

Unified Diff: src/gpu/GrResourceCache.h

Issue 257093002: Add size change notifications to GrResourceCache (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 8 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 b2f91cdbdb8c81d75875eed43464604c0255545c..0489d33b83c47ea8026fc91523e9e0ded4e89952 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,19 @@ public:
void validate() const {}
#endif
robertphillips 2014/04/29 13:46:25 // Inform the resource cache that this entry's siz
+ 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 +280,12 @@ public:
void makeNonExclusive(GrResourceCacheEntry* entry);
/**
+ * Notify the cache that the size of a resource has changed.
+ */
robertphillips 2014/04/29 13:46:25 amountInc?
+ void didIncreaseResourceSize(const GrResourceCacheEntry*, size_t amount);
+ void didDecreaseResourceSize(const GrResourceCacheEntry*, size_t amount);
robertphillips 2014/04/29 13:46:25 amountDec?
+
+ /**
* Remove a resource from the cache and delete it!
*/
void deleteResource(GrResourceCacheEntry* entry);

Powered by Google App Engine
This is Rietveld 408576698