Rebase and fix chromium

Combine texture provider and resource provider

Largely mechanical. Only three places that were calling createApprox
via texture provider (ie without flags), so that was simple.

BUG=skia:

Change-Id: I876367bcdc6a8db736deedab1028de1972015509
Reviewed-on: https://skia-review.googlesource.com/9176
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/core/SkGpuBlurUtils.cpp b/src/core/SkGpuBlurUtils.cpp
index bc40c38..43f28cb 100644
--- a/src/core/SkGpuBlurUtils.cpp
+++ b/src/core/SkGpuBlurUtils.cpp
@@ -199,7 +199,7 @@
         // Chrome is crashing with proxies when they need to be instantiated.
         // Force an instantiation here (where, in olden days, we used to require a GrTexture)
         // to see if the input is already un-instantiable.
-        GrTexture* temp = srcProxy->instantiate(context->textureProvider());
+        GrTexture* temp = srcProxy->instantiate(context->resourceProvider());
         if (!temp) {
             return nullptr;
         }
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index c33a008..b4f9e8b 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -21,8 +21,8 @@
 #include "GrGpuResourcePriv.h"
 #include "GrImageTextureMaker.h"
 #include "GrResourceKey.h"
+#include "GrResourceProvider.h"
 #include "GrSamplerParams.h"
-#include "GrTextureProvider.h"
 #include "GrYUVProvider.h"
 #include "SkGr.h"
 #include "SkGrPriv.h"
@@ -467,7 +467,7 @@
     }
 
     desc.fConfig = config;
-    return ctx->textureProvider()->createTexture(desc, SkBudgeted::kYes, rawStart, 0);
+    return ctx->resourceProvider()->createTexture(desc, SkBudgeted::kYes, rawStart, 0);
 }
 #endif
 
@@ -486,10 +486,10 @@
     }
 };
 
-static GrTexture* set_key_and_return(GrTextureProvider* texProvider,
+static GrTexture* set_key_and_return(GrResourceProvider* resourceProvider,
                                      GrTexture* tex, const GrUniqueKey& key) {
     if (key.isValid()) {
-        texProvider->assignUniqueKeyToTexture(key, tex);
+        resourceProvider->assignUniqueKeyToTexture(key, tex);
     }
     return tex;
 }
@@ -538,7 +538,7 @@
 
     // 1. Check the cache for a pre-existing one
     if (key.isValid()) {
-        if (GrTexture* tex = ctx->textureProvider()->findAndRefTextureByUniqueKey(key)) {
+        if (GrTexture* tex = ctx->resourceProvider()->findAndRefTextureByUniqueKey(key)) {
             SK_HISTOGRAM_ENUMERATION("LockTexturePath", kPreExisting_LockTexturePath,
                                      kLockTexturePathCount);
             return tex;
@@ -556,9 +556,9 @@
         if (sk_sp<GrTextureProxy> proxy = generator->generateTexture(ctx, cacheInfo, fOrigin)) {
             SK_HISTOGRAM_ENUMERATION("LockTexturePath", kNative_LockTexturePath,
                                      kLockTexturePathCount);
-            GrTexture* tex2 = proxy->instantiate(ctx->textureProvider());
+            GrTexture* tex2 = proxy->instantiate(ctx->resourceProvider());
             if (tex2) {
-                return set_key_and_return(ctx->textureProvider(), SkSafeRef(tex2), key);
+                return set_key_and_return(ctx->resourceProvider(), SkSafeRef(tex2), key);
             }
         }
     }
@@ -586,7 +586,7 @@
         if (tex) {
             SK_HISTOGRAM_ENUMERATION("LockTexturePath", kYUV_LockTexturePath,
                                      kLockTexturePathCount);
-            return set_key_and_return(ctx->textureProvider(), tex.release(), key);
+            return set_key_and_return(ctx->resourceProvider(), tex.release(), key);
         }
     }
 
@@ -603,7 +603,7 @@
         if (tex) {
             SK_HISTOGRAM_ENUMERATION("LockTexturePath", kRGBA_LockTexturePath,
                                      kLockTexturePathCount);
-            return set_key_and_return(ctx->textureProvider(), tex, key);
+            return set_key_and_return(ctx->resourceProvider(), tex, key);
         }
     }
     SK_HISTOGRAM_ENUMERATION("LockTexturePath", kFailure_LockTexturePath,
diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp
index 59dbe2e..e856058 100644
--- a/src/core/SkMaskFilter.cpp
+++ b/src/core/SkMaskFilter.cpp
@@ -314,7 +314,7 @@
     return false;
 }
 
-bool SkMaskFilter::directFilterMaskGPU(GrTextureProvider* texProvider,
+bool SkMaskFilter::directFilterMaskGPU(GrResourceProvider* resourceProvider,
                                        GrRenderTargetContext* renderTargetContext,
                                        GrPaint&&,
                                        const GrClip&,
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index ad5ef4d..9ded6aa 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -349,7 +349,7 @@
 static sk_sp<SkImage> wrap_proxy_in_image(GrContext* context, GrTextureProxy* proxy,
                                           SkAlphaType alphaType, sk_sp<SkColorSpace> colorSpace) {
     // TODO: add GrTextureProxy-backed SkImage_Gpus
-    GrTexture* tex = proxy->instantiate(context->textureProvider());
+    GrTexture* tex = proxy->instantiate(context->resourceProvider());
     if (!tex) {
         return nullptr;
     }
@@ -390,7 +390,7 @@
                                       this->subset().width(), this->subset().height());
 
         // TODO: add GrTextureProxy-backed SkImage_Gpus
-        GrTexture* tex = fTextureProxy->instantiate(fContext->textureProvider());
+        GrTexture* tex = fTextureProxy->instantiate(fContext->resourceProvider());
         if (!tex) {
             return;
         }
@@ -432,7 +432,7 @@
         }
 
         // Reading back to an SkBitmap ends deferral
-        GrTexture* texture = fTextureProxy->instantiate(fContext->textureProvider());
+        GrTexture* texture = fTextureProxy->instantiate(fContext->resourceProvider());
         if (!texture) {
             return false;
         }
diff --git a/src/effects/GrAlphaThresholdFragmentProcessor.cpp b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
index 464dc5e..897d447 100644
--- a/src/effects/GrAlphaThresholdFragmentProcessor.cpp
+++ b/src/effects/GrAlphaThresholdFragmentProcessor.cpp
@@ -39,14 +39,14 @@
         , fOuterThreshold(outerThreshold)
         , fImageCoordTransform(context, SkMatrix::I(), proxy.get(),
                                GrSamplerParams::kNone_FilterMode)
-        , fImageTextureSampler(context->textureProvider(), std::move(proxy))
+        , fImageTextureSampler(context->resourceProvider(), std::move(proxy))
         , fColorSpaceXform(std::move(colorSpaceXform))
         , fMaskCoordTransform(
                   context,
                   SkMatrix::MakeTrans(SkIntToScalar(-bounds.x()), SkIntToScalar(-bounds.y())),
                   maskProxy.get(),
                   GrSamplerParams::kNone_FilterMode)
-        , fMaskTextureSampler(context->textureProvider(), maskProxy) {
+        , fMaskTextureSampler(context->resourceProvider(), maskProxy) {
     this->initClassID<GrAlphaThresholdFragmentProcessor>();
     this->addCoordTransform(&fImageCoordTransform);
     this->addTextureSampler(&fImageTextureSampler);
diff --git a/src/effects/GrCircleBlurFragmentProcessor.cpp b/src/effects/GrCircleBlurFragmentProcessor.cpp
index de4bb58..f9f960c 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.cpp
+++ b/src/effects/GrCircleBlurFragmentProcessor.cpp
@@ -10,7 +10,7 @@
 #if SK_SUPPORT_GPU
 
 #include "GrContext.h"
-#include "GrTextureProvider.h"
+#include "GrResourceProvider.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
 #include "glsl/GrGLSLFragmentShaderBuilder.h"
 #include "glsl/GrGLSLProgramDataManager.h"
@@ -82,7 +82,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(GrTextureProvider* textureProvider,
+GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(GrResourceProvider* resourceProvider,
                                                              const SkRect& circle,
                                                              float textureRadius,
                                                              float solidRadius,
@@ -91,7 +91,7 @@
         , fCircle(circle)
         , fSolidRadius(solidRadius)
         , fTextureRadius(textureRadius)
-        , fBlurProfileSampler(textureProvider, std::move(blurProfile),
+        , fBlurProfileSampler(resourceProvider, std::move(blurProfile),
                               GrSamplerParams::kBilerp_FilterMode) {
     this->initClassID<GrCircleBlurFragmentProcessor>();
     this->addTextureSampler(&fBlurProfileSampler);
@@ -260,7 +260,7 @@
     return profile;
 }
 
-static sk_sp<GrTextureProxy> create_profile_texture(GrTextureProvider* textureProvider,
+static sk_sp<GrTextureProxy> create_profile_texture(GrResourceProvider* resourceProvider,
                                                     const SkRect& circle,
                                                     float sigma,
                                                     float* solidRadius, float* textureRadius) {
@@ -300,7 +300,7 @@
     builder.finish();
 
     // MDB TODO (caching): this side-steps the issue of texture proxies with unique IDs
-    sk_sp<GrTexture> blurProfile(textureProvider->findAndRefTextureByUniqueKey(key));
+    sk_sp<GrTexture> blurProfile(resourceProvider->findAndRefTextureByUniqueKey(key));
     if (!blurProfile) {
         static constexpr int kProfileTextureWidth = 512;
         GrSurfaceDesc texDesc;
@@ -318,13 +318,13 @@
                                                 kProfileTextureWidth));
         }
 
-        blurProfile.reset(textureProvider->createTexture(texDesc, SkBudgeted::kYes,
+        blurProfile.reset(resourceProvider->createTexture(texDesc, SkBudgeted::kYes,
                                                          profile.get(), 0));
         if (!blurProfile) {
             return nullptr;
         }
 
-        textureProvider->assignUniqueKeyToTexture(key, blurProfile.get());
+        resourceProvider->assignUniqueKeyToTexture(key, blurProfile.get());
     }
 
     return GrSurfaceProxy::MakeWrapped(std::move(blurProfile));
@@ -332,16 +332,16 @@
 
 //////////////////////////////////////////////////////////////////////////////
 
-sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::Make(GrTextureProvider* textureProvider,
+sk_sp<GrFragmentProcessor> GrCircleBlurFragmentProcessor::Make(GrResourceProvider* resourceProvider,
                                                                const SkRect& circle, float sigma) {
     float solidRadius;
     float textureRadius;
-    sk_sp<GrTextureProxy> profile(create_profile_texture(textureProvider, circle, sigma,
+    sk_sp<GrTextureProxy> profile(create_profile_texture(resourceProvider, circle, sigma,
                                                          &solidRadius, &textureRadius));
     if (!profile) {
         return nullptr;
     }
-    return sk_sp<GrFragmentProcessor>(new GrCircleBlurFragmentProcessor(textureProvider,
+    return sk_sp<GrFragmentProcessor>(new GrCircleBlurFragmentProcessor(resourceProvider,
                                                                         circle,
                                                                         textureRadius, solidRadius,
                                                                         std::move(profile)));
@@ -356,7 +356,7 @@
     SkScalar wh = d->fRandom->nextRangeScalar(100.f, 1000.f);
     SkScalar sigma = d->fRandom->nextRangeF(1.f,10.f);
     SkRect circle = SkRect::MakeWH(wh, wh);
-    return GrCircleBlurFragmentProcessor::Make(d->context()->textureProvider(), circle, sigma);
+    return GrCircleBlurFragmentProcessor::Make(d->context()->resourceProvider(), circle, sigma);
 }
 #endif
 
diff --git a/src/effects/GrCircleBlurFragmentProcessor.h b/src/effects/GrCircleBlurFragmentProcessor.h
index 9b1fdbf..c6cf3ba 100644
--- a/src/effects/GrCircleBlurFragmentProcessor.h
+++ b/src/effects/GrCircleBlurFragmentProcessor.h
@@ -16,7 +16,7 @@
 #include "GrFragmentProcessor.h"
 #include "GrProcessorUnitTest.h"
 
-class GrTextureProvider;
+class GrResourceProvider;
 
 // This FP handles the special case of a blurred circle. It uses a 1D
 // profile that is just rotated about the origin of the circle.
@@ -34,7 +34,7 @@
         return str;
     }
 
-    static sk_sp<GrFragmentProcessor> Make(GrTextureProvider*, const SkRect& circle, float sigma);
+    static sk_sp<GrFragmentProcessor> Make(GrResourceProvider*, const SkRect& circle, float sigma);
 
 private:
     // This nested GLSL processor implementation is defined in the cpp file.
@@ -45,7 +45,7 @@
      * The x texture coord should map from 0 to 1 across the radius range of solidRadius to
      * solidRadius + textureRadius.
      */
-    GrCircleBlurFragmentProcessor(GrTextureProvider*, const SkRect& circle,
+    GrCircleBlurFragmentProcessor(GrResourceProvider*, const SkRect& circle,
                                   float textureRadius, float innerRadius,
                                   sk_sp<GrTextureProxy> blurProfile);
 
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index 2ee942d..7ca7aa8 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -19,11 +19,11 @@
 #include "GrCircleBlurFragmentProcessor.h"
 #include "GrContext.h"
 #include "GrRenderTargetContext.h"
+#include "GrResourceProvider.h"
 #include "GrTexture.h"
 #include "GrFragmentProcessor.h"
 #include "GrShaderCaps.h"
 #include "GrStyle.h"
-#include "GrTextureProvider.h"
 #include "GrTextureProxy.h"
 #include "effects/GrSimpleTextureEffect.h"
 #include "glsl/GrGLSLFragmentProcessor.h"
@@ -50,7 +50,7 @@
                           const SkIRect& clipBounds,
                           const SkMatrix& ctm,
                           SkRect* maskRect) const override;
-    bool directFilterMaskGPU(GrTextureProvider* texProvider,
+    bool directFilterMaskGPU(GrResourceProvider* resourceProvider,
                              GrRenderTargetContext* renderTargetContext,
                              GrPaint&&,
                              const GrClip&,
@@ -771,7 +771,7 @@
 
     const char* name() const override { return "RectBlur"; }
 
-    static sk_sp<GrFragmentProcessor> Make(GrTextureProvider* textureProvider,
+    static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
                                            const SkRect& rect, float sigma) {
         int doubleProfileSize = SkScalarCeilToInt(12*sigma);
 
@@ -781,7 +781,7 @@
             return nullptr;
         }
 
-        sk_sp<GrTextureProxy> blurProfile(CreateBlurProfileTexture(textureProvider, sigma));
+        sk_sp<GrTextureProxy> blurProfile(CreateBlurProfileTexture(resourceProvider, sigma));
         if (!blurProfile) {
            return nullptr;
         }
@@ -805,7 +805,7 @@
             precision = kDefault_GrSLPrecision;
         }
 
-        return sk_sp<GrFragmentProcessor>(new GrRectBlurEffect(textureProvider, rect, sigma,
+        return sk_sp<GrFragmentProcessor>(new GrRectBlurEffect(resourceProvider, rect, sigma,
                                                                std::move(blurProfile), precision));
     }
 
@@ -814,7 +814,7 @@
     GrSLPrecision precision() const { return fPrecision; }
 
 private:
-    GrRectBlurEffect(GrTextureProvider*, const SkRect& rect, float sigma,
+    GrRectBlurEffect(GrResourceProvider*, const SkRect& rect, float sigma,
                      sk_sp<GrTextureProxy> blurProfile, GrSLPrecision fPrecision);
 
     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@@ -823,7 +823,7 @@
 
     bool onIsEqual(const GrFragmentProcessor&) const override;
 
-    static sk_sp<GrTextureProxy> CreateBlurProfileTexture(GrTextureProvider*, float sigma);
+    static sk_sp<GrTextureProxy> CreateBlurProfileTexture(GrResourceProvider*, float sigma);
 
     SkRect          fRect;
     float           fSigma;
@@ -942,8 +942,8 @@
 }
 
 // MDB TODO (caching): This side-steps the issue of texture proxies with unique IDs
-sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture(GrTextureProvider* textureProvider,
-                                                                 float sigma) {
+sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture(
+        GrResourceProvider* resourceProvider, float sigma) {
     GrSurfaceDesc texDesc;
 
     unsigned int profileSize = SkScalarCeilToInt(6*sigma);
@@ -959,30 +959,30 @@
     builder[0] = profileSize;
     builder.finish();
 
-    sk_sp<GrTexture> blurProfile(textureProvider->findAndRefTextureByUniqueKey(key));
+    sk_sp<GrTexture> blurProfile(resourceProvider->findAndRefTextureByUniqueKey(key));
     if (!blurProfile) {
         std::unique_ptr<uint8_t[]> profile(SkBlurMask::ComputeBlurProfile(sigma));
 
-        blurProfile.reset(textureProvider->createTexture(texDesc, SkBudgeted::kYes,
+        blurProfile.reset(resourceProvider->createTexture(texDesc, SkBudgeted::kYes,
                                                          profile.get(), 0));
         if (!blurProfile) {
             return nullptr;
         }
 
-        textureProvider->assignUniqueKeyToTexture(key, blurProfile.get());
+        resourceProvider->assignUniqueKeyToTexture(key, blurProfile.get());
     }
 
     return GrSurfaceProxy::MakeWrapped(std::move(blurProfile));
 }
 
-GrRectBlurEffect::GrRectBlurEffect(GrTextureProvider* textureProvider,
+GrRectBlurEffect::GrRectBlurEffect(GrResourceProvider* resourceProvider,
                                    const SkRect& rect, float sigma,
                                    sk_sp<GrTextureProxy> blurProfile,
                                    GrSLPrecision precision)
         : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
         , fRect(rect)
         , fSigma(sigma)
-        , fBlurProfileSampler(textureProvider, std::move(blurProfile))
+        , fBlurProfileSampler(resourceProvider, std::move(blurProfile))
         , fPrecision(precision) {
     this->initClassID<GrRectBlurEffect>();
     this->addTextureSampler(&fBlurProfileSampler);
@@ -1009,12 +1009,12 @@
     float sigma = d->fRandom->nextRangeF(3,8);
     float width = d->fRandom->nextRangeF(200,300);
     float height = d->fRandom->nextRangeF(200,300);
-    return GrRectBlurEffect::Make(d->context()->textureProvider(), SkRect::MakeWH(width, height),
+    return GrRectBlurEffect::Make(d->context()->resourceProvider(), SkRect::MakeWH(width, height),
                                   sigma);
 }
 #endif
 
-bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
+bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrResourceProvider* resourceProvider,
                                                GrRenderTargetContext* renderTargetContext,
                                                GrPaint&& paint,
                                                const GrClip& clip,
@@ -1041,9 +1041,9 @@
         SkScalar pad = 3.0f * xformedSigma;
         rect.outset(pad, pad);
 
-        fp = GrRectBlurEffect::Make(texProvider, rect, xformedSigma);
+        fp = GrRectBlurEffect::Make(resourceProvider, rect, xformedSigma);
     } else if (path.isOval(&rect) && SkScalarNearlyEqual(rect.width(), rect.height())) {
-        fp = GrCircleBlurFragmentProcessor::Make(texProvider, rect, xformedSigma);
+        fp = GrCircleBlurFragmentProcessor::Make(resourceProvider, rect, xformedSigma);
 
         // expand the rect for the coverage geometry
         int pad = SkScalarCeilToInt(6*xformedSigma)/2;
@@ -1085,7 +1085,7 @@
 private:
     GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
 
-    GrRRectBlurEffect(GrTextureProvider*, float sigma, const SkRRect&,
+    GrRRectBlurEffect(GrResourceProvider*, float sigma, const SkRRect&,
                       sk_sp<GrTextureProxy> profileProxy);
 
     virtual void onGetGLSLProcessorKey(const GrShaderCaps& caps,
@@ -1121,7 +1121,7 @@
     }
     builder.finish();
 
-    sk_sp<GrTexture> mask(context->textureProvider()->findAndRefTextureByUniqueKey(key));
+    sk_sp<GrTexture> mask(context->resourceProvider()->findAndRefTextureByUniqueKey(key));
     if (!mask) {
         // TODO: this could be approx but the texture coords will need to be updated
         sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContextWithFallback(
@@ -1157,7 +1157,7 @@
         if (!mask) {
             return nullptr;
         }
-        context->textureProvider()->assignUniqueKeyToTexture(key, mask.get());
+        context->resourceProvider()->assignUniqueKeyToTexture(key, mask.get());
     }
 
     return GrSurfaceProxy::MakeWrapped(std::move(mask));
@@ -1200,19 +1200,19 @@
         return nullptr;
     }
 
-    return sk_sp<GrFragmentProcessor>(new GrRRectBlurEffect(context->textureProvider(),
+    return sk_sp<GrFragmentProcessor>(new GrRRectBlurEffect(context->resourceProvider(),
                                                             xformedSigma,
                                                             devRRect,
                                                             std::move(mask)));
 }
 
-GrRRectBlurEffect::GrRRectBlurEffect(GrTextureProvider* textureProvider,
+GrRRectBlurEffect::GrRRectBlurEffect(GrResourceProvider* resourceProvider,
                                      float sigma, const SkRRect& rrect,
                                      sk_sp<GrTextureProxy> ninePatchProxy)
         : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
         , fRRect(rrect)
         , fSigma(sigma)
-        , fNinePatchSampler(textureProvider, std::move(ninePatchProxy)) {
+        , fNinePatchSampler(resourceProvider, std::move(ninePatchProxy)) {
     this->initClassID<GrRRectBlurEffect>();
     this->addTextureSampler(&fNinePatchSampler);
 }
@@ -1369,9 +1369,9 @@
             SkScalar pad = 3.0f * xformedSigma;
             const SkRect dstCoverageRect = devRRect.rect().makeOutset(pad, pad);
 
-            fp = GrRectBlurEffect::Make(context->textureProvider(), dstCoverageRect, xformedSigma);
+            fp = GrRectBlurEffect::Make(context->resourceProvider(), dstCoverageRect, xformedSigma);
         } else {
-            fp = GrCircleBlurFragmentProcessor::Make(context->textureProvider(),
+            fp = GrCircleBlurFragmentProcessor::Make(context->resourceProvider(),
                                                      devRRect.rect(),
                                                      xformedSigma);
         }
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 3c0a2d5..0005981 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -498,11 +498,11 @@
                                                            : kNone_OptimizationFlags)
         , fDisplacementTransform(context, offsetMatrix, displacement.get(),
                                  GrSamplerParams::kNone_FilterMode)
-        , fDisplacementSampler(context->textureProvider(), displacement)
+        , fDisplacementSampler(context->resourceProvider(), displacement)
         , fColorTransform(context, color.get(), GrSamplerParams::kNone_FilterMode)
         , fDomain(color.get(), GrTextureDomain::MakeTexelDomain(SkIRect::MakeSize(colorDimensions)),
                   GrTextureDomain::kDecal_Mode)
-        , fColorSampler(context->textureProvider(), color)
+        , fColorSampler(context->resourceProvider(), color)
         , fColorSpaceXform(std::move(colorSpaceXform))
         , fXChannelSelector(xChannelSelector)
         , fYChannelSelector(yChannelSelector)
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 5f8fe32..4ebf36a 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -486,7 +486,7 @@
 
 class GrPerlinNoiseEffect : public GrFragmentProcessor {
 public:
-    static sk_sp<GrFragmentProcessor> Make(GrTextureProvider* textureProvider,
+    static sk_sp<GrFragmentProcessor> Make(GrResourceProvider* resourceProvider,
                                            SkPerlinNoiseShader::Type type,
                                            int numOctaves, bool stitchTiles,
                                            SkPerlinNoiseShader::PaintingData* paintingData,
@@ -494,7 +494,7 @@
                                            sk_sp<GrTextureProxy> noiseProxy,
                                            const SkMatrix& matrix) {
         return sk_sp<GrFragmentProcessor>(
-            new GrPerlinNoiseEffect(textureProvider, type, numOctaves, stitchTiles, paintingData,
+            new GrPerlinNoiseEffect(resourceProvider, type, numOctaves, stitchTiles, paintingData,
                                     std::move(permutationsProxy), std::move(noiseProxy), matrix));
     }
 
@@ -528,7 +528,7 @@
                fPaintingData->fStitchDataInit == s.fPaintingData->fStitchDataInit;
     }
 
-    GrPerlinNoiseEffect(GrTextureProvider* textureProvider,
+    GrPerlinNoiseEffect(GrResourceProvider* resourceProvider,
                         SkPerlinNoiseShader::Type type, int numOctaves, bool stitchTiles,
                         SkPerlinNoiseShader::PaintingData* paintingData,
                         sk_sp<GrTextureProxy> permutationsProxy, sk_sp<GrTextureProxy> noiseProxy,
@@ -538,8 +538,8 @@
             , fCoordTransform(matrix)
             , fNumOctaves(numOctaves)
             , fStitchTiles(stitchTiles)
-            , fPermutationsSampler(textureProvider, std::move(permutationsProxy))
-            , fNoiseSampler(textureProvider, std::move(noiseProxy))
+            , fPermutationsSampler(resourceProvider, std::move(permutationsProxy))
+            , fNoiseSampler(resourceProvider, std::move(noiseProxy))
             , fPaintingData(paintingData) {
         this->initClassID<GrPerlinNoiseEffect>();
         this->addTextureSampler(&fPermutationsSampler);
@@ -926,7 +926,7 @@
     m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1);
     if (permutationsProxy && noiseProxy) {
         sk_sp<GrFragmentProcessor> inner(
-            GrPerlinNoiseEffect::Make(args.fContext->textureProvider(),
+            GrPerlinNoiseEffect::Make(args.fContext->resourceProvider(),
                                       fType,
                                       fNumOctaves,
                                       fStitchTiles,
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index b63ed47..ba3f084 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -515,7 +515,7 @@
 ColorTableEffect::ColorTableEffect(GrContext* context, sk_sp<GrTextureProxy> proxy,
                                    GrTextureStripAtlas* atlas, int row, unsigned flags)
         : INHERITED(kNone_OptimizationFlags)  // Not bothering with table-specific optimizations.
-        , fTextureSampler(context->textureProvider(), std::move(proxy))
+        , fTextureSampler(context->resourceProvider(), std::move(proxy))
         , fAtlas(atlas)
         , fRow(row) {
     this->initClassID<ColorTableEffect>();
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index 32189c5..bba9f85 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -1702,7 +1702,7 @@
                 fCoordTransform.reset(args.fContext, *args.fMatrix,
                                       fAtlas->asTextureProxyRef().get(),
                                       params.filterMode(), false);
-                fTextureSampler.reset(args.fContext->textureProvider(),
+                fTextureSampler.reset(args.fContext->resourceProvider(),
                                       fAtlas->asTextureProxyRef(), params);
             } else {
                 // In this instance we know the params are:
@@ -1719,7 +1719,7 @@
                 // This is 2/2 places where auto-normalization is disabled
                 fCoordTransform.reset(args.fContext, *args.fMatrix,
                                       proxy.get(), params.filterMode(), false);
-                fTextureSampler.reset(args.fContext->textureProvider(),
+                fTextureSampler.reset(args.fContext->resourceProvider(),
                                       std::move(proxy), params);
                 fYCoord = SK_ScalarHalf;
             }
diff --git a/src/effects/shadows/SkAmbientShadowMaskFilter.cpp b/src/effects/shadows/SkAmbientShadowMaskFilter.cpp
index b6f5392..561d77d 100644
--- a/src/effects/shadows/SkAmbientShadowMaskFilter.cpp
+++ b/src/effects/shadows/SkAmbientShadowMaskFilter.cpp
@@ -34,7 +34,7 @@
                           const SkIRect& clipBounds,
                           const SkMatrix& ctm,
                           SkRect* maskRect) const override;
-    bool directFilterMaskGPU(GrTextureProvider* texProvider,
+    bool directFilterMaskGPU(GrResourceProvider* resourceProvider,
                              GrRenderTargetContext* drawContext,
                              GrPaint&&,
                              const GrClip&,
@@ -139,7 +139,7 @@
 static const float kHeightFactor = 1.0f / 128.0f;
 static const float kGeomFactor = 64.0f;
 
-bool SkAmbientShadowMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
+bool SkAmbientShadowMaskFilterImpl::directFilterMaskGPU(GrResourceProvider* resourceProvider,
                                                         GrRenderTargetContext* rtContext,
                                                         GrPaint&& paint,
                                                         const GrClip& clip,
diff --git a/src/effects/shadows/SkSpotShadowMaskFilter.cpp b/src/effects/shadows/SkSpotShadowMaskFilter.cpp
index 99a03db..0a97320 100644
--- a/src/effects/shadows/SkSpotShadowMaskFilter.cpp
+++ b/src/effects/shadows/SkSpotShadowMaskFilter.cpp
@@ -35,7 +35,7 @@
                           const SkIRect& clipBounds,
                           const SkMatrix& ctm,
                           SkRect* maskRect) const override;
-    bool directFilterMaskGPU(GrTextureProvider* texProvider,
+    bool directFilterMaskGPU(GrResourceProvider* resourceProvider,
                              GrRenderTargetContext* drawContext,
                              GrPaint&&,
                              const GrClip&,
@@ -156,7 +156,7 @@
     return true;
 }
 
-bool SkSpotShadowMaskFilterImpl::directFilterMaskGPU(GrTextureProvider* texProvider,
+bool SkSpotShadowMaskFilterImpl::directFilterMaskGPU(GrResourceProvider* resourceProvider,
                                                      GrRenderTargetContext* rtContext,
                                                      GrPaint&& paint,
                                                      const GrClip& clip,
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp
index cff052f..24cb05f 100644
--- a/src/gpu/GrBitmapTextureMaker.cpp
+++ b/src/gpu/GrBitmapTextureMaker.cpp
@@ -9,7 +9,7 @@
 
 #include "GrContext.h"
 #include "GrGpuResourcePriv.h"
-#include "GrTextureProvider.h"
+#include "GrResourceProvider.h"
 #include "SkBitmap.h"
 #include "SkGrPriv.h"
 #include "SkPixelRef.h"
@@ -32,7 +32,7 @@
     GrTexture* tex = nullptr;
 
     if (fOriginalKey.isValid()) {
-        tex = this->context()->textureProvider()->findAndRefTextureByUniqueKey(fOriginalKey);
+        tex = this->context()->resourceProvider()->findAndRefTextureByUniqueKey(fOriginalKey);
         if (tex) {
             return tex;
         }
@@ -44,7 +44,7 @@
         tex = GrUploadBitmapToTexture(this->context(), fBitmap);
     }
     if (tex && fOriginalKey.isValid()) {
-        this->context()->textureProvider()->assignUniqueKeyToTexture(fOriginalKey, tex);
+        this->context()->resourceProvider()->assignUniqueKeyToTexture(fOriginalKey, tex);
         GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef());
     }
     return tex;
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 091d776..6716fde 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -12,11 +12,11 @@
 #include "GrContextPriv.h"
 #include "GrFixedClip.h"
 #include "GrRenderTargetContextPriv.h"
+#include "GrResourceProvider.h"
 #include "effects/GrSimpleTextureEffect.h"
 #include "GrStyle.h"
 #include "GrTexture.h"
 #include "GrTextureProxy.h"
-#include "GrTextureProvider.h"
 #include "SkDraw.h"
 #include "SkGrPriv.h"
 #include "SkMaskFilter.h"
@@ -207,7 +207,7 @@
             return;
         }
 
-        if (maskFilter->directFilterMaskGPU(context->textureProvider(),
+        if (maskFilter->directFilterMaskGPU(context->resourceProvider(),
                                             renderTargetContext,
                                             std::move(paint),
                                             clip,
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index c69f79e..a0682f4 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -413,11 +413,11 @@
 // MDB TODO (caching): this side-steps the issue of texture proxies cached by unique ID
 sk_sp<GrTextureProxy> GrClipStackClip::createAlphaClipMask(GrContext* context,
                                                            const GrReducedClip& reducedClip) const {
-    GrTextureProvider* texProvider = context->textureProvider();
+    GrResourceProvider* resourceProvider = context->resourceProvider();
     GrUniqueKey key;
     create_clip_mask_key(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
 
-    sk_sp<GrTexture> texture(texProvider->findAndRefTextureByUniqueKey(key));
+    sk_sp<GrTexture> texture(resourceProvider->findAndRefTextureByUniqueKey(key));
     if (texture) {
         return GrSurfaceProxy::MakeWrapped(std::move(texture));
     }
@@ -441,12 +441,12 @@
         return nullptr;
     }
 
-    GrTexture* tex = result->instantiate(context->textureProvider());
+    GrTexture* tex = result->instantiate(context->resourceProvider());
     if (!tex) {
         return nullptr;
     }
 
-    context->textureProvider()->assignUniqueKeyToTexture(key, tex);
+    context->resourceProvider()->assignUniqueKeyToTexture(key, tex);
     add_invalidate_on_pop_message(*fStack, reducedClip.elementsGenID(), key);
 
     return result;
@@ -459,7 +459,7 @@
     GrUniqueKey key;
     create_clip_mask_key(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
 
-    sk_sp<GrTexture> texture(context->textureProvider()->findAndRefTextureByUniqueKey(key));
+    sk_sp<GrTexture> texture(context->resourceProvider()->findAndRefTextureByUniqueKey(key));
     if (texture) {
         return GrSurfaceProxy::MakeWrapped(std::move(texture));
     }
@@ -517,12 +517,12 @@
 
     sk_sp<GrTextureProxy> result(helper.toTexture(context, SkBackingFit::kApprox));
 
-    GrTexture* tex = result->instantiate(context->textureProvider());
+    GrTexture* tex = result->instantiate(context->resourceProvider());
     if (!tex) {
         return nullptr;
     }
 
-    context->textureProvider()->assignUniqueKeyToTexture(key, tex);
+    context->resourceProvider()->assignUniqueKeyToTexture(key, tex);
     add_invalidate_on_pop_message(*fStack, reducedClip.elementsGenID(), key);
     return result;
 }
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index cc7cba0..49b8c96 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -295,7 +295,7 @@
 
     sk_sp<GrTextureProxy> tempProxy;
     if (GrGpu::kNoDraw_DrawPreference != drawPreference) {
-        tempProxy = GrSurfaceProxy::MakeDeferred(this->textureProvider(),
+        tempProxy = GrSurfaceProxy::MakeDeferred(this->resourceProvider(),
                                                  *this->caps(),
                                                  tempDrawInfo.fTempSurfaceDesc,
                                                  SkBackingFit::kApprox,
@@ -329,7 +329,7 @@
                     return false;
                 }
             }
-            GrTexture* texture = tempProxy->instantiate(this->textureProvider());
+            GrTexture* texture = tempProxy->instantiate(this->resourceProvider());
             if (!texture) {
                 return false;
             }
@@ -621,7 +621,7 @@
                                                                   SkBackingFit fit,
                                                                   SkBudgeted isDstBudgeted) {
 
-    sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(fContext->textureProvider(),
+    sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(fContext->resourceProvider(),
                                                                *fContext->caps(), dstDesc,
                                                                fit, isDstBudgeted);
     if (!proxy) {
@@ -636,7 +636,7 @@
                                                                  GrWrapOwnership ownership) {
     ASSERT_SINGLE_OWNER_PRIV
 
-    sk_sp<GrSurface> surface(fContext->textureProvider()->wrapBackendTexture(desc, ownership));
+    sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTexture(desc, ownership));
     if (!surface) {
         return nullptr;
     }
@@ -657,7 +657,7 @@
     ASSERT_SINGLE_OWNER_PRIV
     SkASSERT(desc.fFlags & kRenderTarget_GrBackendTextureFlag);
 
-    sk_sp<GrSurface> surface(fContext->textureProvider()->wrapBackendTexture(desc, ownership));
+    sk_sp<GrSurface> surface(fContext->resourceProvider()->wrapBackendTexture(desc, ownership));
     if (!surface) {
         return nullptr;
     }
@@ -677,7 +677,7 @@
                                                 const SkSurfaceProps* surfaceProps) {
     ASSERT_SINGLE_OWNER_PRIV
 
-    sk_sp<GrRenderTarget> rt(fContext->textureProvider()->wrapBackendRenderTarget(desc));
+    sk_sp<GrRenderTarget> rt(fContext->resourceProvider()->wrapBackendRenderTarget(desc));
     if (!rt) {
         return nullptr;
     }
@@ -786,9 +786,9 @@
 
     sk_sp<GrTexture> tex;
     if (SkBackingFit::kExact == fit) {
-        tex.reset(this->textureProvider()->createTexture(desc, budgeted));
+        tex.reset(this->resourceProvider()->createTexture(desc, budgeted));
     } else {
-        tex.reset(this->textureProvider()->createApproxTexture(desc));
+        tex.reset(this->resourceProvider()->createApproxTexture(desc, 0));
     }
     if (!tex) {
         return nullptr;
@@ -821,7 +821,7 @@
     desc.fConfig = config;
     desc.fSampleCnt = sampleCnt;
 
-    sk_sp<GrTextureProxy> rtp = GrSurfaceProxy::MakeDeferred(this->textureProvider(),
+    sk_sp<GrTextureProxy> rtp = GrSurfaceProxy::MakeDeferred(this->resourceProvider(),
                                                              *this->caps(), desc, fit, budgeted);
     if (!rtp) {
         return nullptr;
diff --git a/src/gpu/GrCoordTransform.cpp b/src/gpu/GrCoordTransform.cpp
index 99b3a09..95f30c0 100644
--- a/src/gpu/GrCoordTransform.cpp
+++ b/src/gpu/GrCoordTransform.cpp
@@ -77,7 +77,7 @@
     // MDB TODO: just GrCaps is needed for this method
     // MDB TODO: once all the coord transforms take a proxy just store it here and
     // instantiate later
-    fTexture = proxy->instantiate(context->textureProvider());
+    fTexture = proxy->instantiate(context->resourceProvider());
     fNormalize = normalize;
     fReverseY = kBottomLeft_GrSurfaceOrigin == proxy->origin();
 
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index e9fd356..143bdd8 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -28,7 +28,7 @@
     // guarantee we do not recieve a texture with pending IO
     // TODO: Determine how to avoid having to do this. (https://bug.skia.org/4156)
     static const uint32_t kFlags = GrResourceProvider::kNoPendingIO_Flag;
-    sk_sp<GrTexture> texture(ctx->textureProvider()->createApproxTexture(desc, kFlags));
+    sk_sp<GrTexture> texture(ctx->resourceProvider()->createApproxTexture(desc, kFlags));
     if (!texture) {
         return nullptr;
     }
@@ -210,7 +210,7 @@
 
         // MDB TODO: this is currently fine since the atlas' proxy is always pre-instantiated.
         // Once it is deferred more care must be taken upon instantiation failure.
-        GrTexture* texture = fProxy->instantiate(fContext->textureProvider());
+        GrTexture* texture = fProxy->instantiate(fContext->resourceProvider());
         if (!texture) {
             return false;
         }
@@ -289,7 +289,7 @@
     sk_sp<Plot> plotsp(SkRef(newPlot.get()));
     // MDB TODO: this is currently fine since the atlas' proxy is always pre-instantiated.
     // Once it is deferred more care must be taken upon instantiation failure.
-    GrTexture* texture = fProxy->instantiate(fContext->textureProvider());
+    GrTexture* texture = fProxy->instantiate(fContext->resourceProvider());
     if (!texture) {
         return false;
     }
diff --git a/src/gpu/GrDrawingManager.cpp b/src/gpu/GrDrawingManager.cpp
index 3a7110e..d670e16 100644
--- a/src/gpu/GrDrawingManager.cpp
+++ b/src/gpu/GrDrawingManager.cpp
@@ -219,7 +219,7 @@
     if (!pr && allowSW) {
         if (!fSoftwarePathRenderer) {
             fSoftwarePathRenderer =
-                    new GrSoftwarePathRenderer(fContext->textureProvider(),
+                    new GrSoftwarePathRenderer(fContext->resourceProvider(),
                                                fOptionsForPathRendererChain.fAllowPathMaskCaching);
         }
         if (fSoftwarePathRenderer->canDrawPath(args)) {
@@ -256,7 +256,7 @@
     if (useDIF && fContext->caps()->shaderCaps()->pathRenderingSupport() &&
         rtp->isStencilBufferMultisampled()) {
         // TODO: defer stencil buffer attachment for PathRenderingDrawContext
-        sk_sp<GrRenderTarget> rt(sk_ref_sp(rtp->instantiate(fContext->textureProvider())));
+        sk_sp<GrRenderTarget> rt(sk_ref_sp(rtp->instantiate(fContext->resourceProvider())));
         if (!rt) {
             return nullptr;
         }
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 201b22c..3abe8f8 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -122,17 +122,17 @@
     }
 
     /**
-     * Implements GrTextureProvider::wrapBackendTexture
+     * Implements GrResourceProvider::wrapBackendTexture
      */
     sk_sp<GrTexture> wrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership);
 
     /**
-     * Implements GrTextureProvider::wrapBackendRenderTarget
+     * Implements GrResourceProvider::wrapBackendRenderTarget
      */
     sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc&,GrWrapOwnership);
 
     /**
-     * Implements GrTextureProvider::wrapBackendTextureAsRenderTarget
+     * Implements GrResourceProvider::wrapBackendTextureAsRenderTarget
      */
     sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&);
 
@@ -480,14 +480,14 @@
 
     // Determines whether a texture will need to be rescaled in order to be used with the
     // GrSamplerParams. This variation is called when the caller will create a new texture using the
-    // texture provider from a non-texture src (cpu-backed image, ...).
+    // resource provider from a non-texture src (cpu-backed image, ...).
     bool makeCopyForTextureParams(int width, int height, const GrSamplerParams&,
                                  GrTextureProducer::CopyParams*, SkScalar scaleAdjust[2]) const;
 
     // Like the above but this variation should be called when the caller is not creating the
     // original texture but rather was handed the original texture. It adds additional checks
     // relevant to original textures that were created external to Skia via
-    // GrTextureProvider::wrap methods.
+    // GrResourceProvider::wrap methods.
     bool makeCopyForTextureParams(GrTexture* texture, const GrSamplerParams& params,
                                   GrTextureProducer::CopyParams* copyParams,
                                   SkScalar scaleAdjust[2]) const {
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 8214d2c..2365c21 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -208,18 +208,18 @@
     this->reset(texture, filterMode, tileXAndY, visibility);
 }
 
-GrProcessor::TextureSampler::TextureSampler(GrTextureProvider* texProvider,
+GrProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider,
                                             sk_sp<GrTextureProxy> proxy,
                                             const GrSamplerParams& params) {
-    this->reset(texProvider, std::move(proxy), params);
+    this->reset(resourceProvider, std::move(proxy), params);
 }
 
-GrProcessor::TextureSampler::TextureSampler(GrTextureProvider* texProvider,
+GrProcessor::TextureSampler::TextureSampler(GrResourceProvider* resourceProvider,
                                             sk_sp<GrTextureProxy> proxy,
                                             GrSamplerParams::FilterMode filterMode,
                                             SkShader::TileMode tileXAndY,
                                             GrShaderFlags visibility) {
-    this->reset(texProvider, std::move(proxy), filterMode, tileXAndY, visibility);
+    this->reset(resourceProvider, std::move(proxy), filterMode, tileXAndY, visibility);
 }
 
 void GrProcessor::TextureSampler::reset(GrTexture* texture,
@@ -243,13 +243,13 @@
     fVisibility = visibility;
 }
 
-void GrProcessor::TextureSampler::reset(GrTextureProvider* texProvider,
+void GrProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider,
                                         sk_sp<GrTextureProxy> proxy,
                                         const GrSamplerParams& params,
                                         GrShaderFlags visibility) {
     // For now, end the deferral at this time. Once all the TextureSamplers are swapped over
     // to taking a GrSurfaceProxy just use the IORefs on the proxy
-    GrTexture* texture = proxy->instantiate(texProvider);
+    GrTexture* texture = proxy->instantiate(resourceProvider);
     SkASSERT(texture);
     fTexture.set(SkRef(texture), kRead_GrIOType);
     fParams = params;
@@ -257,14 +257,14 @@
     fVisibility = visibility;
 }
 
-void GrProcessor::TextureSampler::reset(GrTextureProvider* texProvider,
+void GrProcessor::TextureSampler::reset(GrResourceProvider* resourceProvider,
                                         sk_sp<GrTextureProxy> proxy,
                                         GrSamplerParams::FilterMode filterMode,
                                         SkShader::TileMode tileXAndY,
                                         GrShaderFlags visibility) {
     // For now, end the deferral at this time. Once all the TextureSamplers are swapped over
     // to taking a GrSurfaceProxy just use the IORefs on the proxy
-    GrTexture* texture = proxy->instantiate(texProvider);
+    GrTexture* texture = proxy->instantiate(resourceProvider);
     SkASSERT(texture);
     fTexture.set(SkRef(texture), kRead_GrIOType);
     filterMode = SkTMin(filterMode, texture->texturePriv().highestFilterMode());
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 8b6de51..1ddf8df 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -112,7 +112,7 @@
 }
 
 GrRenderTarget* GrRenderTargetContext::instantiate() {
-    return fRenderTargetProxy->instantiate(fContext->textureProvider());
+    return fRenderTargetProxy->instantiate(fContext->resourceProvider());
 }
 
 GrTextureProxy* GrRenderTargetContext::asTextureProxy() {
@@ -144,14 +144,14 @@
     GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrRenderTargetContext::copy");
 
     // TODO: defer instantiation until flush time
-    sk_sp<GrSurface> src(sk_ref_sp(srcProxy->instantiate(fContext->textureProvider())));
+    sk_sp<GrSurface> src(sk_ref_sp(srcProxy->instantiate(fContext->resourceProvider())));
     if (!src) {
         return false;
     }
 
     // TODO: This needs to be fixed up since it ends the deferral of the GrRenderTarget.
     sk_sp<GrRenderTarget> rt(
-                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->textureProvider())));
+                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->resourceProvider())));
     if (!rt) {
         return false;
     }
@@ -175,7 +175,7 @@
 
     // Deferral of the VRAM resources must end in this instance anyway
     sk_sp<GrRenderTarget> rt(
-                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->textureProvider())));
+                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->resourceProvider())));
     if (!rt) {
         return false;
     }
@@ -198,7 +198,7 @@
 
     // Deferral of the VRAM resources must end in this instance anyway
     sk_sp<GrRenderTarget> rt(
-                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->textureProvider())));
+                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->resourceProvider())));
     if (!rt) {
         return false;
     }
@@ -261,7 +261,7 @@
 
     // TODO: This needs to be fixed up since it ends the deferral of the GrRenderTarget.
     sk_sp<GrRenderTarget> rt(
-                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->textureProvider())));
+                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->resourceProvider())));
     if (!rt) {
         return;
     }
@@ -1313,7 +1313,7 @@
 
     // Deferral of the VRAM resources must end in this instance anyway
     sk_sp<GrRenderTarget> rt(
-                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->textureProvider())));
+                        sk_ref_sp(fRenderTargetProxy->instantiate(fContext->resourceProvider())));
     if (!rt) {
         return;
     }
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 34d67be..44f23d4 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -11,7 +11,7 @@
 #include "GrGpuResourcePriv.h"
 #include "GrRenderTargetOpList.h"
 #include "GrRenderTargetPriv.h"
-#include "GrTextureProvider.h"
+#include "GrResourceProvider.h"
 #include "GrTextureRenderTargetProxy.h"
 
 // Deferred version
@@ -43,10 +43,10 @@
                    : 0;
 }
 
-GrRenderTarget* GrRenderTargetProxy::instantiate(GrTextureProvider* texProvider) {
+GrRenderTarget* GrRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider) {
     SkASSERT(fDesc.fFlags & GrSurfaceFlags::kRenderTarget_GrSurfaceFlag);
 
-    GrSurface* surf = INHERITED::instantiate(texProvider);
+    GrSurface* surf = INHERITED::instantiate(resourceProvider);
     if (!surf || !surf->asRenderTarget()) {
         return nullptr;
     }
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 272c6a6..636f16c 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -16,16 +16,198 @@
 #include "GrResourceCache.h"
 #include "GrResourceKey.h"
 #include "GrStencilAttachment.h"
+#include "GrTexturePriv.h"
+#include "../private/GrSingleOwner.h"
 #include "SkMathPriv.h"
 
 GR_DECLARE_STATIC_UNIQUE_KEY(gQuadIndexBufferKey);
 
+const int GrResourceProvider::kMinScratchTextureSize = 16;
+
+#define ASSERT_SINGLE_OWNER \
+    SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
+
 GrResourceProvider::GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* owner)
-    : INHERITED(gpu, cache, owner) {
+        : fCache(cache)
+        , fGpu(gpu)
+#ifdef SK_DEBUG
+        , fSingleOwner(owner)
+#endif
+        {
     GR_DEFINE_STATIC_UNIQUE_KEY(gQuadIndexBufferKey);
     fQuadIndexBufferKey = gQuadIndexBufferKey;
 }
 
+
+GrTexture* GrResourceProvider::createMipMappedTexture(const GrSurfaceDesc& desc,
+                                                      SkBudgeted budgeted, const GrMipLevel* texels,
+                                                      int mipLevelCount, uint32_t flags) {
+    ASSERT_SINGLE_OWNER
+
+    if (this->isAbandoned()) {
+        return nullptr;
+    }
+    if (mipLevelCount && !texels) {
+        return nullptr;
+    }
+    for (int i = 0; i < mipLevelCount; ++i) {
+        if (!texels[i].fPixels) {
+            return nullptr;
+        }
+    }
+    if (mipLevelCount > 1 && GrPixelConfigIsSint(desc.fConfig)) {
+        return nullptr;
+    }
+    if ((desc.fFlags & kRenderTarget_GrSurfaceFlag) &&
+        !fGpu->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
+        return nullptr;
+    }
+    if (!GrPixelConfigIsCompressed(desc.fConfig)) {
+        if (mipLevelCount < 2) {
+            flags |= kExact_Flag | kNoCreate_Flag;
+            if (GrTexture* texture = this->refScratchTexture(desc, flags)) {
+                if (!mipLevelCount ||
+                    texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
+                                         texels[0].fPixels, texels[0].fRowBytes)) {
+                    if (SkBudgeted::kNo == budgeted) {
+                        texture->resourcePriv().makeUnbudgeted();
+                    }
+                    return texture;
+                }
+                texture->unref();
+            }
+        }
+    }
+
+    SkTArray<GrMipLevel> texelsShallowCopy(mipLevelCount);
+    for (int i = 0; i < mipLevelCount; ++i) {
+        texelsShallowCopy.push_back(texels[i]);
+    }
+    return fGpu->createTexture(desc, budgeted, texelsShallowCopy);
+}
+
+GrTexture* GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
+                                             const void* srcData, size_t rowBytes, uint32_t flags) {
+    GrMipLevel tempTexels;
+    GrMipLevel* texels = nullptr;
+    int levelCount = 0;
+    if (srcData) {
+        tempTexels.fPixels = srcData;
+        tempTexels.fRowBytes = rowBytes;
+        texels = &tempTexels;
+        levelCount = 1;
+    }
+    return this->createMipMappedTexture(desc, budgeted, texels, levelCount, flags);
+}
+
+GrTexture* GrResourceProvider::createApproxTexture(const GrSurfaceDesc& desc, uint32_t flags) {
+    ASSERT_SINGLE_OWNER
+    SkASSERT(0 == flags || kNoPendingIO_Flag == flags);
+    return this->internalCreateApproxTexture(desc, flags);
+}
+
+GrTexture* GrResourceProvider::internalCreateApproxTexture(const GrSurfaceDesc& desc,
+                                                           uint32_t scratchFlags) {
+    ASSERT_SINGLE_OWNER
+    if (this->isAbandoned()) {
+        return nullptr;
+    }
+    // Currently we don't recycle compressed textures as scratch.
+    if (GrPixelConfigIsCompressed(desc.fConfig)) {
+        return nullptr;
+    } else {
+        return this->refScratchTexture(desc, scratchFlags);
+    }
+}
+
+GrTexture* GrResourceProvider::refScratchTexture(const GrSurfaceDesc& inDesc,
+                                                 uint32_t flags) {
+    ASSERT_SINGLE_OWNER
+    SkASSERT(!this->isAbandoned());
+    SkASSERT(!GrPixelConfigIsCompressed(inDesc.fConfig));
+
+    SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);
+
+    if (fGpu->caps()->reuseScratchTextures() || (desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
+        if (!(kExact_Flag & flags)) {
+            // bin by pow2 with a reasonable min
+            GrSurfaceDesc* wdesc = desc.writable();
+            wdesc->fWidth  = SkTMax(kMinScratchTextureSize, GrNextPow2(desc->fWidth));
+            wdesc->fHeight = SkTMax(kMinScratchTextureSize, GrNextPow2(desc->fHeight));
+        }
+
+        GrScratchKey key;
+        GrTexturePriv::ComputeScratchKey(*desc, &key);
+        uint32_t scratchFlags = 0;
+        if (kNoPendingIO_Flag & flags) {
+            scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag;
+        } else  if (!(desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
+            // If it is not a render target then it will most likely be populated by
+            // writePixels() which will trigger a flush if the texture has pending IO.
+            scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag;
+        }
+        GrGpuResource* resource = fCache->findAndRefScratchResource(key,
+                                                                   GrSurface::WorstCaseSize(*desc),
+                                                                   scratchFlags);
+        if (resource) {
+            GrSurface* surface = static_cast<GrSurface*>(resource);
+            GrRenderTarget* rt = surface->asRenderTarget();
+            if (rt && fGpu->caps()->discardRenderTargetSupport()) {
+                rt->discard();
+            }
+            return surface->asTexture();
+        }
+    }
+
+    if (!(kNoCreate_Flag & flags)) {
+        return fGpu->createTexture(*desc, SkBudgeted::kYes);
+    }
+
+    return nullptr;
+}
+
+sk_sp<GrTexture> GrResourceProvider::wrapBackendTexture(const GrBackendTextureDesc& desc,
+                                                        GrWrapOwnership ownership) {
+    ASSERT_SINGLE_OWNER
+    if (this->isAbandoned()) {
+        return nullptr;
+    }
+    return fGpu->wrapBackendTexture(desc, ownership);
+}
+
+sk_sp<GrRenderTarget> GrResourceProvider::wrapBackendRenderTarget(
+        const GrBackendRenderTargetDesc& desc)
+{
+    ASSERT_SINGLE_OWNER
+    return this->isAbandoned() ? nullptr
+                               : fGpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership);
+}
+
+void GrResourceProvider::assignUniqueKeyToResource(const GrUniqueKey& key,
+                                                   GrGpuResource* resource) {
+    ASSERT_SINGLE_OWNER
+    if (this->isAbandoned() || !resource) {
+        return;
+    }
+    resource->resourcePriv().setUniqueKey(key);
+}
+
+GrGpuResource* GrResourceProvider::findAndRefResourceByUniqueKey(const GrUniqueKey& key) {
+    ASSERT_SINGLE_OWNER
+    return this->isAbandoned() ? nullptr : fCache->findAndRefUniqueResource(key);
+}
+
+GrTexture* GrResourceProvider::findAndRefTextureByUniqueKey(const GrUniqueKey& key) {
+    ASSERT_SINGLE_OWNER
+    GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key);
+    if (resource) {
+        GrTexture* texture = static_cast<GrSurface*>(resource)->asTexture();
+        SkASSERT(texture);
+        return texture;
+    }
+    return NULL;
+}
+
 const GrBuffer* GrResourceProvider::createInstancedIndexBuffer(const uint16_t* pattern,
                                                                int patternSize,
                                                                int reps,
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index c0d1a50..5ecaac3 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -9,12 +9,9 @@
 #define GrResourceProvider_DEFINED
 
 #include "GrBuffer.h"
-#include "GrDrawOpAtlas.h"
 #include "GrGpu.h"
 #include "GrPathRange.h"
-#include "GrTextureProvider.h"
 
-class GrDrawOpAtlas;
 class GrPath;
 class GrRenderTarget;
 class GrSingleOwner;
@@ -25,15 +22,12 @@
 class SkTypeface;
 
 /**
- * An extension of the texture provider for arbitrary resource types. This class is intended for
- * use within the Gr code base, not by clients or extensions (e.g. third party GrProcessor
- * derivatives).
+ * A factory for arbitrary resource types. This class is intended for use within the Gr code base.
  *
- * This currently inherits from GrTextureProvider non-publically to force callers to provider
- * make a flags (pendingIO) decision and not use the GrTP methods that don't take flags. This
- * can be relaxed once https://bug.skia.org/4156 is fixed.
+ * Some members force callers to make a flags (pendingIO) decision. This can be relaxed once
+ * https://bug.skia.org/4156 is fixed.
  */
-class GrResourceProvider : protected GrTextureProvider {
+class GrResourceProvider {
 public:
     GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* owner);
 
@@ -41,6 +35,85 @@
         return static_cast<T*>(this->findAndRefResourceByUniqueKey(key));
     }
 
+    ///////////////////////////////////////////////////////////////////////////
+    // Textures
+
+    /**
+     * Creates a new texture in the resource cache and returns it. The caller owns a
+     * ref on the returned texture which must be balanced by a call to unref.
+     *
+     * @param desc          Description of the texture properties.
+     * @param budgeted      Does the texture count against the resource cache budget?
+     * @param texels        A contiguous array of mipmap levels
+     * @param mipLevelCount The amount of elements in the texels array
+     */
+    GrTexture* createMipMappedTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
+                                      const GrMipLevel* texels, int mipLevelCount,
+                                      uint32_t flags = 0);
+
+    /**
+     * This function is a shim which creates a SkTArray<GrMipLevel> of size 1.
+     * It then calls createTexture with that SkTArray.
+     *
+     * @param srcData   Pointer to the pixel values (optional).
+     * @param rowBytes  The number of bytes between rows of the texture. Zero
+     *                  implies tightly packed rows. For compressed pixel configs, this
+     *                  field is ignored.
+     */
+    GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, const void* srcData,
+                             size_t rowBytes, uint32_t flags = 0);
+
+    /** Shortcut for creating a texture with no initial data to upload. */
+    GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, uint32_t flags = 0) {
+        return this->createTexture(desc, budgeted, nullptr, 0, flags);
+    }
+
+    /** Assigns a unique key to the texture. The texture will be findable via this key using
+    findTextureByUniqueKey(). If an existing texture has this key, it's key will be removed. */
+    void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) {
+        SkASSERT(key.isValid());
+        this->assignUniqueKeyToResource(key, texture);
+    }
+
+    /** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */
+    GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key);
+
+    /**
+     * Finds a texture that approximately matches the descriptor. Will be at least as large in width
+     * and height as desc specifies. If desc specifies that the texture should be a render target
+     * then result will be a render target. Format and sample count will always match the request.
+     * The contents of the texture are undefined. The caller owns a ref on the returned texture and
+     * must balance with a call to unref.
+     */
+    GrTexture* createApproxTexture(const GrSurfaceDesc&, uint32_t flags);
+
+    ///////////////////////////////////////////////////////////////////////////
+    // Wrapped Backend Surfaces
+
+    /**
+     * Wraps an existing texture with a GrTexture object.
+     *
+     * OpenGL: if the object is a texture Gr may change its GL texture params
+     *         when it is drawn.
+     *
+     * @return GrTexture object or NULL on failure.
+     */
+    sk_sp<GrTexture> wrapBackendTexture(const GrBackendTextureDesc& desc,
+                                        GrWrapOwnership = kBorrow_GrWrapOwnership);
+
+    /**
+     * Wraps an existing render target with a GrRenderTarget object. It is
+     * similar to wrapBackendTexture but can be used to draw into surfaces
+     * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that
+     * the client will resolve to a texture). Currently wrapped render targets
+     * always use the kBorrow_GrWrapOwnership semantics.
+     *
+     * @return GrRenderTarget object or NULL on failure.
+     */
+    sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
+
+    static const int kMinScratchTextureSize;
+
     /**
      * Either finds and refs, or creates an index buffer for instanced drawing with a specific
      * pattern if the index buffer is not found. If the return is non-null, the caller owns
@@ -89,26 +162,24 @@
     GrPathRange* createGlyphs(const SkTypeface*, const SkScalerContextEffects&,
                               const SkDescriptor*, const GrStyle&);
 
-    using GrTextureProvider::createTexture;
-    using GrTextureProvider::assignUniqueKeyToResource;
-    using GrTextureProvider::findAndRefResourceByUniqueKey;
-    using GrTextureProvider::findAndRefTextureByUniqueKey;
-    using GrTextureProvider::abandon;
-
-    /** These flags alias/extend GrTextureProvider::ScratchTextureFlags */
+    /** These flags govern which scratch resources we are allowed to return */
     enum Flags {
+        kExact_Flag           = 0x1,
+
         /** If the caller intends to do direct reads/writes to/from the CPU then this flag must be
          *  set when accessing resources during a GrOpList flush. This includes the execution of
          *  GrOp objects. The reason is that these memory operations are done immediately and
          *  will occur out of order WRT the operations being flushed.
          *  Make this automatic: https://bug.skia.org/4156
          */
-        kNoPendingIO_Flag = GrTextureProvider::kNoPendingIO_ScratchTextureFlag,
+        kNoPendingIO_Flag     = 0x2,
+
+        kNoCreate_Flag        = 0x4,
 
         /** Normally the caps may indicate a preference for client-side buffers. Set this flag when
          *  creating a buffer to guarantee it resides in GPU memory.
          */
-        kRequireGpuMemory_Flag = GrTextureProvider::kLastScratchTextureFlag << 1,
+        kRequireGpuMemory_Flag = 0x8,
     };
 
     /**
@@ -125,10 +196,6 @@
     GrBuffer* createBuffer(size_t size, GrBufferType intendedType, GrAccessPattern, uint32_t flags,
                            const void* data = nullptr);
 
-    GrTexture* createApproxTexture(const GrSurfaceDesc& desc, uint32_t flags) {
-        SkASSERT(0 == flags || kNoPendingIO_Flag == flags);
-        return this->internalCreateApproxTexture(desc, flags);
-    }
 
     /**
      * If passed in render target already has a stencil buffer, return it. Otherwise attempt to
@@ -136,9 +203,6 @@
      */
     GrStencilAttachment* attachStencilAttachment(GrRenderTarget* rt);
 
-    GrContext* context() { return this->gpu()->getContext(); }
-    const GrCaps* caps() { return this->gpu()->caps(); }
-
      /**
       * Wraps an existing texture with a GrRenderTarget object. This is useful when the provided
       * texture has a format that cannot be textured from by Skia, but we want to raster to it.
@@ -150,7 +214,40 @@
       */
      sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc);
 
+    /**
+     * Assigns a unique key to a resource. If the key is associated with another resource that
+     * association is removed and replaced by this resource.
+     */
+    void assignUniqueKeyToResource(const GrUniqueKey&, GrGpuResource*);
+
+    /**
+     * Finds a resource in the cache, based on the specified key. This is intended for use in
+     * conjunction with addResourceToCache(). The return value will be NULL if not found. The
+     * caller must balance with a call to unref().
+     */
+    GrGpuResource* findAndRefResourceByUniqueKey(const GrUniqueKey&);
+
+    void abandon() {
+        fCache = NULL;
+        fGpu = NULL;
+    }
+
 private:
+    GrTexture* internalCreateApproxTexture(const GrSurfaceDesc& desc, uint32_t scratchTextureFlags);
+
+    GrTexture* refScratchTexture(const GrSurfaceDesc&, uint32_t scratchTextureFlags);
+
+    GrResourceCache* cache() { return fCache; }
+    const GrResourceCache* cache() const { return fCache; }
+
+    GrGpu* gpu() { return fGpu; }
+    const GrGpu* gpu() const { return fGpu; }
+
+    bool isAbandoned() const {
+        SkASSERT(SkToBool(fGpu) == SkToBool(fCache));
+        return !SkToBool(fCache);
+    }
+
     const GrBuffer* createInstancedIndexBuffer(const uint16_t* pattern,
                                                int patternSize,
                                                int reps,
@@ -159,9 +256,12 @@
 
     const GrBuffer* createQuadIndexBuffer();
 
+    GrResourceCache* fCache;
+    GrGpu* fGpu;
     GrUniqueKey fQuadIndexBufferKey;
 
-    typedef GrTextureProvider INHERITED;
+    // In debug builds we guard against improper thread handling
+    SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
 };
 
 #endif
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp
index 073aec4..f7e518b 100644
--- a/src/gpu/GrSWMaskHelper.cpp
+++ b/src/gpu/GrSWMaskHelper.cpp
@@ -151,7 +151,7 @@
         return nullptr;
     }
 
-    return sk_ref_sp(tProxy->instantiate(context->textureProvider()));
+    return sk_ref_sp(tProxy->instantiate(context->resourceProvider()));
 }
 
 void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture,
diff --git a/src/gpu/GrSWMaskHelper.h b/src/gpu/GrSWMaskHelper.h
index 89d8842..4c744fd 100644
--- a/src/gpu/GrSWMaskHelper.h
+++ b/src/gpu/GrSWMaskHelper.h
@@ -10,7 +10,6 @@
 
 #include "GrColor.h"
 #include "GrRenderTargetContext.h"
-#include "GrTextureProvider.h"
 #include "SkAutoPixmapStorage.h"
 #include "SkBitmap.h"
 #include "SkDraw.h"
@@ -22,7 +21,6 @@
 class GrClip;
 class GrPaint;
 class GrShape;
-class GrTextureProvider;
 class GrStyle;
 class GrTexture;
 struct GrUserStencilSettings;
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index b51ce63..eb5495c 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -10,16 +10,16 @@
 #include "GrClip.h"
 #include "GrGpuResourcePriv.h"
 #include "GrPipelineBuilder.h"
+#include "GrResourceProvider.h"
 #include "GrSWMaskHelper.h"
 #include "GrSurfaceContextPriv.h"
-#include "GrTextureProvider.h"
 #include "ops/GrRectOpFactory.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 bool GrSoftwarePathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
     // Pass on any style that applies. The caller will apply the style if a suitable renderer is
     // not found and try again with the new GrShape.
-    return !args.fShape->style().applies() && SkToBool(fTexProvider) &&
+    return !args.fShape->style().applies() && SkToBool(fResourceProvider) &&
            (args.fAAType == GrAAType::kCoverage || args.fAAType == GrAAType::kNone);
 }
 
@@ -129,7 +129,7 @@
 bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
     GR_AUDIT_TRAIL_AUTO_FRAME(args.fRenderTargetContext->auditTrail(),
                               "GrSoftwarePathRenderer::onDrawPath");
-    if (!fTexProvider) {
+    if (!fResourceProvider) {
         return false;
     }
 
@@ -206,7 +206,7 @@
 
     sk_sp<GrTexture> texture;
     if (useCache) {
-        texture.reset(fTexProvider->findAndRefTextureByUniqueKey(maskKey));
+        texture.reset(fResourceProvider->findAndRefTextureByUniqueKey(maskKey));
     }
     if (!texture) {
         SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
@@ -219,7 +219,7 @@
             return false;
         }
         if (useCache) {
-            fTexProvider->assignUniqueKeyToTexture(maskKey, texture.get());
+            fResourceProvider->assignUniqueKeyToTexture(maskKey, texture.get());
         }
     }
     if (inverseFilled) {
diff --git a/src/gpu/GrSoftwarePathRenderer.h b/src/gpu/GrSoftwarePathRenderer.h
index 7dec4be..c8d2f8b 100644
--- a/src/gpu/GrSoftwarePathRenderer.h
+++ b/src/gpu/GrSoftwarePathRenderer.h
@@ -10,7 +10,7 @@
 
 #include "GrPathRenderer.h"
 
-class GrTextureProvider;
+class GrResourceProvider;
 
 /**
  * This class uses the software side to render a path to an SkBitmap and
@@ -18,8 +18,8 @@
  */
 class GrSoftwarePathRenderer : public GrPathRenderer {
 public:
-    GrSoftwarePathRenderer(GrTextureProvider* texProvider, bool allowCaching)
-            : fTexProvider(texProvider)
+    GrSoftwarePathRenderer(GrResourceProvider* resourceProvider, bool allowCaching)
+            : fResourceProvider(resourceProvider)
             , fAllowCaching(allowCaching) {}
 private:
     static void DrawNonAARect(GrRenderTargetContext* renderTargetContext,
@@ -46,7 +46,7 @@
     bool onDrawPath(const DrawPathArgs&) override;
 
 private:
-    GrTextureProvider*     fTexProvider;
+    GrResourceProvider*    fResourceProvider;
     bool                   fAllowCaching;
 
     typedef GrPathRenderer INHERITED;
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index b8fc56d..f95c312 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -12,8 +12,8 @@
 #include "GrContextPriv.h"
 #include "GrGpuResourcePriv.h"
 #include "GrOpList.h"
+#include "GrResourceProvider.h"
 #include "GrSurfaceContext.h"
-#include "GrTextureProvider.h"
 #include "GrTextureRenderTargetProxy.h"
 
 #include "SkMathPriv.h"
@@ -36,15 +36,15 @@
     SkSafeUnref(fLastOpList);
 }
 
-GrSurface* GrSurfaceProxy::instantiate(GrTextureProvider* texProvider) {
+GrSurface* GrSurfaceProxy::instantiate(GrResourceProvider* resourceProvider) {
     if (fTarget) {
         return fTarget;
     }
 
     if (SkBackingFit::kApprox == fFit) {
-        fTarget = texProvider->createApproxTexture(fDesc, fFlags);
+        fTarget = resourceProvider->createApproxTexture(fDesc, fFlags);
     } else {
-        fTarget = texProvider->createTexture(fDesc, fBudgeted, fFlags);
+        fTarget = resourceProvider->createTexture(fDesc, fBudgeted, fFlags);
     }
     if (!fTarget) {
         return nullptr;
@@ -71,7 +71,7 @@
     }
 
     if (caps.reuseScratchTextures() || fDesc.fFlags & kRenderTarget_GrSurfaceFlag) {
-        return SkTMax(GrTextureProvider::kMinScratchTextureSize, GrNextPow2(fDesc.fWidth));
+        return SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(fDesc.fWidth));
     }
 
     return fDesc.fWidth;
@@ -87,7 +87,7 @@
     }
 
     if (caps.reuseScratchTextures() || fDesc.fFlags & kRenderTarget_GrSurfaceFlag) {
-        return SkTMax(GrTextureProvider::kMinScratchTextureSize, GrNextPow2(fDesc.fHeight));
+        return SkTMax(GrResourceProvider::kMinScratchTextureSize, GrNextPow2(fDesc.fHeight));
     }
 
     return fDesc.fHeight;
@@ -146,7 +146,7 @@
 
 #include "GrResourceProvider.h"
 
-sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrTextureProvider* texProvider,
+sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(GrResourceProvider* resourceProvider,
                                                    const GrCaps& caps,
                                                    const GrSurfaceDesc& desc,
                                                    SkBackingFit fit,
@@ -199,9 +199,9 @@
     sk_sp<GrTexture> tex;
 
     if (SkBackingFit::kApprox == fit) {
-        tex.reset(texProvider->createApproxTexture(copyDesc));
+        tex.reset(resourceProvider->createApproxTexture(copyDesc, 0));
     } else {
-        tex.reset(texProvider->createTexture(copyDesc, budgeted));
+        tex.reset(resourceProvider->createTexture(copyDesc, budgeted));
     }
 
     if (!tex) {
@@ -222,24 +222,25 @@
 }
 
 sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferred(const GrCaps& caps,
-                                                   GrTextureProvider* texProvider,
+                                                   GrResourceProvider* resourceProvider,
                                                    const GrSurfaceDesc& desc,
                                                    SkBudgeted budgeted,
                                                    const void* srcData,
                                                    size_t rowBytes) {
     if (srcData) {
         // If we have srcData, for now, we create a wrapped GrTextureProxy
-        sk_sp<GrTexture> tex(texProvider->createTexture(desc, budgeted, srcData, rowBytes));
+        sk_sp<GrTexture> tex(resourceProvider->createTexture(desc, budgeted, srcData, rowBytes));
         return GrSurfaceProxy::MakeWrapped(std::move(tex));
     }
 
-    return GrSurfaceProxy::MakeDeferred(texProvider, caps, desc, SkBackingFit::kExact, budgeted);
+    return GrSurfaceProxy::MakeDeferred(resourceProvider, caps, desc, SkBackingFit::kExact,
+                                        budgeted);
 }
 
 sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
                                                          GrBackendTextureDesc& desc,
                                                          GrWrapOwnership ownership) {
-    sk_sp<GrTexture> tex(context->textureProvider()->wrapBackendTexture(desc, ownership));
+    sk_sp<GrTexture> tex(context->resourceProvider()->wrapBackendTexture(desc, ownership));
     return GrSurfaceProxy::MakeWrapped(std::move(tex));
 }
 
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 27f8d6d..63d9a11 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -10,8 +10,8 @@
 #include "GrContext.h"
 #include "GrGpu.h"
 #include "GrGpuResourcePriv.h"
+#include "GrResourceProvider.h"
 #include "GrTexture.h"
-#include "GrTextureProvider.h"
 #include "SkGrPriv.h"
 
 GrTextureAdjuster::GrTextureAdjuster(GrTexture* original, SkAlphaType alphaType,
@@ -49,7 +49,7 @@
     GrUniqueKey key;
     this->makeCopyKey(copyParams, &key, nullptr);
     if (key.isValid()) {
-        GrTexture* cachedCopy = context->textureProvider()->findAndRefTextureByUniqueKey(key);
+        GrTexture* cachedCopy = context->resourceProvider()->findAndRefTextureByUniqueKey(key);
         if (cachedCopy) {
             return cachedCopy;
         }
@@ -57,7 +57,7 @@
     GrTexture* copy = CopyOnGpu(texture, contentArea, copyParams);
     if (copy) {
         if (key.isValid()) {
-            context->textureProvider()->assignUniqueKeyToTexture(key, copy);
+            context->resourceProvider()->assignUniqueKeyToTexture(key, copy);
             this->didCacheCopy(key);
         }
     }
diff --git a/src/gpu/GrTextureContext.cpp b/src/gpu/GrTextureContext.cpp
index 75c9e30..ffcddbc 100644
--- a/src/gpu/GrTextureContext.cpp
+++ b/src/gpu/GrTextureContext.cpp
@@ -77,7 +77,7 @@
     GR_AUDIT_TRAIL_AUTO_FRAME(fAuditTrail, "GrTextureContext::copy");
 
     // TODO: defer instantiation until flush time
-    sk_sp<GrSurface> src(sk_ref_sp(srcProxy->instantiate(fContext->textureProvider())));
+    sk_sp<GrSurface> src(sk_ref_sp(srcProxy->instantiate(fContext->resourceProvider())));
     if (!src) {
         return false;
     }
@@ -89,7 +89,7 @@
 #endif
 
     // TODO: this needs to be fixed up since it ends the deferrable of the GrTexture
-    sk_sp<GrTexture> tex(sk_ref_sp(fTextureProxy->instantiate(fContext->textureProvider())));
+    sk_sp<GrTexture> tex(sk_ref_sp(fTextureProxy->instantiate(fContext->resourceProvider())));
     if (!tex) {
         return false;
     }
@@ -122,7 +122,7 @@
     }
 
     // Deferral of the VRAM resources must end in this instance anyway
-    sk_sp<GrTexture> tex(sk_ref_sp(fTextureProxy->instantiate(fContext->textureProvider())));
+    sk_sp<GrTexture> tex(sk_ref_sp(fTextureProxy->instantiate(fContext->resourceProvider())));
     if (!tex) {
         return false;
     }
@@ -145,7 +145,7 @@
     }
 
     // Deferral of the VRAM resources must end in this instance anyway
-    sk_sp<GrTexture> tex(sk_ref_sp(fTextureProxy->instantiate(fContext->textureProvider())));
+    sk_sp<GrTexture> tex(sk_ref_sp(fTextureProxy->instantiate(fContext->resourceProvider())));
     if (!tex) {
         return false;
     }
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index ac89af7..bd0840b 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -9,7 +9,7 @@
 
 #include "GrContext.h"
 #include "GrGpu.h"
-#include "GrTextureProvider.h"
+#include "GrResourceProvider.h"
 
 GrTexture* GrTextureMaker::refTextureForParams(const GrSamplerParams& params,
                                                SkColorSpace* dstColorSpace,
@@ -33,7 +33,7 @@
     GrUniqueKey copyKey;
     this->makeCopyKey(copyParams, &copyKey, dstColorSpace);
     if (copyKey.isValid()) {
-        GrTexture* result = fContext->textureProvider()->findAndRefTextureByUniqueKey(copyKey);
+        GrTexture* result = fContext->resourceProvider()->findAndRefTextureByUniqueKey(copyKey);
         if (result) {
             return result;
         }
@@ -45,7 +45,7 @@
     }
 
     if (copyKey.isValid()) {
-        fContext->textureProvider()->assignUniqueKeyToTexture(copyKey, result);
+        fContext->resourceProvider()->assignUniqueKeyToTexture(copyKey, result);
         this->didCacheCopy(copyKey);
     }
     return result;
diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp
deleted file mode 100644
index 3790f27..0000000
--- a/src/gpu/GrTextureProvider.cpp
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "GrTextureProvider.h"
-
-#include "GrCaps.h"
-#include "GrTexturePriv.h"
-#include "GrResourceCache.h"
-#include "GrGpu.h"
-#include "../private/GrSingleOwner.h"
-#include "SkMathPriv.h"
-#include "SkTArray.h"
-#include "SkTLazy.h"
-
-const int GrTextureProvider::kMinScratchTextureSize = 16;
-
-#define ASSERT_SINGLE_OWNER \
-    SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
-
-GrTextureProvider::GrTextureProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* singleOwner)
-    : fCache(cache)
-    , fGpu(gpu)
-#ifdef SK_DEBUG
-    , fSingleOwner(singleOwner)
-#endif
-    {
-}
-
-GrTexture* GrTextureProvider::createMipMappedTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
-                                                     const GrMipLevel* texels, int mipLevelCount,
-                                                     uint32_t flags) {
-    ASSERT_SINGLE_OWNER
-
-    if (this->isAbandoned()) {
-        return nullptr;
-    }
-    if (mipLevelCount && !texels) {
-        return nullptr;
-    }
-    for (int i = 0; i < mipLevelCount; ++i) {
-        if (!texels[i].fPixels) {
-            return nullptr;
-        }
-    }
-    if (mipLevelCount > 1 && GrPixelConfigIsSint(desc.fConfig)) {
-        return nullptr;
-    }
-    if ((desc.fFlags & kRenderTarget_GrSurfaceFlag) &&
-        !fGpu->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
-        return nullptr;
-    }
-    if (!GrPixelConfigIsCompressed(desc.fConfig)) {
-        if (mipLevelCount < 2) {
-            flags |= kExact_ScratchTextureFlag | kNoCreate_ScratchTextureFlag;
-            if (GrTexture* texture = this->refScratchTexture(desc, flags)) {
-                if (!mipLevelCount ||
-                    texture->writePixels(0, 0, desc.fWidth, desc.fHeight, desc.fConfig,
-                                         texels[0].fPixels, texels[0].fRowBytes)) {
-                    if (SkBudgeted::kNo == budgeted) {
-                        texture->resourcePriv().makeUnbudgeted();
-                    }
-                    return texture;
-                }
-                texture->unref();
-            }
-        }
-    }
-
-    SkTArray<GrMipLevel> texelsShallowCopy(mipLevelCount);
-    for (int i = 0; i < mipLevelCount; ++i) {
-        texelsShallowCopy.push_back(texels[i]);
-    }
-    return fGpu->createTexture(desc, budgeted, texelsShallowCopy);
-}
-
-GrTexture* GrTextureProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
-                                            const void* srcData, size_t rowBytes, uint32_t flags) {
-    GrMipLevel tempTexels;
-    GrMipLevel* texels = nullptr;
-    int levelCount = 0;
-    if (srcData) {
-        tempTexels.fPixels = srcData;
-        tempTexels.fRowBytes = rowBytes;
-        texels = &tempTexels;
-        levelCount = 1;
-    }
-    return this->createMipMappedTexture(desc, budgeted, texels, levelCount, flags);
-}
-
-GrTexture* GrTextureProvider::createApproxTexture(const GrSurfaceDesc& desc, uint32_t flags) {
-    ASSERT_SINGLE_OWNER
-    return this->internalCreateApproxTexture(desc, flags);
-}
-
-GrTexture* GrTextureProvider::internalCreateApproxTexture(const GrSurfaceDesc& desc,
-                                                          uint32_t scratchFlags) {
-    ASSERT_SINGLE_OWNER
-    if (this->isAbandoned()) {
-        return nullptr;
-    }
-    // Currently we don't recycle compressed textures as scratch.
-    if (GrPixelConfigIsCompressed(desc.fConfig)) {
-        return nullptr;
-    } else {
-        return this->refScratchTexture(desc, scratchFlags);
-    }
-}
-
-GrTexture* GrTextureProvider::refScratchTexture(const GrSurfaceDesc& inDesc,
-                                                uint32_t flags) {
-    ASSERT_SINGLE_OWNER
-    SkASSERT(!this->isAbandoned());
-    SkASSERT(!GrPixelConfigIsCompressed(inDesc.fConfig));
-
-    SkTCopyOnFirstWrite<GrSurfaceDesc> desc(inDesc);
-
-    if (fGpu->caps()->reuseScratchTextures() || (desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
-        if (!(kExact_ScratchTextureFlag & flags)) {
-            // bin by pow2 with a reasonable min
-            GrSurfaceDesc* wdesc = desc.writable();
-            wdesc->fWidth  = SkTMax(kMinScratchTextureSize, GrNextPow2(desc->fWidth));
-            wdesc->fHeight = SkTMax(kMinScratchTextureSize, GrNextPow2(desc->fHeight));
-        }
-
-        GrScratchKey key;
-        GrTexturePriv::ComputeScratchKey(*desc, &key);
-        uint32_t scratchFlags = 0;
-        if (kNoPendingIO_ScratchTextureFlag & flags) {
-            scratchFlags = GrResourceCache::kRequireNoPendingIO_ScratchFlag;
-        } else  if (!(desc->fFlags & kRenderTarget_GrSurfaceFlag)) {
-            // If it is not a render target then it will most likely be populated by
-            // writePixels() which will trigger a flush if the texture has pending IO.
-            scratchFlags = GrResourceCache::kPreferNoPendingIO_ScratchFlag;
-        }
-        GrGpuResource* resource = fCache->findAndRefScratchResource(key,
-                                                                   GrSurface::WorstCaseSize(*desc),
-                                                                   scratchFlags);
-        if (resource) {
-            GrSurface* surface = static_cast<GrSurface*>(resource);
-            GrRenderTarget* rt = surface->asRenderTarget();
-            if (rt && fGpu->caps()->discardRenderTargetSupport()) {
-                rt->discard();
-            }
-            return surface->asTexture();
-        }
-    }
-
-    if (!(kNoCreate_ScratchTextureFlag & flags)) {
-        return fGpu->createTexture(*desc, SkBudgeted::kYes);
-    }
-
-    return nullptr;
-}
-
-sk_sp<GrTexture> GrTextureProvider::wrapBackendTexture(const GrBackendTextureDesc& desc,
-                                                       GrWrapOwnership ownership) {
-    ASSERT_SINGLE_OWNER
-    if (this->isAbandoned()) {
-        return nullptr;
-    }
-    return fGpu->wrapBackendTexture(desc, ownership);
-}
-
-sk_sp<GrRenderTarget> GrTextureProvider::wrapBackendRenderTarget(
-    const GrBackendRenderTargetDesc& desc)
-{
-    ASSERT_SINGLE_OWNER
-    return this->isAbandoned() ? nullptr
-                               : fGpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership);
-}
-
-void GrTextureProvider::assignUniqueKeyToResource(const GrUniqueKey& key, GrGpuResource* resource) {
-    ASSERT_SINGLE_OWNER
-    if (this->isAbandoned() || !resource) {
-        return;
-    }
-    resource->resourcePriv().setUniqueKey(key);
-}
-
-bool GrTextureProvider::existsResourceWithUniqueKey(const GrUniqueKey& key) const {
-    ASSERT_SINGLE_OWNER
-    return this->isAbandoned() ? false : fCache->hasUniqueKey(key);
-}
-
-GrGpuResource* GrTextureProvider::findAndRefResourceByUniqueKey(const GrUniqueKey& key) {
-    ASSERT_SINGLE_OWNER
-    return this->isAbandoned() ? nullptr : fCache->findAndRefUniqueResource(key);
-}
-
-GrTexture* GrTextureProvider::findAndRefTextureByUniqueKey(const GrUniqueKey& key) {
-    ASSERT_SINGLE_OWNER
-    GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key);
-    if (resource) {
-        GrTexture* texture = static_cast<GrSurface*>(resource)->asTexture();
-        SkASSERT(texture);
-        return texture;
-    }
-    return NULL;
-}
diff --git a/src/gpu/GrTextureProvider.h b/src/gpu/GrTextureProvider.h
deleted file mode 100644
index dd139cc..0000000
--- a/src/gpu/GrTextureProvider.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef GrTextureProvider_DEFINED
-#define GrTextureProvider_DEFINED
-
-#include "GrTexture.h"
-#include "GrTypes.h"
-
-class GrSingleOwner;
-
-class SK_API GrTextureProvider {
-public:
-    ///////////////////////////////////////////////////////////////////////////
-    // Textures
-
-    /**
-     * Creates a new texture in the resource cache and returns it. The caller owns a
-     * ref on the returned texture which must be balanced by a call to unref.
-     *
-     * @param desc          Description of the texture properties.
-     * @param budgeted      Does the texture count against the resource cache budget?
-     * @param texels        A contiguous array of mipmap levels
-     * @param mipLevelCount The amount of elements in the texels array
-     */
-    GrTexture* createMipMappedTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
-                                      const GrMipLevel* texels, int mipLevelCount,
-                                      uint32_t flags = 0);
-
-    /**
-     * This function is a shim which creates a SkTArray<GrMipLevel> of size 1.
-     * It then calls createTexture with that SkTArray.
-     *
-     * @param srcData   Pointer to the pixel values (optional).
-     * @param rowBytes  The number of bytes between rows of the texture. Zero
-     *                  implies tightly packed rows. For compressed pixel configs, this
-     *                  field is ignored.
-     */
-    GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, const void* srcData,
-                             size_t rowBytes, uint32_t flags = 0);
-
-    /** Shortcut for creating a texture with no initial data to upload. */
-    GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, uint32_t flags = 0) {
-        return this->createTexture(desc, budgeted, nullptr, 0, flags);
-    }
-
-    /** Assigns a unique key to the texture. The texture will be findable via this key using
-        findTextureByUniqueKey(). If an existing texture has this key, it's key will be removed. */
-    void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) {
-        SkASSERT(key.isValid());
-        this->assignUniqueKeyToResource(key, texture);
-    }
-
-    /** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */
-    GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key);
-
-    /**
-     * Determines whether a texture is associated with the unique key. If the texture is found it
-     * will not be locked or returned. This call does not affect the priority of the resource for
-     * deletion.
-     */
-    bool existsTextureWithUniqueKey(const GrUniqueKey& key) const {
-        return this->existsResourceWithUniqueKey(key);
-    }
-
-    /**
-     * Finds a texture that approximately matches the descriptor. Will be at least as large in width
-     * and height as desc specifies. If desc specifies that the texture should be a render target
-     * then result will be a render target. Format and sample count will always match the request.
-     * The contents of the texture are undefined. The caller owns a ref on the returned texture and
-     * must balance with a call to unref.
-     */
-    GrTexture* createApproxTexture(const GrSurfaceDesc&, uint32_t flags = 0);
-
-    /** Legacy function that no longer should be used. */
-    enum ScratchTexMatch {
-        kExact_ScratchTexMatch,
-        kApprox_ScratchTexMatch
-    };
-    GrTexture* refScratchTexture(const GrSurfaceDesc& desc, ScratchTexMatch match, uint32_t flags) {
-        if (kApprox_ScratchTexMatch == match) {
-            return this->createApproxTexture(desc, flags);
-        } else {
-            return this->createTexture(desc, SkBudgeted::kYes, flags);
-        }
-    }
-
-    ///////////////////////////////////////////////////////////////////////////
-    // Wrapped Backend Surfaces
-
-    /**
-     * Wraps an existing texture with a GrTexture object.
-     *
-     * OpenGL: if the object is a texture Gr may change its GL texture params
-     *         when it is drawn.
-     *
-     * @return GrTexture object or NULL on failure.
-     */
-    sk_sp<GrTexture> wrapBackendTexture(const GrBackendTextureDesc& desc,
-                                        GrWrapOwnership = kBorrow_GrWrapOwnership);
-
-    /**
-     * Wraps an existing render target with a GrRenderTarget object. It is
-     * similar to wrapBackendTexture but can be used to draw into surfaces
-     * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that
-     * the client will resolve to a texture). Currently wrapped render targets
-     * always use the kBorrow_GrWrapOwnership semantics.
-     *
-     * @return GrRenderTarget object or NULL on failure.
-     */
-     sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
-
-     static const int kMinScratchTextureSize;
-
-protected:
-    GrTextureProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* singleOwner);
-
-    /**
-     * Assigns a unique key to a resource. If the key is associated with another resource that
-     * association is removed and replaced by this resource.
-     */
-    void assignUniqueKeyToResource(const GrUniqueKey&, GrGpuResource*);
-
-    /**
-     * Finds a resource in the cache, based on the specified key. This is intended for use in
-     * conjunction with addResourceToCache(). The return value will be NULL if not found. The
-     * caller must balance with a call to unref().
-     */
-    GrGpuResource* findAndRefResourceByUniqueKey(const GrUniqueKey&);
-
-    /**
-     * Determines whether a resource is in the cache. If the resource is found it
-     * will not be locked or returned. This call does not affect the priority of
-     * the resource for deletion.
-     */
-    bool existsResourceWithUniqueKey(const GrUniqueKey& key) const;
-
-    enum ScratchTextureFlags {
-        kExact_ScratchTextureFlag           = 0x1,
-        kNoPendingIO_ScratchTextureFlag     = 0x2, // (http://skbug.com/4156)
-        kNoCreate_ScratchTextureFlag        = 0x4,
-        kLastScratchTextureFlag = kNoCreate_ScratchTextureFlag
-    };
-
-    /** A common impl for GrTextureProvider and GrResourceProvider variants. */
-    GrTexture* internalCreateApproxTexture(const GrSurfaceDesc& desc, uint32_t scratchTextureFlags);
-
-    GrTexture* refScratchTexture(const GrSurfaceDesc&, uint32_t scratchTextureFlags);
-
-    void abandon() {
-        fCache = NULL;
-        fGpu = NULL;
-    }
-
-    GrResourceCache* cache() { return fCache; }
-    const GrResourceCache* cache() const { return fCache; }
-
-    GrGpu* gpu() { return fGpu; }
-    const GrGpu* gpu() const { return fGpu; }
-
-    bool isAbandoned() const {
-        SkASSERT(SkToBool(fGpu) == SkToBool(fCache));
-        return !SkToBool(fCache);
-    }
-
-private:
-    GrResourceCache* fCache;
-    GrGpu* fGpu;
-
-    // In debug builds we guard against improper thread handling
-    SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;)
-};
-
-#endif
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 9a65140..0b34309 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -7,7 +7,7 @@
 
 #include "GrTextureProxy.h"
 
-#include "GrTextureProvider.h"
+#include "GrResourceProvider.h"
 
 GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted,
                                const void* srcData, size_t /*rowBytes*/, uint32_t flags)
@@ -19,8 +19,8 @@
     : INHERITED(std::move(surf), SkBackingFit::kExact) {
 }
 
-GrTexture* GrTextureProxy::instantiate(GrTextureProvider* texProvider) {
-    GrSurface* surf = this->INHERITED::instantiate(texProvider);
+GrTexture* GrTextureProxy::instantiate(GrResourceProvider* resourceProvider) {
+    GrSurface* surf = this->INHERITED::instantiate(resourceProvider);
     if (!surf) {
         return nullptr;
     }
diff --git a/src/gpu/GrTextureToYUVPlanes.cpp b/src/gpu/GrTextureToYUVPlanes.cpp
index 132b680..683bd63 100644
--- a/src/gpu/GrTextureToYUVPlanes.cpp
+++ b/src/gpu/GrTextureToYUVPlanes.cpp
@@ -10,9 +10,9 @@
 #include "effects/GrYUVEffect.h"
 #include "GrClip.h"
 #include "GrContext.h"
-#include "GrRenderTargetContext.h"
 #include "GrPaint.h"
-#include "GrTextureProvider.h"
+#include "GrRenderTargetContext.h"
+#include "GrResourceProvider.h"
 
 namespace {
     using MakeFPProc = sk_sp<GrFragmentProcessor> (*)(sk_sp<GrFragmentProcessor>,
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 6eaba4c..c3d197e 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -13,8 +13,8 @@
 #include "GrContext.h"
 #include "GrGpuResourcePriv.h"
 #include "GrRenderTargetContext.h"
+#include "GrResourceProvider.h"
 #include "GrTexturePriv.h"
-#include "GrTextureProvider.h"
 #include "GrTextureProxy.h"
 #include "GrTypes.h"
 #include "GrXferProcessor.h"
@@ -162,7 +162,7 @@
         desc = GrImageInfoToSurfaceDesc(pmap->info(), *caps);
     }
 
-    return ctx->textureProvider()->createTexture(desc, budgeted, pmap->addr(),
+    return ctx->resourceProvider()->createTexture(desc, budgeted, pmap->addr(),
                                                  pmap->rowBytes());
 }
 
@@ -240,10 +240,10 @@
     }
 
     {
-        GrTexture* texture = ctx->textureProvider()->createMipMappedTexture(desc,
-                                                                            SkBudgeted::kYes,
-                                                                            texels.get(),
-                                                                            mipLevelCount);
+        GrTexture* texture = ctx->resourceProvider()->createMipMappedTexture(desc,
+                                                                             SkBudgeted::kYes,
+                                                                             texels.get(),
+                                                                             mipLevelCount);
         if (texture) {
             texture->texturePriv().setMipColorMode(colorMode);
         }
@@ -258,8 +258,8 @@
     }
 
     const GrCaps* caps = ctx->caps();
-    return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDesc(info, *caps),
-                                                          SkBudgeted::kYes, texels,
+    return ctx->resourceProvider()->createMipMappedTexture(GrImageInfoToSurfaceDesc(info, *caps),
+                                                           SkBudgeted::kYes, texels,
                                                           mipLevelCount);
 }
 
@@ -284,12 +284,12 @@
     sk_sp<GrTexture> tex;
 
     if (originalKey.isValid()) {
-        tex.reset(context->textureProvider()->findAndRefTextureByUniqueKey(originalKey));
+        tex.reset(context->resourceProvider()->findAndRefTextureByUniqueKey(originalKey));
     }
     if (!tex) {
         tex.reset(GrUploadBitmapToTexture(context, bitmap));
         if (tex && originalKey.isValid()) {
-            context->textureProvider()->assignUniqueKeyToTexture(originalKey, tex.get());
+            context->resourceProvider()->assignUniqueKeyToTexture(originalKey, tex.get());
             GrInstallBitmapUniqueKeyInvalidator(originalKey, bitmap.pixelRef());
         }
     }
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index bbce742..8283910 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -127,7 +127,7 @@
     : fColor(color)
     , fLocalMatrix(localMatrix)
     , fUsesLocalCoords(usesLocalCoords)
-    , fTextureSampler(context->textureProvider(), std::move(proxy), params)
+    , fTextureSampler(context->resourceProvider(), std::move(proxy), params)
     , fInColor(nullptr)
     , fMaskFormat(format) {
     this->initClassID<GrBitmapTextGeoProc>();
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index 6a4cca5..d629902 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -219,7 +219,7 @@
     desc.fConfig = kConfig;
 
     sk_sp<GrTextureProxy> dataProxy = GrSurfaceProxy::MakeDeferred(*context->caps(),
-                                                                   context->textureProvider(),
+                                                                   context->resourceProvider(),
                                                                    desc, SkBudgeted::kYes, data, 0);
     if (!dataProxy) {
         return;
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 19f5e2a..a5f68d9 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -234,7 +234,7 @@
                                                            bool usesLocalCoords)
     : fColor(color)
     , fViewMatrix(viewMatrix)
-    , fTextureSampler(context->textureProvider(), std::move(proxy), params)
+    , fTextureSampler(context->resourceProvider(), std::move(proxy), params)
 #ifdef SK_GAMMA_APPLY_TO_A8
     , fDistanceAdjust(distanceAdjust)
 #endif
@@ -481,7 +481,7 @@
         bool usesLocalCoords)
     : fColor(color)
     , fViewMatrix(viewMatrix)
-    , fTextureSampler(context->textureProvider(), std::move(proxy), params)
+    , fTextureSampler(context->resourceProvider(), std::move(proxy), params)
     , fFlags(flags & kNonLCD_DistanceFieldEffectMask)
     , fInColor(nullptr)
     , fUsesLocalCoords(usesLocalCoords) {
@@ -785,7 +785,7 @@
                                                   uint32_t flags, bool usesLocalCoords)
     : fColor(color)
     , fViewMatrix(viewMatrix)
-    , fTextureSampler(context->textureProvider(), std::move(proxy), params)
+    , fTextureSampler(context->resourceProvider(), std::move(proxy), params)
     , fDistanceAdjust(distanceAdjust)
     , fFlags(flags & kLCD_DistanceFieldEffectMask)
     , fUsesLocalCoords(usesLocalCoords) {
diff --git a/src/gpu/effects/GrSingleTextureEffect.cpp b/src/gpu/effects/GrSingleTextureEffect.cpp
index acfc0d1..01cad66 100644
--- a/src/gpu/effects/GrSingleTextureEffect.cpp
+++ b/src/gpu/effects/GrSingleTextureEffect.cpp
@@ -52,7 +52,7 @@
                                              const SkMatrix& m)
         : INHERITED(optFlags)
         , fCoordTransform(ctx, m, proxy.get(), GrSamplerParams::kNone_FilterMode)
-        , fTextureSampler(ctx->textureProvider(), std::move(proxy))
+        , fTextureSampler(ctx->resourceProvider(), std::move(proxy))
         , fColorSpaceXform(std::move(colorSpaceXform)) {
     this->addCoordTransform(&fCoordTransform);
     this->addTextureSampler(&fTextureSampler);
@@ -65,7 +65,7 @@
                                              GrSamplerParams::FilterMode filterMode)
         : INHERITED(optFlags)
         , fCoordTransform(ctx, m, proxy.get(), filterMode)
-        , fTextureSampler(ctx->textureProvider(), std::move(proxy), filterMode)
+        , fTextureSampler(ctx->resourceProvider(), std::move(proxy), filterMode)
         , fColorSpaceXform(std::move(colorSpaceXform)) {
     this->addCoordTransform(&fCoordTransform);
     this->addTextureSampler(&fTextureSampler);
@@ -77,7 +77,7 @@
                                              const SkMatrix& m, const GrSamplerParams& params)
         : INHERITED(optFlags)
         , fCoordTransform(ctx, m, proxy.get(), params.filterMode())
-        , fTextureSampler(ctx->textureProvider(), std::move(proxy), params)
+        , fTextureSampler(ctx->resourceProvider(), std::move(proxy), params)
         , fColorSpaceXform(std::move(colorSpaceXform)) {
     this->addCoordTransform(&fCoordTransform);
     this->addTextureSampler(&fTextureSampler);
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 39bc3cc..2ac6af8 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -423,7 +423,7 @@
         const SkIRect& subset,
         const SkIPoint& deviceSpaceOffset)
         : INHERITED(kCompatibleWithCoverageAsAlpha_OptimizationFlag)
-        , fTextureSampler(context->textureProvider(), proxy, GrSamplerParams::ClampNoFilter())
+        , fTextureSampler(context->resourceProvider(), proxy, GrSamplerParams::ClampNoFilter())
         , fTextureDomain(proxy.get(), GrTextureDomain::MakeTexelDomain(subset),
                          GrTextureDomain::kDecal_Mode) {
     this->addTextureSampler(&fTextureSampler);
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index 1791b20..df36e65 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -10,7 +10,6 @@
 #include "GrContextPriv.h"
 #include "GrResourceProvider.h"
 #include "GrSurfaceContext.h"
-#include "GrTextureProvider.h"
 #include "SkGr.h"
 #include "SkPixelRef.h"
 #include "SkTSearch.h"
@@ -209,9 +208,9 @@
     builder.finish();
 
     // MDB TODO (caching): this side-steps the issue of proxies with unique IDs
-    sk_sp<GrTexture> texture(fDesc.fContext->textureProvider()->findAndRefTextureByUniqueKey(key));
+    sk_sp<GrTexture> texture(fDesc.fContext->resourceProvider()->findAndRefTextureByUniqueKey(key));
     if (!texture) {
-        texture.reset(fDesc.fContext->textureProvider()->createTexture(
+        texture.reset(fDesc.fContext->resourceProvider()->createTexture(
                                                         texDesc, SkBudgeted::kYes,
                                                         nullptr, 0,
                                                         GrResourceProvider::kNoPendingIO_Flag));
@@ -219,7 +218,7 @@
             return;
         }
 
-        fDesc.fContext->textureProvider()->assignUniqueKeyToTexture(key, texture.get());
+        fDesc.fContext->resourceProvider()->assignUniqueKeyToTexture(key, texture.get());
         // This is a new texture, so all of our cache info is now invalid
         this->initLRU();
         fKeyTable.rewind();
diff --git a/src/gpu/effects/GrYUVEffect.cpp b/src/gpu/effects/GrYUVEffect.cpp
index e09e185..78ac9ba 100644
--- a/src/gpu/effects/GrYUVEffect.cpp
+++ b/src/gpu/effects/GrYUVEffect.cpp
@@ -159,10 +159,10 @@
                    GrSamplerParams::FilterMode uvFilterMode, SkYUVColorSpace colorSpace, bool nv12)
             : INHERITED(kPreservesOpaqueInput_OptimizationFlag)
             , fYTransform(ctx, yuvMatrix[0], yProxy.get(), GrSamplerParams::kNone_FilterMode)
-            , fYSampler(ctx->textureProvider(), std::move(yProxy))
+            , fYSampler(ctx->resourceProvider(), std::move(yProxy))
             , fUTransform(ctx, yuvMatrix[1], uProxy.get(), uvFilterMode)
-            , fUSampler(ctx->textureProvider(), std::move(uProxy), uvFilterMode)
-            , fVSampler(ctx->textureProvider(), vProxy, uvFilterMode)
+            , fUSampler(ctx->resourceProvider(), std::move(uProxy), uvFilterMode)
+            , fVSampler(ctx->resourceProvider(), vProxy, uvFilterMode)
             , fColorSpace(colorSpace)
             , fNV12(nv12) {
         this->initClassID<YUVtoRGBEffect>();
diff --git a/src/gpu/effects/GrYUVEffect.h b/src/gpu/effects/GrYUVEffect.h
index 6af442e..524928b 100644
--- a/src/gpu/effects/GrYUVEffect.h
+++ b/src/gpu/effects/GrYUVEffect.h
@@ -12,7 +12,6 @@
 
 class GrContext;
 class GrFragmentProcessor;
-class GrTextureProvider;
 class GrTextureProxy;
 
 namespace GrYUVEffect {
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 37a9193..ced5447 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -17,10 +17,10 @@
 #include "GrGpu.h"
 #include "GrImageTextureMaker.h"
 #include "GrRenderTargetContext.h"
+#include "GrResourceProvider.h"
 #include "GrSemaphore.h"
 #include "GrTextureAdjuster.h"
 #include "GrTexturePriv.h"
-#include "GrTextureProvider.h"
 #include "GrTextureProxy.h"
 #include "effects/GrYUVEffect.h"
 #include "SkCanvas.h"
@@ -195,7 +195,7 @@
     }
 
     // TODO: make gpu images be proxy-backed so we don't need to do this
-    GrSurface* subTx = sContext->asSurfaceProxy()->instantiate(ctx->textureProvider());
+    GrSurface* subTx = sContext->asSurfaceProxy()->instantiate(ctx->resourceProvider());
     if (!subTx) {
         return nullptr;
     }
@@ -215,7 +215,7 @@
     if (desc.fWidth <= 0 || desc.fHeight <= 0) {
         return nullptr;
     }
-    sk_sp<GrTexture> tex = ctx->textureProvider()->wrapBackendTexture(desc, ownership);
+    sk_sp<GrTexture> tex = ctx->resourceProvider()->wrapBackendTexture(desc, ownership);
     if (!tex) {
         return nullptr;
     }
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index cf127e5..9fe813f 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -114,7 +114,7 @@
     }
 
     // TODO: add proxy-backed SkImage_Gpu
-    GrTexture* tex = srcProxy->instantiate(ctx->textureProvider())->asTexture();
+    GrTexture* tex = srcProxy->instantiate(ctx->resourceProvider())->asTexture();
 
     const SkImageInfo info = fDevice->imageInfo();
     sk_sp<SkImage> image;