Adds a mechanism for GrCacheable objects to notify the resource cache
when their size has changed. GrResourceCacheEntry now holds a
reference to the cache, and a cached value of the resource's most
recent size.
Also utilizes this new functionality for mipmaps, and adds a test for
changing resource sizes.
R=bsalomon@google.com, robertphillips@google.com
Author: cdalton@nvidia.com
Review URL: https://codereview.chromium.org/257093002
git-svn-id: http://skia.googlecode.com/svn/trunk@14576 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrCacheable.h b/include/gpu/GrCacheable.h
index 75dec16..39c62b1 100644
--- a/include/gpu/GrCacheable.h
+++ b/include/gpu/GrCacheable.h
@@ -46,6 +46,14 @@
bool isInCache() const { return NULL != fCacheEntry; }
+ /**
+ * This entry point should be called whenever gpuMemorySize() begins
+ * reporting a different size. If the object is in the cache, it will call
+ * gpuMemorySize() immediately and pass the new size on to the resource
+ * cache.
+ */
+ void didChangeGpuMemorySize() const;
+
private:
GrResourceCacheEntry* fCacheEntry; // NULL if not in cache