Require explicit GrWrapCacheable specification in more places.

Make all wrapped resources be kUnbudgetedUncacheable except those
created by AHardwareBuffer image generators and as backings for promise
images.

Make all non-wrapped unbudgeted resources be kUnbudgetedUncacheable.

Update unit tests to mostly use GrWrapCacheable::kNo except where they
are testing the distinction.

Update unit tests for new expectations.
Bug: chromium:922851
Change-Id: I4d3bdaa161ffc76390f26334bcb7e2b47dd9319d
Reviewed-on: https://skia-review.googlesource.com/c/185004
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 6005be5..6873fe8 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -997,7 +997,8 @@
     GrXferProcessor::DstProxy fakeDstProxy;
     {
         sk_sp<GrTextureProxy> proxy = proxyProvider->wrapBackendTexture(
-                backendTex, kTopLeft_GrSurfaceOrigin, kBorrow_GrWrapOwnership, kRead_GrIOType);
+                backendTex, kTopLeft_GrSurfaceOrigin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
+                kRead_GrIOType);
         fakeDstProxy.setProxy(std::move(proxy));
     }
 
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 752533b..89917d6 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -53,8 +53,8 @@
     GrBackendTexture backendTex = gpu->createTestingOnlyBackendTexture(
         nullptr, 256, 256, GrColorType::kRGBA_8888, false, GrMipMapped::kNo);
 
-    sk_sp<GrSurface> texRT2 =
-            resourceProvider->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership);
+    sk_sp<GrSurface> texRT2 = resourceProvider->wrapRenderableBackendTexture(
+            backendTex, 1, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
 
     REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget());
     REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture());
@@ -279,7 +279,8 @@
         auto backendTex = context->contextPriv().getGpu()->createTestingOnlyBackendTexture(
                 pixels.addr(), kSize, kSize, kRGBA_8888_SkColorType, true, GrMipMapped::kNo);
         auto proxy = proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin,
-                                                       kBorrow_GrWrapOwnership, ioType);
+                                                       kBorrow_GrWrapOwnership,
+                                                       GrWrapCacheable::kNo, ioType);
         auto surfContext = context->contextPriv().makeWrappedSurfaceContext(proxy);
 
         // Read pixels should work with a read-only texture.
@@ -323,7 +324,8 @@
             backendTex = context->contextPriv().getGpu()->createTestingOnlyBackendTexture(
                     nullptr, kSize, kSize, kRGBA_8888_SkColorType, true, GrMipMapped::kYes);
             proxy = proxyProvider->wrapBackendTexture(backendTex, kTopLeft_GrSurfaceOrigin,
-                                                      kBorrow_GrWrapOwnership, ioType);
+                                                      kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
+                                                      ioType);
             context->flush();
             proxy->peekTexture()->texturePriv().markMipMapsDirty();  // avoids assert in GrGpu.
             auto regenResult =
@@ -363,7 +365,7 @@
         auto backendTexture = context->contextPriv().getGpu()->createTestingOnlyBackendTexture(
                 nullptr, kS, kS, GrColorType::kRGBA_8888, false, GrMipMapped::kNo);
         auto texture = context->contextPriv().resourceProvider()->wrapBackendTexture(
-                backendTexture, kBorrow_GrWrapOwnership, kRW_GrIOType);
+                backendTexture, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);
         installBackendTextureReleaseProc(texture.get());
         return texture;
     };
@@ -372,7 +374,7 @@
         auto backendTexture = context->contextPriv().getGpu()->createTestingOnlyBackendTexture(
                 nullptr, kS, kS, GrColorType::kRGBA_8888, true, GrMipMapped::kNo);
         auto texture = context->contextPriv().resourceProvider()->wrapRenderableBackendTexture(
-                backendTexture, 1, kBorrow_GrWrapOwnership);
+                backendTexture, 1, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
         installBackendTextureReleaseProc(texture.get());
         return texture;
     };
diff --git a/tests/GrTestingBackendTextureUploadTest.cpp b/tests/GrTestingBackendTextureUploadTest.cpp
index 5709e26..5b272c9 100644
--- a/tests/GrTestingBackendTextureUploadTest.cpp
+++ b/tests/GrTestingBackendTextureUploadTest.cpp
@@ -47,11 +47,11 @@
 
     sk_sp<GrTexture> wrappedTex;
     if (renderTarget) {
-        wrappedTex = gpu->wrapRenderableBackendTexture(backendTex, 1,
-                                                       GrWrapOwnership::kAdopt_GrWrapOwnership);
+        wrappedTex = gpu->wrapRenderableBackendTexture(
+                backendTex, 1, GrWrapOwnership::kAdopt_GrWrapOwnership, GrWrapCacheable::kNo);
     } else {
         wrappedTex = gpu->wrapBackendTexture(backendTex, GrWrapOwnership::kAdopt_GrWrapOwnership,
-                                             GrWrapCacheable::kYes, kRead_GrIOType);
+                                             GrWrapCacheable::kNo, kRead_GrIOType);
     }
     REPORTER_ASSERT(reporter, wrappedTex);
 
diff --git a/tests/LazyProxyTest.cpp b/tests/LazyProxyTest.cpp
index 479d2cb..ecc639c 100644
--- a/tests/LazyProxyTest.cpp
+++ b/tests/LazyProxyTest.cpp
@@ -468,7 +468,7 @@
 
                     sk_sp<GrTexture> texture =
                             rp->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership,
-                                                   kRead_GrIOType, GrWrapCacheable::kYes);
+                                                   GrWrapCacheable::kNo, kRead_GrIOType);
                     if (!texture) {
                         return sk_sp<GrTexture>();
                     }
diff --git a/tests/ProxyTest.cpp b/tests/ProxyTest.cpp
index 02b483e..7419fee 100644
--- a/tests/ProxyTest.cpp
+++ b/tests/ProxyTest.cpp
@@ -297,7 +297,8 @@
                                                                  true, GrMipMapped::kNo);
 
                     sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapRenderableBackendTexture(
-                            backendTex, origin, supportedNumSamples);
+                            backendTex, origin, supportedNumSamples, kBorrow_GrWrapOwnership,
+                            GrWrapCacheable::kNo);
                     if (!sProxy) {
                         gpu->deleteTestingOnlyBackendTexture(backendTex);
                         continue;  // This can fail on Mesa
@@ -323,7 +324,8 @@
                                                                  false, GrMipMapped::kNo);
 
                     sk_sp<GrSurfaceProxy> sProxy = proxyProvider->wrapBackendTexture(
-                            backendTex, origin, kBorrow_GrWrapOwnership, kRead_GrIOType);
+                            backendTex, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
+                            kRead_GrIOType);
                     if (!sProxy) {
                         gpu->deleteTestingOnlyBackendTexture(backendTex);
                         continue;
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index dc1d3b7..7ca72fc 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -136,7 +136,7 @@
         }
 
         sk_sp<GrTextureProxy> rectProxy = proxyProvider->wrapBackendTexture(
-                rectangleTex, origin, kBorrow_GrWrapOwnership, kRW_GrIOType);
+                rectangleTex, origin, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRW_GrIOType);
 
         if (!rectProxy) {
             ERRORF(reporter, "Error creating proxy for rectangle texture.");
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index ab24b00..f711691 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -70,7 +70,7 @@
     }
 
     auto tmp = proxyProvider->wrapBackendTexture(*backendTex, p.fOrigin, kBorrow_GrWrapOwnership,
-                                                 kRead_GrIOType);
+                                                 GrWrapCacheable::kNo, kRead_GrIOType);
     if (!tmp) {
         return nullptr;
     }
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 96a0b2f..532cb66 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -223,10 +223,10 @@
     context->resetContext();
 
     sk_sp<GrTexture> borrowed(resourceProvider->wrapBackendTexture(
-            backendTextures[0], kBorrow_GrWrapOwnership, kRead_GrIOType));
+            backendTextures[0], kBorrow_GrWrapOwnership, GrWrapCacheable::kNo, kRead_GrIOType));
 
     sk_sp<GrTexture> adopted(resourceProvider->wrapBackendTexture(
-            backendTextures[1], kAdopt_GrWrapOwnership, kRead_GrIOType));
+            backendTextures[1], kAdopt_GrWrapOwnership, GrWrapCacheable::kNo, kRead_GrIOType));
 
     REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr);
     if (!borrowed || !adopted) {
@@ -277,8 +277,9 @@
                                        SimulatedProperty property, size_t size = kDefaultSize) {
         return new TestResource(gpu, budgeted, property, kScratchConstructor, size);
     }
-    static TestResource* CreateWrapped(GrGpu* gpu, size_t size = kDefaultSize) {
-        return new TestResource(gpu, size);
+    static TestResource* CreateWrapped(GrGpu* gpu, GrWrapCacheable cacheable,
+                                       size_t size = kDefaultSize) {
+        return new TestResource(gpu, cacheable, size);
     }
 
     ~TestResource() override {
@@ -317,14 +318,14 @@
     }
 
     // Constructor for simulating resources that wrap backend objects.
-    TestResource(GrGpu* gpu, size_t size)
-        : INHERITED(gpu)
-        , fToDelete(nullptr)
-        , fSize(size)
-        , fProperty(kA_SimulatedProperty)
-        , fIsScratch(false) {
+    TestResource(GrGpu* gpu, GrWrapCacheable cacheable, size_t size)
+            : INHERITED(gpu)
+            , fToDelete(nullptr)
+            , fSize(size)
+            , fProperty(kA_SimulatedProperty)
+            , fIsScratch(false) {
         ++fNumAlive;
-        this->registerWithCacheWrapped();
+        this->registerWithCacheWrapped(cacheable);
     }
 
     void computeScratchKey(GrScratchKey* key) const override {
@@ -501,24 +502,33 @@
                                         10);
     TestResource* unique = new TestResource(gpu, SkBudgeted::kYes, 11);
     unique->resourcePriv().setUniqueKey(uniqueKey);
-    TestResource* wrapped = TestResource::CreateWrapped(gpu, 12);
-    TestResource* unbudgeted = new TestResource(gpu, SkBudgeted::kNo, 13);
+    TestResource* wrappedCacheable = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes, 12);
+    TestResource* wrappedUncacheable = TestResource::CreateWrapped(gpu, GrWrapCacheable::kNo, 13);
+    TestResource* unbudgeted = new TestResource(gpu, SkBudgeted::kNo, 14);
 
-    // Make sure we can add a unique key to the wrapped resource
+    // Make sure we can add a unique key to the wrapped resources
     GrUniqueKey uniqueKey2;
     make_unique_key<0>(&uniqueKey2, 1);
-    wrapped->resourcePriv().setUniqueKey(uniqueKey2);
-    GrGpuResource* wrappedViaKey = cache->findAndRefUniqueResource(uniqueKey2);
-    REPORTER_ASSERT(reporter, wrappedViaKey != nullptr);
+    GrUniqueKey uniqueKey3;
+    make_unique_key<0>(&uniqueKey3, 2);
+    wrappedCacheable->resourcePriv().setUniqueKey(uniqueKey2);
+    wrappedUncacheable->resourcePriv().setUniqueKey(uniqueKey3);
+    GrGpuResource* wrappedCacheableViaKey = cache->findAndRefUniqueResource(uniqueKey2);
+    REPORTER_ASSERT(reporter, wrappedCacheableViaKey);
+    GrGpuResource* wrappedUncacheableViaKey = cache->findAndRefUniqueResource(uniqueKey3);
+    REPORTER_ASSERT(reporter, wrappedUncacheableViaKey);
 
-    // Remove the extra ref we just added.
-    wrappedViaKey->unref();
+    // Remove the extra refs we just added.
+    SkSafeUnref(wrappedCacheableViaKey);
+    SkSafeUnref(wrappedUncacheableViaKey);
 
     // Make sure sizes are as we expect
-    REPORTER_ASSERT(reporter, 4 == cache->getResourceCount());
+    REPORTER_ASSERT(reporter, 5 == cache->getResourceCount());
     REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() +
-                              wrapped->gpuMemorySize() + unbudgeted->gpuMemorySize() ==
-                              cache->getResourceBytes());
+                                              wrappedCacheable->gpuMemorySize() +
+                                              wrappedUncacheable->gpuMemorySize() +
+                                              unbudgeted->gpuMemorySize() ==
+                                      cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
     REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() ==
                               cache->getBudgetedResourceBytes());
@@ -526,31 +536,39 @@
 
     // Our refs mean that the resources are non purgeable.
     cache->purgeAllUnlocked();
-    REPORTER_ASSERT(reporter, 4 == cache->getResourceCount());
+    REPORTER_ASSERT(reporter, 5 == cache->getResourceCount());
     REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() +
-                              wrapped->gpuMemorySize() + unbudgeted->gpuMemorySize() ==
-                              cache->getResourceBytes());
+                                              wrappedCacheable->gpuMemorySize() +
+                                              wrappedUncacheable->gpuMemorySize() +
+                                              unbudgeted->gpuMemorySize() ==
+                                      cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
     REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() ==
                               cache->getBudgetedResourceBytes());
     REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes());
 
-    // Unreffing the wrapped resource with a unique key shouldn't free it right away.
-    wrapped->unref();
+    // Unreffing the cacheable wrapped resource with a unique key shouldn't free it right away.
+    // However, unreffing the uncacheable wrapped resource should free it.
+    wrappedCacheable->unref();
+    wrappedUncacheable->unref();
     REPORTER_ASSERT(reporter, 4 == cache->getResourceCount());
     REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + unique->gpuMemorySize() +
-                              wrapped->gpuMemorySize() + unbudgeted->gpuMemorySize() ==
-                              cache->getResourceBytes());
+                                              wrappedCacheable->gpuMemorySize() +
+                                              unbudgeted->gpuMemorySize() ==
+                                      cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 12 == cache->getPurgeableBytes());
 
     // Now try freeing the budgeted resources first
-    wrapped = TestResource::CreateWrapped(gpu);
+    wrappedCacheable = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes);
+    wrappedUncacheable = TestResource::CreateWrapped(gpu, GrWrapCacheable::kNo);
     unique->unref();
     REPORTER_ASSERT(reporter, 23 == cache->getPurgeableBytes());
     cache->purgeAllUnlocked();
-    REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
-    REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + wrapped->gpuMemorySize() +
-                              unbudgeted->gpuMemorySize() == cache->getResourceBytes());
+    REPORTER_ASSERT(reporter, 4 == cache->getResourceCount());
+    REPORTER_ASSERT(reporter, scratch->gpuMemorySize() + wrappedCacheable->gpuMemorySize() +
+                                              wrappedUncacheable->gpuMemorySize() +
+                                              unbudgeted->gpuMemorySize() ==
+                                      cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 1 == cache->getBudgetedResourceCount());
     REPORTER_ASSERT(reporter, scratch->gpuMemorySize() == cache->getBudgetedResourceBytes());
     REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes());
@@ -558,15 +576,17 @@
     scratch->unref();
     REPORTER_ASSERT(reporter, 10 == cache->getPurgeableBytes());
     cache->purgeAllUnlocked();
-    REPORTER_ASSERT(reporter, 2 == cache->getResourceCount());
-    REPORTER_ASSERT(reporter, unbudgeted->gpuMemorySize() + wrapped->gpuMemorySize() ==
-                              cache->getResourceBytes());
+    REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
+    REPORTER_ASSERT(reporter, unbudgeted->gpuMemorySize() + wrappedCacheable->gpuMemorySize() +
+                                              wrappedUncacheable->gpuMemorySize() ==
+                                      cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount());
     REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceBytes());
     REPORTER_ASSERT(reporter, 0 == cache->getPurgeableBytes());
 
-    // Unreffing the wrapped resource (with no unique key) should free it right away.
-    wrapped->unref();
+    // Unreffing the wrapped resources (with no unique key) should free them right away.
+    wrappedUncacheable->unref();
+    wrappedCacheable->unref();
     REPORTER_ASSERT(reporter, 1 == cache->getResourceCount());
     REPORTER_ASSERT(reporter, unbudgeted->gpuMemorySize() == cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 0 == cache->getBudgetedResourceCount());
@@ -630,7 +650,7 @@
     REPORTER_ASSERT(reporter, 21 == cache->getBudgetedResourceBytes());
     REPORTER_ASSERT(reporter, 21 == cache->getPurgeableBytes());
 
-    wrapped = TestResource::CreateWrapped(gpu, large);
+    wrapped = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes, large);
     REPORTER_ASSERT(reporter, 3 == cache->getResourceCount());
     REPORTER_ASSERT(reporter, 21 + large == cache->getResourceBytes());
     REPORTER_ASSERT(reporter, 2 == cache->getBudgetedResourceCount());
@@ -670,7 +690,7 @@
         // Since this resource is unbudgeted, it should not be reachable as scratch.
         REPORTER_ASSERT(reporter, resource->resourcePriv().getScratchKey() == key);
         REPORTER_ASSERT(reporter, !resource->cacheAccess().isScratch());
-        REPORTER_ASSERT(reporter, GrBudgetedType::kUnbudgetedCacheable ==
+        REPORTER_ASSERT(reporter, GrBudgetedType::kUnbudgetedUncacheable ==
                                           resource->resourcePriv().budgetedType());
         REPORTER_ASSERT(reporter, nullptr == cache->findAndRefScratchResource(key, TestResource::kDefaultSize, GrResourceCache::ScratchFlags::kNone));
         REPORTER_ASSERT(reporter, 1 == cache->getResourceCount());
@@ -1512,28 +1532,41 @@
     GrResourceCache* cache = mock.cache();
     GrGpu* gpu = context->contextPriv().getGpu();
 
-    TestResource* wrapped1 = TestResource::CreateWrapped(gpu, 12);
+    TestResource* wrapped1 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes);
     cache->insertCrossContextGpuResource(wrapped1);
 
     REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
 
-    TestResource* wrapped2 = TestResource::CreateWrapped(gpu, 12);
+    TestResource* wrapped2 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kYes);
     cache->insertCrossContextGpuResource(wrapped2);
 
-    REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
+    // An uncacheable cross-context should not be purged as soon as we drop our ref. This
+    // is because inserting it as a cross-context resource actually holds a ref until the
+    // message is received.
+    TestResource* wrapped3 = TestResource::CreateWrapped(gpu, GrWrapCacheable::kNo);
+    cache->insertCrossContextGpuResource(wrapped3);
+
+    REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive());
 
     // Have only ref waiting on message.
     wrapped1->unref();
     wrapped2->unref();
+    wrapped3->unref();
 
-    REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
+    REPORTER_ASSERT(reporter, 3 == TestResource::NumAlive());
 
     // This should free nothing since no messages were sent.
     cache->purgeAsNeeded();
 
     // Send message to free the first resource
-    GrGpuResourceFreedMessage msg { wrapped1, context->uniqueID() };
-    SkMessageBus<GrGpuResourceFreedMessage>::Post(msg);
+    GrGpuResourceFreedMessage msg1{wrapped1, context->uniqueID()};
+    SkMessageBus<GrGpuResourceFreedMessage>::Post(msg1);
+    cache->purgeAsNeeded();
+
+    REPORTER_ASSERT(reporter, 2 == TestResource::NumAlive());
+
+    GrGpuResourceFreedMessage msg2{wrapped3, context->uniqueID()};
+    SkMessageBus<GrGpuResourceFreedMessage>::Post(msg2);
     cache->purgeAsNeeded();
 
     REPORTER_ASSERT(reporter, 1 == TestResource::NumAlive());
diff --git a/tests/TextureProxyTest.cpp b/tests/TextureProxyTest.cpp
index 5260a0e..2c1847f 100644
--- a/tests/TextureProxyTest.cpp
+++ b/tests/TextureProxyTest.cpp
@@ -113,7 +113,8 @@
     backendTex.setPixelConfig(desc.fConfig);
 
     return proxyProvider->wrapBackendTexture(backendTex, kBottomLeft_GrSurfaceOrigin,
-                                             kBorrow_GrWrapOwnership, kRead_GrIOType);
+                                             kBorrow_GrWrapOwnership, GrWrapCacheable::kYes,
+                                             kRead_GrIOType);
 }
 
 
diff --git a/tests/TraceMemoryDumpTest.cpp b/tests/TraceMemoryDumpTest.cpp
index 59f7b0f..0a53249 100644
--- a/tests/TraceMemoryDumpTest.cpp
+++ b/tests/TraceMemoryDumpTest.cpp
@@ -128,7 +128,7 @@
     idDesc.fOwnership = GrBackendObjectOwnership::kBorrowed;
 
     auto texture = GrGLTexture::MakeWrapped(gpu, desc, GrMipMapsStatus::kNotAllocated, idDesc,
-                                            GrWrapCacheable::kYes, kRead_GrIOType);
+                                            GrWrapCacheable::kNo, kRead_GrIOType);
 
     ValidateMemoryDumps(reporter, context, texture->gpuMemorySize(), false /* isOwned */);
 }
diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp
index 84fdc25..a10efb2 100644
--- a/tests/VkWrapTests.cpp
+++ b/tests/VkWrapTests.cpp
@@ -43,7 +43,7 @@
     SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo));
 
     sk_sp<GrTexture> tex = gpu->wrapBackendTexture(origBackendTex, kBorrow_GrWrapOwnership,
-                                                   GrWrapCacheable::kYes, kRead_GrIOType);
+                                                   GrWrapCacheable::kNo, kRead_GrIOType);
     REPORTER_ASSERT(reporter, tex);
 
     // image is null
@@ -52,10 +52,10 @@
         backendCopy.fImage = VK_NULL_HANDLE;
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
         backendTex.setPixelConfig(kPixelConfig);
-        tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kYes,
+        tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
                                       kRead_GrIOType);
         REPORTER_ASSERT(reporter, !tex);
-        tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership, GrWrapCacheable::kYes,
+        tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo,
                                       kRead_GrIOType);
         REPORTER_ASSERT(reporter, !tex);
     }
@@ -66,10 +66,10 @@
         backendCopy.fAlloc = GrVkAlloc();
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
         backendTex.setPixelConfig(kPixelConfig);
-        tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kYes,
+        tex = gpu->wrapBackendTexture(backendTex, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo,
                                       kRead_GrIOType);
         REPORTER_ASSERT(reporter, !tex);
-        tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership, GrWrapCacheable::kYes,
+        tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo,
                                       kRead_GrIOType);
         REPORTER_ASSERT(reporter, !tex);
     }
@@ -79,7 +79,7 @@
         GrVkImageInfo backendCopy = imageInfo;
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
         backendTex.setPixelConfig(kPixelConfig);
-        tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership, GrWrapCacheable::kYes,
+        tex = gpu->wrapBackendTexture(backendTex, kAdopt_GrWrapOwnership, GrWrapCacheable::kNo,
                                       kRead_GrIOType);
 
         REPORTER_ASSERT(reporter, tex);
@@ -137,8 +137,8 @@
     GrVkImageInfo imageInfo;
     SkAssertResult(origBackendTex.getVkImageInfo(&imageInfo));
 
-    sk_sp<GrTexture> tex =
-            gpu->wrapRenderableBackendTexture(origBackendTex, 1, kBorrow_GrWrapOwnership);
+    sk_sp<GrTexture> tex = gpu->wrapRenderableBackendTexture(
+            origBackendTex, 1, kBorrow_GrWrapOwnership, GrWrapCacheable::kNo);
     REPORTER_ASSERT(reporter, tex);
 
     // image is null
@@ -147,9 +147,11 @@
         backendCopy.fImage = VK_NULL_HANDLE;
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
         backendTex.setPixelConfig(kPixelConfig);
-        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership);
+        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership,
+                                                GrWrapCacheable::kNo);
         REPORTER_ASSERT(reporter, !tex);
-        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership);
+        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership,
+                                                GrWrapCacheable::kNo);
         REPORTER_ASSERT(reporter, !tex);
     }
 
@@ -159,9 +161,11 @@
         backendCopy.fAlloc = GrVkAlloc();
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
         backendTex.setPixelConfig(kPixelConfig);
-        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership);
+        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kBorrow_GrWrapOwnership,
+                                                GrWrapCacheable::kNo);
         REPORTER_ASSERT(reporter, !tex);
-        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership);
+        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership,
+                                                GrWrapCacheable::kNo);
         REPORTER_ASSERT(reporter, !tex);
     }
 
@@ -170,7 +174,8 @@
         GrVkImageInfo backendCopy = imageInfo;
         GrBackendTexture backendTex = GrBackendTexture(kW, kH, backendCopy);
         backendTex.setPixelConfig(kPixelConfig);
-        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership);
+        tex = gpu->wrapRenderableBackendTexture(backendTex, 1, kAdopt_GrWrapOwnership,
+                                                GrWrapCacheable::kNo);
         REPORTER_ASSERT(reporter, tex);
     }
 }