Make GrResourceCache2 responsible for calling release, abandon, and ~.
BUG=skia:2889
TBR=robertphillips@google.com
NOTRY=true
Review URL: https://codereview.chromium.org/729683002
diff --git a/src/gpu/GrGpuResourceCacheAccess.h b/src/gpu/GrGpuResourceCacheAccess.h
index 7417a55..3c3786d0 100644
--- a/src/gpu/GrGpuResourceCacheAccess.h
+++ b/src/gpu/GrGpuResourceCacheAccess.h
@@ -54,6 +54,26 @@
return NULL;
}
+ /**
+ * Called by the cache to delete the resource under normal circumstances.
+ */
+ void release() {
+ fResource->release();
+ if (fResource->isPurgable()) {
+ SkDELETE(fResource);
+ }
+ }
+
+ /**
+ * Called by the cache to delete the resource when the backend 3D context is no longer valid.
+ */
+ void abandon() {
+ fResource->abandon();
+ if (fResource->isPurgable()) {
+ SkDELETE(fResource);
+ }
+ }
+
private:
CacheAccess(GrGpuResource* resource) : fResource(resource) { }
CacheAccess(const CacheAccess& that) : fResource(that.fResource) { }