Track the number of resources that would become purgeable after flush
in GrResourceCache.
Bug: skia:8927
Change-Id: Ia00ba0ea541a22e29e9a8208044e1fabd5296782
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/205484
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrGpuResource.cpp b/src/gpu/GrGpuResource.cpp
index 6dc0dfa..3d2c197 100644
--- a/src/gpu/GrGpuResource.cpp
+++ b/src/gpu/GrGpuResource.cpp
@@ -104,6 +104,8 @@
return this->internalHasRef() || this->internalHasPendingIO();
}
+bool GrGpuResource::hasRef() const { return this->internalHasRef(); }
+
SkString GrGpuResource::getResourceName() const {
// Dump resource as "skia/gpu_resources/resource_#".
SkString resourceName("skia/gpu_resources/resource_");
@@ -229,3 +231,10 @@
} while (id == SK_InvalidUniqueID);
return id;
}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void GrGpuResource::ProxyAccess::ref(GrResourceCache* cache) {
+ SkASSERT(cache == fResource->getContext()->priv().getResourceCache());
+ cache->resourceAccess().refResource(fResource);
+}