src/gpu: s/SkAutoTUnref/sk_sp/g

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4527

Change-Id: I23f0548f98e7c355da05e143e8baa330d4bc04cc
Reviewed-on: https://skia-review.googlesource.com/4527
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/src/gpu/gl/GrGLBuffer.cpp b/src/gpu/gl/GrGLBuffer.cpp
index 96226b9..250c711 100644
--- a/src/gpu/gl/GrGLBuffer.cpp
+++ b/src/gpu/gl/GrGLBuffer.cpp
@@ -30,7 +30,7 @@
 
 GrGLBuffer* GrGLBuffer::Create(GrGLGpu* gpu, size_t size, GrBufferType intendedType,
                                GrAccessPattern accessPattern, const void* data) {
-    SkAutoTUnref<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, accessPattern, data));
+    sk_sp<GrGLBuffer> buffer(new GrGLBuffer(gpu, size, intendedType, accessPattern, data));
     if (0 == buffer->bufferID()) {
         return nullptr;
     }
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index 2126314..5adba5a 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -84,5 +84,5 @@
     fDriver = args.fDriver;
     fDriverVersion = args.fDriverVersion;
 
-    fGLCaps.reset(new GrGLCaps(*args.fContextOptions, *this, fInterface));
+    fGLCaps = sk_make_sp<GrGLCaps>(*args.fContextOptions, *this, fInterface.get());
 }
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index 8207ac8..0bf045a 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -35,7 +35,7 @@
     GrGLDriver driver() const { return fDriver; }
     GrGLDriverVersion driverVersion() const { return fDriverVersion; }
     const GrGLCaps* caps() const { return fGLCaps.get(); }
-    GrGLCaps* caps() { return fGLCaps; }
+    GrGLCaps* caps() { return fGLCaps.get(); }
     bool hasExtension(const char* ext) const {
         return fInterface->hasExtension(ext);
     }
@@ -58,14 +58,14 @@
 
     GrGLContextInfo(const ConstructorArgs& args);
 
-    SkAutoTUnref<const GrGLInterface>   fInterface;
-    GrGLVersion                         fGLVersion;
-    GrGLSLGeneration                    fGLSLGeneration;
-    GrGLVendor                          fVendor;
-    GrGLRenderer                        fRenderer;
-    GrGLDriver                          fDriver;
-    GrGLDriverVersion                   fDriverVersion;
-    SkAutoTUnref<GrGLCaps>              fGLCaps;
+    sk_sp<const GrGLInterface> fInterface;
+    GrGLVersion                fGLVersion;
+    GrGLSLGeneration           fGLSLGeneration;
+    GrGLVendor                 fVendor;
+    GrGLRenderer               fRenderer;
+    GrGLDriver                 fDriver;
+    GrGLDriverVersion          fDriverVersion;
+    sk_sp<GrGLCaps>            fGLCaps;
 };
 
 /**
@@ -79,7 +79,7 @@
      */
     static GrGLContext* Create(const GrGLInterface* interface, const GrContextOptions& options);
 
-    const GrGLInterface* interface() const { return fInterface; }
+    const GrGLInterface* interface() const { return fInterface.get(); }
 
     SkSL::Compiler* compiler() const;
 
diff --git a/src/gpu/gl/GrGLCreateNullInterface.cpp b/src/gpu/gl/GrGLCreateNullInterface.cpp
index 61f638b..b41f826 100644
--- a/src/gpu/gl/GrGLCreateNullInterface.cpp
+++ b/src/gpu/gl/GrGLCreateNullInterface.cpp
@@ -176,7 +176,7 @@
 
     void notifyAttachmentDeleteWhileBound(const FramebufferAttachment* deleted) {
         for (auto& attachment : fAttachments) {
-            if (attachment == deleted) {
+            if (attachment.get() == deleted) {
                 attachment.reset(nullptr);
             }
         }
@@ -206,7 +206,7 @@
     };
     constexpr int static kNumAttachmentPoints = 1 + (int)AttachmentPoint::kColor;
 
-    SkAutoTUnref<const FramebufferAttachment> fAttachments[kNumAttachmentPoints];
+    sk_sp<const FramebufferAttachment> fAttachments[kNumAttachmentPoints];
 
     typedef GLObject INHERITED;
 };
@@ -710,7 +710,7 @@
     GrGLuint                         fCurrGenericID;
     GrGLuint                         fCurrUniformLocation;
     GrGLuint                         fCurrPathID;
-    SkAutoTUnref<const Texture>      fSingleTextureObject;
+    sk_sp<const Texture>             fSingleTextureObject;
     SkTArray<const char*>            fExtensions;
 
     // the OpenGLES 2.0 spec says this must be >= 128
@@ -746,7 +746,7 @@
         if (!fSingleTextureObject) {
             fSingleTextureObject.reset(new Texture);
         }
-        return fSingleTextureObject;
+        return fSingleTextureObject.get();
     }
 
     const GrGLubyte* CombinedExtensionString() {
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 9af3acc..838ad58 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -173,7 +173,7 @@
 
 GrGpu* GrGLGpu::Create(GrBackendContext backendContext, const GrContextOptions& options,
                        GrContext* context) {
-    SkAutoTUnref<const GrGLInterface> glInterface(
+    sk_sp<const GrGLInterface> glInterface(
         reinterpret_cast<const GrGLInterface*>(backendContext));
     if (!glInterface) {
         glInterface.reset(GrGLDefaultInterface());
@@ -183,7 +183,7 @@
     if (!glInterface) {
         return nullptr;
     }
-    GrGLContext* glContext = GrGLContext::Create(glInterface, options);
+    GrGLContext* glContext = GrGLContext::Create(glInterface.get(), options);
     if (glContext) {
         return new GrGLGpu(glContext, context);
     }
@@ -2022,8 +2022,7 @@
 
 bool GrGLGpu::flushGLState(const GrPipeline& pipeline, const GrPrimitiveProcessor& primProc,
                            bool willDrawPoints) {
-    SkAutoTUnref<GrGLProgram> program(fProgramCache->refProgram(this, pipeline, primProc,
-                                                                willDrawPoints));
+    sk_sp<GrGLProgram> program(fProgramCache->refProgram(this, pipeline, primProc, willDrawPoints));
     if (!program) {
         GrCapsDebugf(this->caps(), "Failed to create program!\n");
         return false;
@@ -2307,8 +2306,7 @@
         desc.fConfig = rtConfig;
         desc.fWidth = desc.fHeight = 16;
         desc.fFlags = kRenderTarget_GrSurfaceFlag;
-        SkAutoTUnref<GrTexture> temp(this->createTexture(desc,
-                                     SkBudgeted::kNo));
+        sk_sp<GrTexture> temp(this->createTexture(desc, SkBudgeted::kNo));
         if (!temp) {
             return false;
         }
@@ -2828,7 +2826,7 @@
     this->fHWVertexArrayState.setVertexArrayID(this, 0);
 
     GrGLAttribArrayState* attribs = this->fHWVertexArrayState.bindInternalVertexArray(this);
-    attribs->set(this, 0, fPLSSetupProgram.fArrayBuffer, kVec2f_GrVertexAttribType,
+    attribs->set(this, 0, fPLSSetupProgram.fArrayBuffer.get(), kVec2f_GrVertexAttribType,
                  2 * sizeof(GrGLfloat), 0);
     attribs->disableUnusedArrays(this, 0x1);
 
@@ -4125,8 +4123,8 @@
     fHWVertexArrayState.setVertexArrayID(this, 0);
 
     GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
-    attribs->set(this, 0, fWireRectArrayBuffer, kVec2f_GrVertexAttribType, 2 * sizeof(GrGLfloat),
-                 0);
+    attribs->set(this, 0, fWireRectArrayBuffer.get(), kVec2f_GrVertexAttribType,
+                 2 * sizeof(GrGLfloat), 0);
     attribs->disableUnusedArrays(this, 0x1);
 
     GL_CALL(Uniform4fv(fWireRectProgram.fRectUniform, 1, edges));
@@ -4179,8 +4177,8 @@
     fHWVertexArrayState.setVertexArrayID(this, 0);
 
     GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
-    attribs->set(this, 0, fCopyProgramArrayBuffer, kVec2f_GrVertexAttribType, 2 * sizeof(GrGLfloat),
-                 0);
+    attribs->set(this, 0, fCopyProgramArrayBuffer.get(), kVec2f_GrVertexAttribType,
+                 2 * sizeof(GrGLfloat), 0);
     attribs->disableUnusedArrays(this, 0x1);
 
     // dst rect edges in NDC (-1 to 1)
@@ -4422,7 +4420,7 @@
     fHWVertexArrayState.setVertexArrayID(this, 0);
 
     GrGLAttribArrayState* attribs = fHWVertexArrayState.bindInternalVertexArray(this);
-    attribs->set(this, 0, fMipmapProgramArrayBuffer, kVec2f_GrVertexAttribType,
+    attribs->set(this, 0, fMipmapProgramArrayBuffer.get(), kVec2f_GrVertexAttribType,
                  2 * sizeof(GrGLfloat), 0);
     attribs->disableUnusedArrays(this, 0x1);
 
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 1b87118..32ce979 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -393,7 +393,7 @@
     // Must be called if bindSurfaceFBOForPixelOps was used to bind a surface for copying.
     void unbindTextureFBOForPixelOps(GrGLenum fboTarget, GrSurface* surface);
 
-    SkAutoTUnref<GrGLContext>  fGLContext;
+    sk_sp<GrGLContext>          fGLContext;
 
     bool createCopyProgram(int progIdx);
     bool createMipmapProgram(int progIdx);
@@ -596,7 +596,7 @@
         GrGLint     fTexCoordXformUniform;
         GrGLint     fPosXformUniform;
     }                           fCopyPrograms[3];
-    SkAutoTUnref<GrGLBuffer>    fCopyProgramArrayBuffer;
+    sk_sp<GrGLBuffer>           fCopyProgramArrayBuffer;
 
     /** IDs for texture mipmap program. (4 filter configurations) */
     struct {
@@ -604,14 +604,14 @@
         GrGLint     fTextureUniform;
         GrGLint     fTexCoordXformUniform;
     }                           fMipmapPrograms[4];
-    SkAutoTUnref<GrGLBuffer>    fMipmapProgramArrayBuffer;
+    sk_sp<GrGLBuffer>           fMipmapProgramArrayBuffer;
 
     struct {
         GrGLuint fProgram;
         GrGLint  fColorUniform;
         GrGLint  fRectUniform;
     }                           fWireRectProgram;
-    SkAutoTUnref<GrGLBuffer>    fWireRectArrayBuffer;
+    sk_sp<GrGLBuffer>           fWireRectArrayBuffer;
 
     static int TextureTargetToCopyProgramIdx(GrGLenum target) {
         switch (target) {
@@ -636,7 +636,7 @@
     struct {
         GrGLuint                    fProgram;
         GrGLint                     fPosXformUniform;
-        SkAutoTUnref<GrGLBuffer>    fArrayBuffer;
+        sk_sp<GrGLBuffer>           fArrayBuffer;
     } fPLSSetupProgram;
 
     bool fHWPLSEnabled;
diff --git a/src/gpu/gl/GrGLGpuProgramCache.cpp b/src/gpu/gl/GrGLGpuProgramCache.cpp
index 260e256..9bca80c 100644
--- a/src/gpu/gl/GrGLGpuProgramCache.cpp
+++ b/src/gpu/gl/GrGLGpuProgramCache.cpp
@@ -26,8 +26,8 @@
 
     Entry() : fProgram(nullptr), fLRUStamp(0) {}
 
-    SkAutoTUnref<GrGLProgram>   fProgram;
-    unsigned int                fLRUStamp;
+    sk_sp<GrGLProgram>   fProgram;
+    unsigned int         fLRUStamp;
 };
 
 struct GrGLGpu::ProgramCache::ProgDescLess {