Consolidate Proxy caching code in GrResourceProvider

This doesn't implement the GrSurfaceProxy-based caching but just carves out a space for it.

Split out of: https://skia-review.googlesource.com/c/8823/ (Remove GrFragmentProcessor-derived class' GrTexture-based ctors)

Change-Id: Iec87b45e3264b349d7804f63e361e970b925e335
Reviewed-on: https://skia-review.googlesource.com/9626
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index df36e65..2bf5a72 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -196,10 +196,10 @@
 
 void GrTextureStripAtlas::lockTexture() {
     GrSurfaceDesc texDesc;
+    texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
     texDesc.fWidth = fDesc.fWidth;
     texDesc.fHeight = fDesc.fHeight;
     texDesc.fConfig = fDesc.fConfig;
-    texDesc.fIsMipMapped = false;
 
     static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
     GrUniqueKey key;
@@ -207,24 +207,24 @@
     builder[0] = static_cast<uint32_t>(fCacheKey);
     builder.finish();
 
-    // MDB TODO (caching): this side-steps the issue of proxies with unique IDs
-    sk_sp<GrTexture> texture(fDesc.fContext->resourceProvider()->findAndRefTextureByUniqueKey(key));
-    if (!texture) {
-        texture.reset(fDesc.fContext->resourceProvider()->createTexture(
-                                                        texDesc, SkBudgeted::kYes,
-                                                        nullptr, 0,
-                                                        GrResourceProvider::kNoPendingIO_Flag));
-        if (!texture) {
+    sk_sp<GrTextureProxy> proxy = fDesc.fContext->resourceProvider()->findProxyByUniqueKey(key);
+    if (!proxy) {
+        proxy = GrSurfaceProxy::MakeDeferred(fDesc.fContext->resourceProvider(),
+                                             *fDesc.fContext->caps(), texDesc, SkBackingFit::kExact,
+                                             SkBudgeted::kYes,
+                                             GrResourceProvider::kNoPendingIO_Flag);
+        if (!proxy) {
             return;
         }
 
-        fDesc.fContext->resourceProvider()->assignUniqueKeyToTexture(key, texture.get());
+        fDesc.fContext->resourceProvider()->assignUniqueKeyToProxy(key, proxy.get());
         // This is a new texture, so all of our cache info is now invalid
         this->initLRU();
         fKeyTable.rewind();
     }
-    SkASSERT(texture);
-    fTexContext = fDesc.fContext->contextPriv().makeWrappedSurfaceContext(std::move(texture));
+    SkASSERT(proxy);
+    fTexContext = fDesc.fContext->contextPriv().makeWrappedSurfaceContext(std::move(proxy),
+                                                                          nullptr);
 }
 
 void GrTextureStripAtlas::unlockTexture() {