Migrate resource cache methods to GrDirectContext

Cut and paste job.

Change-Id: If9b7e0f74b16b2559dc4149f81720df96b09761e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/325461
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 4305a31..2788aae 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -122,22 +122,6 @@
     fResourceCache->purgeUnlockedResources(bytesToPurge, preferScratchResources);
 }
 
-void GrContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const {
-    ASSERT_SINGLE_OWNER
-
-    if (resourceCount) {
-        *resourceCount = fResourceCache->getBudgetedResourceCount();
-    }
-    if (resourceBytes) {
-        *resourceBytes = fResourceCache->getBudgetedResourceBytes();
-    }
-}
-
-size_t GrContext::getResourceCachePurgeableBytes() const {
-    ASSERT_SINGLE_OWNER
-    return fResourceCache->getPurgeableBytes();
-}
-
 size_t GrContext::ComputeImageSize(sk_sp<SkImage> image, GrMipmapped mipMapped, bool useNextPow2) {
     if (!image->isTextureBacked()) {
         return 0;
@@ -232,33 +216,6 @@
 }
 
 //////////////////////////////////////////////////////////////////////////////
-
-void GrContext::getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) const {
-    ASSERT_SINGLE_OWNER
-    if (maxResources) {
-        *maxResources = -1;
-    }
-    if (maxResourceBytes) {
-        *maxResourceBytes = this->getResourceCacheLimit();
-    }
-}
-
-size_t GrContext::getResourceCacheLimit() const {
-    ASSERT_SINGLE_OWNER
-    return fResourceCache->getMaxResourceBytes();
-}
-
-void GrContext::setResourceCacheLimits(int unused, size_t maxResourceBytes) {
-    ASSERT_SINGLE_OWNER
-    this->setResourceCacheLimit(maxResourceBytes);
-}
-
-void GrContext::setResourceCacheLimit(size_t maxResourceBytes) {
-    ASSERT_SINGLE_OWNER
-    fResourceCache->setLimit(maxResourceBytes);
-}
-
-//////////////////////////////////////////////////////////////////////////////
 void GrContext::dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const {
     ASSERT_SINGLE_OWNER
     fResourceCache->dumpMemoryStatistics(traceMemoryDump);
diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp
index 9436c44..dcdcc47 100644
--- a/src/gpu/GrDirectContext.cpp
+++ b/src/gpu/GrDirectContext.cpp
@@ -225,6 +225,47 @@
     return true;
 }
 
+void GrDirectContext::getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const {
+    ASSERT_SINGLE_OWNER
+
+    if (resourceCount) {
+        *resourceCount = fResourceCache->getBudgetedResourceCount();
+    }
+    if (resourceBytes) {
+        *resourceBytes = fResourceCache->getBudgetedResourceBytes();
+    }
+}
+
+size_t GrDirectContext::getResourceCachePurgeableBytes() const {
+    ASSERT_SINGLE_OWNER
+    return fResourceCache->getPurgeableBytes();
+}
+
+void GrDirectContext::getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) const {
+    ASSERT_SINGLE_OWNER
+    if (maxResources) {
+        *maxResources = -1;
+    }
+    if (maxResourceBytes) {
+        *maxResourceBytes = this->getResourceCacheLimit();
+    }
+}
+
+size_t GrDirectContext::getResourceCacheLimit() const {
+    ASSERT_SINGLE_OWNER
+    return fResourceCache->getMaxResourceBytes();
+}
+
+void GrDirectContext::setResourceCacheLimits(int unused, size_t maxResourceBytes) {
+    ASSERT_SINGLE_OWNER
+    this->setResourceCacheLimit(maxResourceBytes);
+}
+
+void GrDirectContext::setResourceCacheLimit(size_t maxResourceBytes) {
+    ASSERT_SINGLE_OWNER
+    fResourceCache->setLimit(maxResourceBytes);
+}
+
 GrSmallPathAtlasMgr* GrDirectContext::onGetSmallPathAtlasMgr() {
     if (!fSmallPathAtlasMgr) {
         fSmallPathAtlasMgr = std::make_unique<GrSmallPathAtlasMgr>();