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

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: rebase Created 6 years, 7 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
« no previous file with comments | « include/gpu/GrTexture.h ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « include/gpu/GrTexture.h ('k') | src/gpu/GrResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698