Remove SkAutoTUnref and SkAutoTDelete from public includes.

This also makes the required changed to src, tests, and tools. The few
public APIs modified by this change appear to be unused outside of Skia.

Removing these from the public API makes it easier to ensure users are
no longer using them.

This also updates GrGpu::wrapBackendXXX and the
::onWrapBackendXXX methods to clarify ownership.

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

Review-Url: https://codereview.chromium.org/2448593002
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 4b297c1..4c428a7 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1778,7 +1778,7 @@
         SkCanvas* macroCanvas = macroRec.beginRecording(SkIntToScalar(size.width()),
                                                         SkIntToScalar(size.height()));
 
-        SkAutoTDelete<SkDrawableList> drawables(recorder.detachDrawableList());
+        std::unique_ptr<SkDrawableList> drawables(recorder.detachDrawableList());
         const SkDrawableList empty;
 
         DrawsAsSingletonPictures drawsAsSingletonPictures = {
diff --git a/gm/deferredtextureimage.cpp b/gm/deferredtextureimage.cpp
index 087c4eb..1043c1b 100644
--- a/gm/deferredtextureimage.cpp
+++ b/gm/deferredtextureimage.cpp
@@ -22,7 +22,7 @@
         skiagm::GM::DrawGpuOnlyMessage(canvas);
         return;
     }
-    SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
+    sk_sp<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
 
 
 
@@ -80,7 +80,7 @@
         skiagm::GM::DrawGpuOnlyMessage(canvas);
         return;
     }
-    SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
+    sk_sp<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
 
     SkPaint paint;
     paint.setFilterQuality(params->fQuality);
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index e8cd5e0..f88a20b 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -314,10 +314,10 @@
 
     static void draw_as_tex(SkCanvas* canvas, SkImageCacherator* cache, SkScalar x, SkScalar y) {
 #if SK_SUPPORT_GPU
-        SkAutoTUnref<GrTexture> texture(cache->lockAsTexture(canvas->getGrContext(),
-                                                             GrTextureParams::ClampBilerp(),
-                                                             SkSourceGammaTreatment::kRespect,
-                                                             nullptr));
+        sk_sp<GrTexture> texture(cache->lockAsTexture(canvas->getGrContext(),
+                                                      GrTextureParams::ClampBilerp(),
+                                                      SkSourceGammaTreatment::kRespect,
+                                                      nullptr));
         if (!texture) {
             // show placeholder if we have no texture
             SkPaint paint;
@@ -330,11 +330,12 @@
             return;
         }
         // No API to draw a GrTexture directly, so we cheat and create a private image subclass
-        SkAutoTUnref<SkImage> image(new SkImage_Gpu(cache->info().width(), cache->info().height(),
-                                                    cache->uniqueID(), kPremul_SkAlphaType, texture,
-                                                    sk_ref_sp(cache->info().colorSpace()),
-                                                    SkBudgeted::kNo));
-        canvas->drawImage(image, x, y);
+        sk_sp<SkImage> image(new SkImage_Gpu(cache->info().width(), cache->info().height(),
+                                             cache->uniqueID(), kPremul_SkAlphaType,
+                                             std::move(texture),
+                                             sk_ref_sp(cache->info().colorSpace()),
+                                             SkBudgeted::kNo));
+        canvas->drawImage(image.get(), x, y);
 #endif
     }
 
diff --git a/include/codec/SkAndroidCodec.h b/include/codec/SkAndroidCodec.h
index c7587b6..07d1b13 100644
--- a/include/codec/SkAndroidCodec.h
+++ b/include/codec/SkAndroidCodec.h
@@ -260,6 +260,6 @@
     // embedded SkCodec.
     const SkImageInfo& fInfo;
 
-    SkAutoTDelete<SkCodec> fCodec;
+    std::unique_ptr<SkCodec> fCodec;
 };
 #endif // SkAndroidCodec_DEFINED
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
index a97a79c..368d5e3 100644
--- a/include/codec/SkCodec.h
+++ b/include/codec/SkCodec.h
@@ -775,7 +775,7 @@
 private:
     const SkEncodedInfo                fEncodedInfo;
     const SkImageInfo                  fSrcInfo;
-    SkAutoTDelete<SkStream>            fStream;
+    std::unique_ptr<SkStream>          fStream;
     bool                               fNeedsRewind;
     const Origin                       fOrigin;
 
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 5b30a08..b323b2a 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -1357,7 +1357,7 @@
      *  @return the current clip stack ("list" of individual clip elements)
      */
     const SkClipStack* getClipStack() const {
-        return fClipStack;
+        return fClipStack.get();
     }
 
     typedef SkCanvasClipVisitor ClipVisitor;
@@ -1516,12 +1516,6 @@
                                        const SkShadowParams& params);
 #endif
 
-    // Returns the canvas to be used by DrawIter. Default implementation
-    // returns this. Subclasses that encapsulate an indirect canvas may
-    // need to overload this method. The impl must keep track of this, as it
-    // is not released or deleted by the caller.
-    virtual SkCanvas* canvasForDrawIter();
-
     // Clip rectangle bounds. Called internally by saveLayer.
     // returns false if the entire rectangle is entirely clipped out
     // If non-NULL, The imageFilter parameter will be used to expand the clip
@@ -1592,7 +1586,7 @@
 
     class MCRec;
 
-    SkAutoTUnref<SkClipStack> fClipStack;
+    sk_sp<SkClipStack> fClipStack;
     SkDeque     fMCStack;
     // points to top of stack
     MCRec*      fMCRec;
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index d1af4f3..46cb15c 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -1121,7 +1121,7 @@
         kCurrent_Version = 2
     };
 
-    SkAutoTUnref<SkPathRef>                            fPathRef;
+    sk_sp<SkPathRef>                                   fPathRef;
     int                                                fLastMoveToIndex;
     uint8_t                                            fFillType;
     mutable uint8_t                                    fConvexity;
diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h
index 9b15c3e..5e6fda7 100644
--- a/include/core/SkPathRef.h
+++ b/include/core/SkPathRef.h
@@ -26,8 +26,8 @@
  * modify the contents. To modify or append to the verbs/points wrap the SkPathRef in an
  * SkPathRef::Editor object. Installing the editor resets the generation ID. It also performs
  * copy-on-write if the SkPathRef is shared by multiple SkPaths. The caller passes the Editor's
- * constructor a SkAutoTUnref, which may be updated to point to a new SkPathRef after the editor's
- * constructor returns.
+ * constructor a pointer to a sk_sp<SkPathRef>, which may be updated to point to a new SkPathRef
+ * after the editor's constructor returns.
  *
  * The points and verbs are stored in a single allocation. The points are at the begining of the
  * allocation while the verbs are stored at end of the allocation, in reverse order. Thus the points
@@ -40,7 +40,7 @@
 public:
     class Editor {
     public:
-        Editor(SkAutoTUnref<SkPathRef>* pathRef,
+        Editor(sk_sp<SkPathRef>* pathRef,
                int incReserveVerbs = 0,
                int incReservePoints = 0);
 
@@ -230,7 +230,7 @@
     /**
      * Transforms a path ref by a matrix, allocating a new one only if necessary.
      */
-    static void CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
+    static void CreateTransformedCopy(sk_sp<SkPathRef>* dst,
                                       const SkPathRef& src,
                                       const SkMatrix& matrix);
 
@@ -241,7 +241,7 @@
      * repopulated with approximately the same number of verbs and points. A new path ref is created
      * only if necessary.
      */
-    static void Rewind(SkAutoTUnref<SkPathRef>* pathRef);
+    static void Rewind(sk_sp<SkPathRef>* pathRef);
 
     ~SkPathRef();
     int countPoints() const { SkDEBUGCODE(this->validate();) return fPointCnt; }
diff --git a/include/core/SkPictureRecorder.h b/include/core/SkPictureRecorder.h
index c824189..890e7ca 100644
--- a/include/core/SkPictureRecorder.h
+++ b/include/core/SkPictureRecorder.h
@@ -124,13 +124,13 @@
     friend class SkPictureRecorderReplayTester; // for unit testing
     void partialReplay(SkCanvas* canvas) const;
 
-    bool                          fActivelyRecording;
-    uint32_t                      fFlags;
-    SkRect                        fCullRect;
-    SkAutoTUnref<SkBBoxHierarchy> fBBH;
-    SkAutoTUnref<SkRecorder>      fRecorder;
-    SkAutoTUnref<SkRecord>        fRecord;
-    SkMiniRecorder                fMiniRecorder;
+    bool                   fActivelyRecording;
+    uint32_t               fFlags;
+    SkRect                 fCullRect;
+    sk_sp<SkBBoxHierarchy> fBBH;
+    sk_sp<SkRecorder>      fRecorder;
+    sk_sp<SkRecord>        fRecord;
+    SkMiniRecorder         fMiniRecorder;
 
     typedef SkNoncopyable INHERITED;
 };
diff --git a/include/core/SkWriteBuffer.h b/include/core/SkWriteBuffer.h
index 29f923f..a104ffc 100644
--- a/include/core/SkWriteBuffer.h
+++ b/include/core/SkWriteBuffer.h
@@ -134,12 +134,10 @@
      * Set an SkPixelSerializer to store an encoded representation of pixels,
      * e.g. SkBitmaps.
      *
-     * Calls ref() on the serializer.
-     *
      * TODO: Encode SkImage pixels as well.
      */
-    void setPixelSerializer(SkPixelSerializer*);
-    SkPixelSerializer* getPixelSerializer() const { return fPixelSerializer; }
+    void setPixelSerializer(sk_sp<SkPixelSerializer>);
+    SkPixelSerializer* getPixelSerializer() const { return fPixelSerializer.get(); }
 
 private:
     const uint32_t fFlags;
@@ -148,7 +146,7 @@
 
     SkRefCntSet* fTFSet;
 
-    SkAutoTUnref<SkPixelSerializer> fPixelSerializer;
+    sk_sp<SkPixelSerializer> fPixelSerializer;
 
     // Only used if we do not have an fFactorySet
     SkTHashMap<SkString, uint32_t> fFlattenableDict;
diff --git a/include/gpu/GrCaps.h b/include/gpu/GrCaps.h
index a97be72..204cfc9 100644
--- a/include/gpu/GrCaps.h
+++ b/include/gpu/GrCaps.h
@@ -133,7 +133,7 @@
 
     virtual SkString dump() const;
 
-    GrShaderCaps* shaderCaps() const { return fShaderCaps; }
+    GrShaderCaps* shaderCaps() const { return fShaderCaps.get(); }
 
     bool npotTextureTileSupport() const { return fNPOTTextureTileSupport; }
     /** To avoid as-yet-unnecessary complexity we don't allow any partial support of MIP Maps (e.g.
@@ -294,7 +294,7 @@
         expand them. */
     void applyOptionsOverrides(const GrContextOptions& options);
 
-    SkAutoTUnref<GrShaderCaps>    fShaderCaps;
+    sk_sp<GrShaderCaps> fShaderCaps;
 
     bool fNPOTTextureTileSupport                     : 1;
     bool fMipMapSupport                              : 1;
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 996b77f..8e57811 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -60,7 +60,7 @@
 
     virtual ~GrContext();
 
-    GrContextThreadSafeProxy* threadSafeProxy();
+    sk_sp<GrContextThreadSafeProxy> threadSafeProxy();
 
     /**
      * The GrContext normally assumes that no outsider is setting state
@@ -327,7 +327,7 @@
     GrGpu* getGpu() { return fGpu; }
     const GrGpu* getGpu() const { return fGpu; }
     GrBatchFontCache* getBatchFontCache() { return fBatchFontCache; }
-    GrTextBlobCache* getTextBlobCache() { return fTextBlobCache; }
+    GrTextBlobCache* getTextBlobCache() { return fTextBlobCache.get(); }
     bool abandoned() const;
     GrResourceProvider* resourceProvider() { return fResourceProvider; }
     const GrResourceProvider* resourceProvider() const { return fResourceProvider; }
@@ -383,10 +383,10 @@
         GrTextureProvider*                  fTextureProvider;
     };
 
-    SkAutoTUnref<GrContextThreadSafeProxy>  fThreadSafeProxy;
+    sk_sp<GrContextThreadSafeProxy>         fThreadSafeProxy;
 
     GrBatchFontCache*                       fBatchFontCache;
-    SkAutoTDelete<GrTextBlobCache>          fTextBlobCache;
+    std::unique_ptr<GrTextBlobCache>        fTextBlobCache;
 
     bool                                    fDidTestPMConversions;
     int                                     fPMToUPMConversion;
@@ -418,7 +418,7 @@
 
     const uint32_t                          fUniqueID;
 
-    SkAutoTDelete<GrDrawingManager>         fDrawingManager;
+    std::unique_ptr<GrDrawingManager>       fDrawingManager;
 
     GrAuditTrail                            fAuditTrail;
 
@@ -463,12 +463,12 @@
  */
 class GrContextThreadSafeProxy : public SkRefCnt {
 private:
-    GrContextThreadSafeProxy(const GrCaps* caps, uint32_t uniqueID)
-        : fCaps(SkRef(caps))
+    GrContextThreadSafeProxy(sk_sp<const GrCaps> caps, uint32_t uniqueID)
+        : fCaps(std::move(caps))
         , fContextUniqueID(uniqueID) {}
 
-    SkAutoTUnref<const GrCaps>  fCaps;
-    uint32_t                    fContextUniqueID;
+    sk_sp<const GrCaps> fCaps;
+    uint32_t            fContextUniqueID;
 
     friend class GrContext;
     friend class SkImage;
diff --git a/include/gpu/GrGpuResource.h b/include/gpu/GrGpuResource.h
index d3cfa86..5f5ccbf 100644
--- a/include/gpu/GrGpuResource.h
+++ b/include/gpu/GrGpuResource.h
@@ -46,7 +46,7 @@
 template <typename DERIVED> class GrIORef : public SkNoncopyable {
 public:
     // Some of the signatures are written to mirror SkRefCnt so that GrGpuResource can work with
-    // templated helper classes (e.g. SkAutoTUnref). However, we have different categories of
+    // templated helper classes (e.g. sk_sp). However, we have different categories of
     // refs (e.g. pending reads). We also don't require thread safety as GrCacheable objects are
     // not intended to cross thread boundaries.
     void ref() const {
diff --git a/include/gpu/GrGpuResourceRef.h b/include/gpu/GrGpuResourceRef.h
index 13adbee..a91dcfe 100644
--- a/include/gpu/GrGpuResourceRef.h
+++ b/include/gpu/GrGpuResourceRef.h
@@ -28,7 +28,7 @@
  * state 2 to state 3. Calling pendingIOComplete() moves from state 2 to state 1. There is no
  * valid way of going from state 3 back to 2 or 1.
  *
- * Like SkAutoTUnref, its constructor and setter adopt a ref from their caller.
+ * Like sk_sp, its constructor and setter adopt a ref from their caller.
  *
  * TODO: Once GrDODrawState no longer exists and therefore GrDrawState and GrOptDrawState no
  * longer share an instance of this class, attempt to make the resource owned by GrGpuResourceRef
diff --git a/include/gpu/GrTextureProvider.h b/include/gpu/GrTextureProvider.h
index e013bff..efecc96 100644
--- a/include/gpu/GrTextureProvider.h
+++ b/include/gpu/GrTextureProvider.h
@@ -98,8 +98,8 @@
      *
      * @return GrTexture object or NULL on failure.
      */
-    GrTexture* wrapBackendTexture(const GrBackendTextureDesc& desc,
-                                  GrWrapOwnership = kBorrow_GrWrapOwnership);
+    sk_sp<GrTexture> wrapBackendTexture(const GrBackendTextureDesc& desc,
+                                        GrWrapOwnership = kBorrow_GrWrapOwnership);
 
     /**
      * Wraps an existing render target with a GrRenderTarget object. It is
@@ -110,7 +110,7 @@
      *
      * @return GrRenderTarget object or NULL on failure.
      */
-     GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
+     sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc);
 
 protected:
     GrTextureProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* singleOwner);
diff --git a/include/gpu/GrXferProcessor.h b/include/gpu/GrXferProcessor.h
index 1d4717e..5317c18 100644
--- a/include/gpu/GrXferProcessor.h
+++ b/include/gpu/GrXferProcessor.h
@@ -70,7 +70,7 @@
         }
 
         DstTexture& operator=(const DstTexture& other) {
-            fTexture.reset(SkSafeRef(other.fTexture.get()));
+            fTexture = other.fTexture;
             fOffset = other.fOffset;
             return *this;
         }
@@ -82,14 +82,13 @@
 
         GrTexture* texture() const { return fTexture.get(); }
 
-        GrTexture* setTexture(GrTexture* texture) {
-            fTexture.reset(SkSafeRef(texture));
-            return texture;
+        void setTexture(sk_sp<GrTexture> texture) {
+            fTexture = std::move(texture);
         }
 
     private:
-        SkAutoTUnref<GrTexture> fTexture;
-        SkIPoint                fOffset;
+        sk_sp<GrTexture> fTexture;
+        SkIPoint         fOffset;
     };
 
     /**
diff --git a/include/gpu/gl/GrGLExtensions.h b/include/gpu/gl/GrGLExtensions.h
index dd088de..faf73fd 100644
--- a/include/gpu/gl/GrGLExtensions.h
+++ b/include/gpu/gl/GrGLExtensions.h
@@ -68,7 +68,7 @@
 
 private:
     bool                                fInitialized;
-    SkAutoTDelete<SkTArray<SkString> >  fStrings;
+    std::unique_ptr<SkTArray<SkString>> fStrings;
 };
 
 #endif
diff --git a/include/gpu/vk/GrVkBackendContext.h b/include/gpu/vk/GrVkBackendContext.h
index 9942016..5e51bee 100644
--- a/include/gpu/vk/GrVkBackendContext.h
+++ b/include/gpu/vk/GrVkBackendContext.h
@@ -37,15 +37,15 @@
 // creation, and any GrBackendObjects handed to us (e.g., for wrapped textures) need to be created
 // in or transitioned to that family.
 struct GrVkBackendContext : public SkRefCnt {
-    VkInstance                        fInstance;
-    VkPhysicalDevice                  fPhysicalDevice;
-    VkDevice                          fDevice;
-    VkQueue                           fQueue;
-    uint32_t                          fGraphicsQueueIndex;
-    uint32_t                          fMinAPIVersion;
-    uint32_t                          fExtensions;
-    uint32_t                          fFeatures;
-    SkAutoTUnref<const GrVkInterface> fInterface;
+    VkInstance                 fInstance;
+    VkPhysicalDevice           fPhysicalDevice;
+    VkDevice                   fDevice;
+    VkQueue                    fQueue;
+    uint32_t                   fGraphicsQueueIndex;
+    uint32_t                   fMinAPIVersion;
+    uint32_t                   fExtensions;
+    uint32_t                   fFeatures;
+    sk_sp<const GrVkInterface> fInterface;
 
     using CanPresentFn = std::function<bool(VkInstance, VkPhysicalDevice,
                                             uint32_t queueFamilyIndex)>;
diff --git a/include/ports/SkFontMgr_indirect.h b/include/ports/SkFontMgr_indirect.h
index 406a75a..6c258c8 100644
--- a/include/ports/SkFontMgr_indirect.h
+++ b/include/ports/SkFontMgr_indirect.h
@@ -28,8 +28,8 @@
     // TODO: The SkFontMgr is only used for createFromStream/File/Data.
     // In the future these calls should be broken out into their own interface
     // with a name like SkFontRenderer.
-    SkFontMgr_Indirect(SkFontMgr* impl, SkRemotableFontMgr* proxy)
-        : fImpl(SkRef(impl)), fProxy(SkRef(proxy))
+    SkFontMgr_Indirect(sk_sp<SkFontMgr> impl, sk_sp<SkRemotableFontMgr> proxy)
+        : fImpl(std::move(impl)), fProxy(std::move(proxy))
     { }
 
 protected:
@@ -60,8 +60,8 @@
 private:
     SkTypeface* createTypefaceFromFontId(const SkFontIdentity& fontId) const;
 
-    SkAutoTUnref<SkFontMgr> fImpl;
-    SkAutoTUnref<SkRemotableFontMgr> fProxy;
+    sk_sp<SkFontMgr> fImpl;
+    sk_sp<SkRemotableFontMgr> fProxy;
 
     struct DataEntry {
         uint32_t fDataId;  // key1
diff --git a/include/ports/SkTypeface_win.h b/include/ports/SkTypeface_win.h
index 1945b75..f3a881f 100644
--- a/include/ports/SkTypeface_win.h
+++ b/include/ports/SkTypeface_win.h
@@ -57,7 +57,7 @@
  *
  *  If DirectWrite could not be initialized, will return NULL.
  */
-SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr*);
+SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(sk_sp<SkRemotableFontMgr>);
 
 /**
  *  Creates an SkRemotableFontMgr backed by DirectWrite using the default
diff --git a/include/private/GrAuditTrail.h b/include/private/GrAuditTrail.h
index 3bb7bea..b39f13f 100644
--- a/include/private/GrAuditTrail.h
+++ b/include/private/GrAuditTrail.h
@@ -134,7 +134,7 @@
         int fBatchListID;
         int fChildID;
     };
-    typedef SkTArray<SkAutoTDelete<Batch>, true> BatchPool;
+    typedef SkTArray<std::unique_ptr<Batch>, true> BatchPool;
 
     typedef SkTArray<Batch*> Batches;
 
@@ -144,14 +144,14 @@
         Batches fChildren;
         uint32_t fRenderTargetUniqueID;
     };
-    typedef SkTArray<SkAutoTDelete<BatchNode>, true> BatchList;
+    typedef SkTArray<std::unique_ptr<BatchNode>, true> BatchList;
 
     void copyOutFromBatchList(BatchInfo* outBatchInfo, int batchListID);
 
     template <typename T>
     static void JsonifyTArray(SkString* json, const char* name, const T& array,
                               bool addComma);
-    
+
     BatchPool fBatchPool;
     SkTHashMap<uint32_t, int> fIDLookup;
     SkTHashMap<int, Batches*> fClientIDLookup;
diff --git a/include/private/SkMiniRecorder.h b/include/private/SkMiniRecorder.h
index 6365ebc..06b35ca 100644
--- a/include/private/SkMiniRecorder.h
+++ b/include/private/SkMiniRecorder.h
@@ -29,7 +29,7 @@
 
     // Flush anything we've recorded to the canvas, resetting this SkMiniRecorder.
     // This is logically the same as but rather more efficient than:
-    //    SkAutoTUnref<SkPicture> pic(this->detachAsPicture(SkRect::MakeEmpty()));
+    //    sk_sp<SkPicture> pic(this->detachAsPicture(SkRect::MakeEmpty()));
     //    pic->playback(canvas);
     void flushAndReset(SkCanvas*);
 
diff --git a/include/views/SkOSWindow_Win.h b/include/views/SkOSWindow_Win.h
index 7ed22a6..7742444 100644
--- a/include/views/SkOSWindow_Win.h
+++ b/include/views/SkOSWindow_Win.h
@@ -91,11 +91,11 @@
 #if SK_SUPPORT_GPU
     void*               fHGLRC;
 #if SK_ANGLE
-    EGLDisplay                        fDisplay;
-    EGLContext                        fContext;
-    EGLSurface                        fSurface;
-    EGLConfig                         fConfig;
-    SkAutoTUnref<const GrGLInterface> fANGLEInterface;
+    EGLDisplay                 fDisplay;
+    EGLContext                 fContext;
+    EGLSurface                 fSurface;
+    EGLConfig                  fConfig;
+    sk_sp<const GrGLInterface> fANGLEInterface;
 #endif // SK_ANGLE
 #endif // SK_SUPPORT_GPU
 
diff --git a/include/xml/SkDOM.h b/include/xml/SkDOM.h
index b6f611a..c40f4bd 100644
--- a/include/xml/SkDOM.h
+++ b/include/xml/SkDOM.h
@@ -89,9 +89,9 @@
     SkDEBUGCODE(void dump(const Node* node = NULL, int tabLevel = 0) const;)
 
 private:
-    SkChunkAlloc               fAlloc;
-    Node*                      fRoot;
-    SkAutoTDelete<SkDOMParser> fParser;
+    SkChunkAlloc                 fAlloc;
+    Node*                        fRoot;
+    std::unique_ptr<SkDOMParser> fParser;
 
     typedef SkNoncopyable INHERITED;
 };
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index bcda0f2..7c9f5c6 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -319,15 +319,14 @@
 class SkDrawIter : public SkDraw {
 public:
     SkDrawIter(SkCanvas* canvas) {
-        canvas = canvas->canvasForDrawIter();
         canvas->updateDeviceCMCache();
 
-        fClipStack = canvas->fClipStack;
+        fClipStack = canvas->getClipStack();
         fCurrLayer = canvas->fMCRec->fTopLayer;
 
         fMultiDeviceCS = nullptr;
         if (fCurrLayer->fNext) {
-            fMultiDeviceCS = canvas->fClipStack;
+            fMultiDeviceCS = canvas->fClipStack.get();
             fMultiDeviceCS->save();
         }
     }
@@ -966,10 +965,6 @@
     return device->writePixels(info, pixels, rowBytes, target.x(), target.y());
 }
 
-SkCanvas* SkCanvas::canvasForDrawIter() {
-    return this;
-}
-
 //////////////////////////////////////////////////////////////////////////////
 
 void SkCanvas::updateDeviceCMCache() {
diff --git a/src/core/SkMaskGamma.h b/src/core/SkMaskGamma.h
index 94219d4..f90f75a 100644
--- a/src/core/SkMaskGamma.h
+++ b/src/core/SkMaskGamma.h
@@ -174,11 +174,11 @@
  */
 template <int R_LUM_BITS, int G_LUM_BITS, int B_LUM_BITS> class SkTMaskPreBlend {
 private:
-    SkTMaskPreBlend(const SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>* parent,
+    SkTMaskPreBlend(sk_sp<const SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>> parent,
                     const uint8_t* r, const uint8_t* g, const uint8_t* b)
-    : fParent(SkSafeRef(parent)), fR(r), fG(g), fB(b) { }
+    : fParent(std::move(parent)), fR(r), fG(g), fB(b) { }
 
-    SkAutoTUnref<const SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS> > fParent;
+    sk_sp<const SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>> fParent;
     friend class SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>;
 public:
     /** Creates a non applicable SkTMaskPreBlend. */
@@ -189,7 +189,7 @@
      * when return value optimization is enabled.
      */
     SkTMaskPreBlend(const SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>& that)
-    : fParent(SkSafeRef(that.fParent.get())), fR(that.fR), fG(that.fG), fB(that.fB) { }
+    : fParent(that.fParent), fR(that.fR), fG(that.fG), fB(that.fB) { }
 
     ~SkTMaskPreBlend() { }
 
@@ -205,7 +205,7 @@
 SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>
 SkTMaskGamma<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>::preBlend(SkColor color) const {
     return fIsLinear ? SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>()
-                     : SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>(this,
+                     : SkTMaskPreBlend<R_LUM_BITS, G_LUM_BITS, B_LUM_BITS>(sk_ref_sp(this),
                          fGammaTables[SkColorGetR(color) >> (8 - MAX_LUM_BITS)],
                          fGammaTables[SkColorGetG(color) >> (8 - MAX_LUM_BITS)],
                          fGammaTables[SkColorGetB(color) >> (8 - MAX_LUM_BITS)]);
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index d656876..4dc2f96 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -220,7 +220,7 @@
     }
     out->reset();
     out->addPath(*this);
-    fPathRef->interpolate(*ending.fPathRef, weight, out->fPathRef);
+    fPathRef->interpolate(*ending.fPathRef, weight, out->fPathRef.get());
     return true;
 }
 
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index 844c40a..ef051f7 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -12,7 +12,7 @@
 #include <limits>
 
 //////////////////////////////////////////////////////////////////////////////
-SkPathRef::Editor::Editor(SkAutoTUnref<SkPathRef>* pathRef,
+SkPathRef::Editor::Editor(sk_sp<SkPathRef>* pathRef,
                           int incReserveVerbs,
                           int incReservePoints)
 {
@@ -23,7 +23,7 @@
         copy->copy(**pathRef, incReserveVerbs, incReservePoints);
         pathRef->reset(copy);
     }
-    fPathRef = *pathRef;
+    fPathRef = pathRef->get();
     fPathRef->callGenIDChangeListeners();
     fPathRef->fGenerationID = 0;
     SkDEBUGCODE(sk_atomic_inc(&fPathRef->fEditorsAttached);)
@@ -111,12 +111,12 @@
     }
 }
 
-void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
+void SkPathRef::CreateTransformedCopy(sk_sp<SkPathRef>* dst,
                                       const SkPathRef& src,
                                       const SkMatrix& matrix) {
     SkDEBUGCODE(src.validate();)
     if (matrix.isIdentity()) {
-        if (*dst != &src) {
+        if (dst->get() != &src) {
             src.ref();
             dst->reset(const_cast<SkPathRef*>(&src));
             SkDEBUGCODE((*dst)->validate();)
@@ -128,7 +128,7 @@
         dst->reset(new SkPathRef);
     }
 
-    if (*dst != &src) {
+    if (dst->get() != &src) {
         (*dst)->resetToSize(src.fVerbCnt, src.fPointCnt, src.fConicWeights.count());
         sk_careful_memcpy((*dst)->verbsMemWritable(), src.verbsMemBegin(),
                            src.fVerbCnt * sizeof(uint8_t));
@@ -242,7 +242,7 @@
     return ref;
 }
 
-void SkPathRef::Rewind(SkAutoTUnref<SkPathRef>* pathRef) {
+void SkPathRef::Rewind(sk_sp<SkPathRef>* pathRef) {
     if ((*pathRef)->unique()) {
         SkDEBUGCODE((*pathRef)->validate();)
         (*pathRef)->callGenIDChangeListeners();
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index 68789ac..cc529e3 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -268,7 +268,7 @@
     SkFactorySet factSet;  // buffer refs factSet, so factSet must come first.
     SkBinaryWriteBuffer buffer(SkBinaryWriteBuffer::kCrossProcess_Flag);
     buffer.setFactoryRecorder(&factSet);
-    buffer.setPixelSerializer(pixelSerializer);
+    buffer.setPixelSerializer(sk_ref_sp(pixelSerializer));
     buffer.setTypefaceRecorder(typefaceSet);
     this->flattenToBuffer(buffer);
 
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index 5631a08..758aa3e 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -62,7 +62,7 @@
     }
 
     // TODO: delay as much of this work until just before first playback?
-    SkRecordOptimize(fRecord);
+    SkRecordOptimize(fRecord.get());
 
     if (fRecord->count() == 0) {
         if (finishFlags & kReturnNullForEmpty_FinishFlag) {
@@ -122,7 +122,7 @@
     fRecorder->flushMiniRecorder();
     fRecorder->restoreToCount(1);  // If we were missing any restores, add them now.
 
-    SkRecordOptimize(fRecord);
+    SkRecordOptimize(fRecord.get());
 
     if (fRecord->count() == 0) {
         if (finishFlags & kReturnNullForEmpty_FinishFlag) {
@@ -137,11 +137,8 @@
     }
 
     sk_sp<SkDrawable> drawable =
-         sk_make_sp<SkRecordedDrawable>(fRecord, fBBH, fRecorder->detachDrawableList(), fCullRect);
-
-    // release our refs now, so only the drawable will be the owner.
-    fRecord.reset(nullptr);
-    fBBH.reset(nullptr);
+         sk_make_sp<SkRecordedDrawable>(std::move(fRecord), std::move(fBBH),
+                                        fRecorder->detachDrawableList(), fCullRect);
 
     return drawable;
 }
diff --git a/src/core/SkRecordedDrawable.cpp b/src/core/SkRecordedDrawable.cpp
index 9e68be1..62a9339 100644
--- a/src/core/SkRecordedDrawable.cpp
+++ b/src/core/SkRecordedDrawable.cpp
@@ -21,7 +21,7 @@
         drawables = fDrawableList->begin();
         drawableCount = fDrawableList->count();
     }
-    SkRecordDraw(*fRecord, canvas, nullptr, drawables, drawableCount, fBBH, nullptr/*callback*/);
+    SkRecordDraw(*fRecord, canvas, nullptr, drawables, drawableCount, fBBH.get(), nullptr);
 }
 
 SkPicture* SkRecordedDrawable::onNewPictureSnapshot() {
diff --git a/src/core/SkRecordedDrawable.h b/src/core/SkRecordedDrawable.h
index 7e2d9bc..de1fca5 100644
--- a/src/core/SkRecordedDrawable.h
+++ b/src/core/SkRecordedDrawable.h
@@ -12,11 +12,11 @@
 
 class SkRecordedDrawable : public SkDrawable {
 public:
-    SkRecordedDrawable(SkRecord* record, SkBBoxHierarchy* bbh, SkDrawableList* drawableList,
-                       const SkRect& bounds)
-        : fRecord(SkRef(record))
-        , fBBH(SkSafeRef(bbh))
-        , fDrawableList(drawableList)   // we take ownership
+    SkRecordedDrawable(sk_sp<SkRecord> record, sk_sp<SkBBoxHierarchy> bbh,
+                       std::unique_ptr<SkDrawableList> drawableList, const SkRect& bounds)
+        : fRecord(std::move(record))
+        , fBBH(std::move(bbh))
+        , fDrawableList(std::move(drawableList))
         , fBounds(bounds)
     {}
 
@@ -34,8 +34,8 @@
     SkPicture* onNewPictureSnapshot() override;
 
 private:
-    SkAutoTUnref<SkRecord>          fRecord;
-    SkAutoTUnref<SkBBoxHierarchy>   fBBH;
-    SkAutoTDelete<SkDrawableList>   fDrawableList;
+    sk_sp<SkRecord>                 fRecord;
+    sk_sp<SkBBoxHierarchy>          fBBH;
+    std::unique_ptr<SkDrawableList> fDrawableList;
     const SkRect                    fBounds;
 };
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 8efae17..715fc93 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -48,7 +48,7 @@
     size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPictures; }
 
     SkDrawableList* getDrawableList() const { return fDrawableList.get(); }
-    SkDrawableList* detachDrawableList() { return fDrawableList.release(); }
+    std::unique_ptr<SkDrawableList> detachDrawableList() { return std::move(fDrawableList); }
 
     // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecorder will fail.
     void forgetRecord();
@@ -173,7 +173,7 @@
     DrawPictureMode fDrawPictureMode;
     size_t fApproxBytesUsedBySubPictures;
     SkRecord* fRecord;
-    SkAutoTDelete<SkDrawableList> fDrawableList;
+    std::unique_ptr<SkDrawableList> fDrawableList;
 
     SkMiniRecorder* fMiniRecorder;
 };
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 5d62c6b..eeb00c9 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -370,7 +370,7 @@
                                       this->subset().width(), this->subset().height());
 
         auto img = sk_sp<SkImage>(new SkImage_Gpu(fTexture->width(), fTexture->height(),
-                                                  this->uniqueID(), fAlphaType, fTexture.get(),
+                                                  this->uniqueID(), fAlphaType, fTexture,
                                                   fColorSpace, SkBudgeted::kNo));
 
         canvas->drawImageRect(img, this->subset(),
@@ -439,7 +439,7 @@
             // The existing GrTexture is already tight so reuse it in the SkImage
             return sk_make_sp<SkImage_Gpu>(fTexture->width(), fTexture->height(),
                                            kNeedNewImageUniqueID,
-                                           fAlphaType, fTexture.get(), fColorSpace,
+                                           fAlphaType, fTexture, fColorSpace,
                                            SkBudgeted::kYes);
         }
 
@@ -454,7 +454,7 @@
         }
         ctx->copySurface(subTx.get(), fTexture.get(), subset, SkIPoint::Make(0, 0));
         return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID,
-                                       fAlphaType, subTx.get(), fColorSpace, SkBudgeted::kYes);
+                                       fAlphaType, std::move(subTx), fColorSpace, SkBudgeted::kYes);
     }
 
     sk_sp<SkSurface> onMakeTightSurface(const SkImageFilter::OutputProperties& outProps,
diff --git a/src/core/SkWriteBuffer.cpp b/src/core/SkWriteBuffer.cpp
index 019bc24..3d12889 100644
--- a/src/core/SkWriteBuffer.cpp
+++ b/src/core/SkWriteBuffer.cpp
@@ -236,11 +236,8 @@
     return rec;
 }
 
-void SkBinaryWriteBuffer::setPixelSerializer(SkPixelSerializer* serializer) {
-    fPixelSerializer.reset(serializer);
-    if (serializer) {
-        serializer->ref();
-    }
+void SkBinaryWriteBuffer::setPixelSerializer(sk_sp<SkPixelSerializer> serializer) {
+    fPixelSerializer = std::move(serializer);
 }
 
 void SkBinaryWriteBuffer::writeFlattenable(const SkFlattenable* flattenable) {
diff --git a/src/gpu/GrAuditTrail.cpp b/src/gpu/GrAuditTrail.cpp
index 82dc7f7..ff6debd 100644
--- a/src/gpu/GrAuditTrail.cpp
+++ b/src/gpu/GrAuditTrail.cpp
@@ -88,7 +88,7 @@
 
 void GrAuditTrail::copyOutFromBatchList(BatchInfo* outBatchInfo, int batchListID) {
     SkASSERT(batchListID < fBatchList.count());
-    const BatchNode* bn = fBatchList[batchListID];
+    const BatchNode* bn = fBatchList[batchListID].get();
     SkASSERT(bn);
     outBatchInfo->fBounds = bn->fBounds;
     outBatchInfo->fRenderTargetUniqueID = bn->fRenderTargetUniqueID;
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index a0884f9..dfb2fce 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -132,11 +132,11 @@
     fCaps->unref();
 }
 
-GrContextThreadSafeProxy* GrContext::threadSafeProxy() {
+sk_sp<GrContextThreadSafeProxy> GrContext::threadSafeProxy() {
     if (!fThreadSafeProxy) {
-        fThreadSafeProxy.reset(new GrContextThreadSafeProxy(fCaps, this->uniqueID()));
+        fThreadSafeProxy.reset(new GrContextThreadSafeProxy(sk_ref_sp(fCaps), this->uniqueID()));
     }
-    return SkRef(fThreadSafeProxy.get());
+    return fThreadSafeProxy;
 }
 
 void GrContext::abandonContext() {
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 29eb151..398fc8a 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -15,7 +15,7 @@
     data members or virtual methods. */
 class GrContextPriv {
 public:
-    GrDrawingManager* drawingManager() { return fContext->fDrawingManager; }
+    GrDrawingManager* drawingManager() { return fContext->fDrawingManager.get(); }
 
     // Create a drawContext that wraps an existing renderTarget
     sk_sp<GrDrawContext> makeWrappedDrawContext(sk_sp<GrRenderTarget> rt,
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index 0de9fed..f576424 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -190,7 +190,8 @@
     return tex;
 }
 
-GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwnership ownership) {
+sk_sp<GrTexture> GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc,
+                                           GrWrapOwnership ownership) {
     this->handleDirtyContext();
     if (!this->caps()->isConfigTexturable(desc.fConfig)) {
         return nullptr;
@@ -203,22 +204,20 @@
     if (desc.fWidth > maxSize || desc.fHeight > maxSize) {
         return nullptr;
     }
-    GrTexture* tex = this->onWrapBackendTexture(desc, ownership);
-    if (nullptr == tex) {
+    sk_sp<GrTexture> tex = this->onWrapBackendTexture(desc, ownership);
+    if (!tex) {
         return nullptr;
     }
     // TODO: defer this and attach dynamically
     GrRenderTarget* tgt = tex->asRenderTarget();
     if (tgt && !fContext->resourceProvider()->attachStencilAttachment(tgt)) {
-        tex->unref();
         return nullptr;
-    } else {
-        return tex;
     }
+    return tex;
 }
 
-GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc,
-                                               GrWrapOwnership ownership) {
+sk_sp<GrRenderTarget> GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc,
+                                                     GrWrapOwnership ownership) {
     if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) {
         return nullptr;
     }
@@ -226,7 +225,7 @@
     return this->onWrapBackendRenderTarget(desc, ownership);
 }
 
-GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc) {
+sk_sp<GrRenderTarget> GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc) {
     this->handleDirtyContext();
     if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) {
       return nullptr;
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index ba7ed6f..8e9407a 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -124,17 +124,17 @@
     /**
      * Implements GrTextureProvider::wrapBackendTexture
      */
-    GrTexture* wrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership);
+    sk_sp<GrTexture> wrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership);
 
     /**
      * Implements GrTextureProvider::wrapBackendRenderTarget
      */
-    GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc&, GrWrapOwnership);
+    sk_sp<GrRenderTarget> wrapBackendRenderTarget(const GrBackendRenderTargetDesc&,GrWrapOwnership);
 
     /**
      * Implements GrTextureProvider::wrapBackendTextureAsRenderTarget
      */
-    GrRenderTarget* wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&);
+    sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&);
 
     /**
      * Creates a buffer in GPU memory. For a client-side buffer use GrBuffer::CreateCPUBacked.
@@ -532,10 +532,10 @@
                                                  SkBudgeted budgeted,
                                                  const SkTArray<GrMipLevel>& texels) = 0;
 
-    virtual GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) = 0;
-    virtual GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
-                                                      GrWrapOwnership) = 0;
-    virtual GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&) = 0;
+    virtual sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) = 0;
+    virtual sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
+                                                            GrWrapOwnership) = 0;
+    virtual sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&)=0;
     virtual GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrAccessPattern,
                                      const void* data) = 0;
 
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index e641e74..3eb047c 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -113,7 +113,7 @@
         if (GrTexture* rtTex = rt->asTexture()) {
             // The render target is a texture, so we can read from it directly in the shader. The XP
             // will be responsible to detect this situation and request a texture barrier.
-            dstTexture->setTexture(rtTex);
+            dstTexture->setTexture(sk_ref_sp(rtTex));
             dstTexture->setOffset(0, 0);
             return true;
         }
@@ -145,15 +145,15 @@
     desc.fHeight = copyRect.height();
 
     static const uint32_t kFlags = 0;
-    SkAutoTUnref<GrTexture> copy(fResourceProvider->createApproxTexture(desc, kFlags));
+    sk_sp<GrTexture> copy(fResourceProvider->createApproxTexture(desc, kFlags));
 
     if (!copy) {
         SkDebugf("Failed to create temporary copy of destination texture.\n");
         return false;
     }
     SkIPoint dstPoint = {0, 0};
-    this->copySurface(copy, rt, copyRect, dstPoint);
-    dstTexture->setTexture(copy);
+    this->copySurface(copy.get(), rt, copyRect, dstPoint);
+    dstTexture->setTexture(std::move(copy));
     dstTexture->setOffset(copyRect.fLeft, copyRect.fTop);
     return true;
 }
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index b63a7ea..9739b05 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -205,8 +205,9 @@
     return rt->renderTargetPriv().getStencilAttachment();
 }
 
-GrRenderTarget* GrResourceProvider::wrapBackendTextureAsRenderTarget(
-        const GrBackendTextureDesc& desc) {
+sk_sp<GrRenderTarget> GrResourceProvider::wrapBackendTextureAsRenderTarget(
+        const GrBackendTextureDesc& desc)
+{
     if (this->isAbandoned()) {
         return nullptr;
     }
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 4c90cdd..c29a40a 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -164,7 +164,7 @@
       *
       * @return GrRenderTarget object or NULL on failure.
       */
-     GrRenderTarget* wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc);
+     sk_sp<GrRenderTarget> wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc);
 
 private:
     const GrBuffer* createInstancedIndexBuffer(const uint16_t* pattern,
diff --git a/src/gpu/GrTextureProvider.cpp b/src/gpu/GrTextureProvider.cpp
index 68a5540..dba24b5 100644
--- a/src/gpu/GrTextureProvider.cpp
+++ b/src/gpu/GrTextureProvider.cpp
@@ -158,8 +158,8 @@
     return nullptr;
 }
 
-GrTexture* GrTextureProvider::wrapBackendTexture(const GrBackendTextureDesc& desc,
-                                                 GrWrapOwnership ownership) {
+sk_sp<GrTexture> GrTextureProvider::wrapBackendTexture(const GrBackendTextureDesc& desc,
+                                                       GrWrapOwnership ownership) {
     ASSERT_SINGLE_OWNER
     if (this->isAbandoned()) {
         return nullptr;
@@ -167,10 +167,12 @@
     return fGpu->wrapBackendTexture(desc, ownership);
 }
 
-GrRenderTarget* GrTextureProvider::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& desc) {
+sk_sp<GrRenderTarget> GrTextureProvider::wrapBackendRenderTarget(
+    const GrBackendRenderTargetDesc& desc)
+{
     ASSERT_SINGLE_OWNER
-    return this->isAbandoned() ? nullptr : fGpu->wrapBackendRenderTarget(desc,
-                                                                         kBorrow_GrWrapOwnership);
+    return this->isAbandoned() ? nullptr
+                               : fGpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership);
 }
 
 void GrTextureProvider::assignUniqueKeyToResource(const GrUniqueKey& key, GrGpuResource* resource) {
diff --git a/src/gpu/gl/GrGLExtensions.cpp b/src/gpu/gl/GrGLExtensions.cpp
index 43a147d..29f7799 100644
--- a/src/gpu/gl/GrGLExtensions.cpp
+++ b/src/gpu/gl/GrGLExtensions.cpp
@@ -9,6 +9,7 @@
 #include "gl/GrGLDefines.h"
 #include "gl/GrGLUtil.h"
 
+#include "SkMakeUnique.h"
 #include "SkTSearch.h"
 #include "SkTSort.h"
 
@@ -99,12 +100,12 @@
         if (!extensions) {
             return false;
         }
-        eat_space_sep_strings(fStrings, extensions);
+        eat_space_sep_strings(fStrings.get(), extensions);
     }
     if (queryString) {
         const char* extensions = queryString(eglDisplay, GR_EGL_EXTENSIONS);
 
-        eat_space_sep_strings(fStrings, extensions);
+        eat_space_sep_strings(fStrings.get(), extensions);
     }
     if (!fStrings->empty()) {
         SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp;
@@ -122,27 +123,26 @@
 bool GrGLExtensions::remove(const char ext[]) {
     SkASSERT(fInitialized);
     int idx = find_string(*fStrings, ext);
-    if (idx >= 0) {
-        // This is not terribly effecient but we really only expect this function to be called at
-        // most a handful of times when our test programs start.
-        SkAutoTDelete< SkTArray<SkString> > oldStrings(fStrings.release());
-        fStrings.reset(new SkTArray<SkString>(oldStrings->count() - 1));
-        fStrings->push_back_n(idx, &oldStrings->front());
-        fStrings->push_back_n(oldStrings->count() - idx - 1, &(*oldStrings)[idx] + 1);
-        return true;
-    } else {
+    if (idx < 0) {
         return false;
     }
+
+    // This is not terribly effecient but we really only expect this function to be called at
+    // most a handful of times when our test programs start.
+    fStrings->removeShuffle(idx);
+    SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp;
+    SkTInsertionSort(&(fStrings->operator[](idx)), &fStrings->back(), cmp);
+    return true;
 }
 
 void GrGLExtensions::add(const char ext[]) {
     int idx = find_string(*fStrings, ext);
     if (idx < 0) {
-        // This is not the most effecient approach since we end up doing a full sort of the
+        // This is not the most effecient approach since we end up looking at all of the
         // extensions after the add
-        fStrings->push_back().set(ext);
+        fStrings->emplace_back(ext);
         SkTLessFunctionToFunctorAdaptor<SkString, extension_compare> cmp;
-        SkTQSort(&fStrings->front(), &fStrings->back(), cmp);
+        SkTInsertionSort(&fStrings->front(), &fStrings->back(), cmp);
     }
 }
 
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 4e579cc..485a9bd 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -624,8 +624,8 @@
     }
 }
 
-GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
-                                         GrWrapOwnership ownership) {
+sk_sp<GrTexture> GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
+                                               GrWrapOwnership ownership) {
     const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc.fTextureHandle);
     if (!info || !info->fID) {
         return nullptr;
@@ -681,25 +681,18 @@
         surfDesc.fOrigin = desc.fOrigin;
     }
 
-    GrGLTexture* texture = nullptr;
     if (renderTarget) {
         GrGLRenderTarget::IDDesc rtIDDesc;
         if (!this->createRenderTargetObjects(surfDesc, idDesc.fInfo, &rtIDDesc)) {
             return nullptr;
         }
-        texture = GrGLTextureRenderTarget::CreateWrapped(this, surfDesc, idDesc, rtIDDesc);
-    } else {
-        texture = GrGLTexture::CreateWrapped(this, surfDesc, idDesc);
+        return GrGLTextureRenderTarget::MakeWrapped(this, surfDesc, idDesc, rtIDDesc);
     }
-    if (nullptr == texture) {
-        return nullptr;
-    }
-
-    return texture;
+    return GrGLTexture::MakeWrapped(this, surfDesc, idDesc);
 }
 
-GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc,
-                                                   GrWrapOwnership ownership) {
+sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc,
+                                                         GrWrapOwnership ownership) {
     GrGLRenderTarget::IDDesc idDesc;
     idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle);
     idDesc.fMSColorRenderbufferID = 0;
@@ -719,10 +712,10 @@
     desc.fSampleCnt = SkTMin(wrapDesc.fSampleCnt, this->caps()->maxSampleCount());
     desc.fOrigin = resolve_origin(wrapDesc.fOrigin, true);
 
-    return GrGLRenderTarget::CreateWrapped(this, desc, idDesc, wrapDesc.fStencilBits);
+    return GrGLRenderTarget::MakeWrapped(this, desc, idDesc, wrapDesc.fStencilBits);
 }
 
-GrRenderTarget* GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc) {
+sk_sp<GrRenderTarget> GrGLGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc){
     const GrGLTextureInfo* info = reinterpret_cast<const GrGLTextureInfo*>(desc.fTextureHandle);
     if (!info || !info->fID) {
         return nullptr;
@@ -759,7 +752,7 @@
     if (!this->createRenderTargetObjects(surfDesc, texInfo, &rtIDDesc)) {
         return nullptr;
     }
-    return GrGLRenderTarget::CreateWrapped(this, surfDesc, rtIDDesc, 0);
+    return GrGLRenderTarget::MakeWrapped(this, surfDesc, rtIDDesc, 0);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index 29d20e4..4420c65 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -164,10 +164,10 @@
 
     GrBuffer* onCreateBuffer(size_t size, GrBufferType intendedType, GrAccessPattern,
                              const void* data) override;
-    GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) override;
-    GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
-                                              GrWrapOwnership) override;
-    GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&) override;
+    sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) override;
+    sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
+                                                    GrWrapOwnership) override;
+    sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&) override;
 
     gr_instanced::InstancedRendering* onCreateInstancedRendering() override;
 
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index f6ad3ba..65366bd 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -64,10 +64,10 @@
     SkASSERT(fGpuMemorySize <= WorstCaseSize(desc));
 }
 
-GrGLRenderTarget* GrGLRenderTarget::CreateWrapped(GrGLGpu* gpu,
-                                                  const GrSurfaceDesc& desc,
-                                                  const IDDesc& idDesc,
-                                                  int stencilBits) {
+sk_sp<GrGLRenderTarget> GrGLRenderTarget::MakeWrapped(GrGLGpu* gpu,
+                                                      const GrSurfaceDesc& desc,
+                                                      const IDDesc& idDesc,
+                                                      int stencilBits) {
     GrGLStencilAttachment* sb = nullptr;
     if (stencilBits) {
         GrGLStencilAttachment::IDDesc sbDesc;
@@ -80,7 +80,7 @@
         sb = new GrGLStencilAttachment(gpu, sbDesc, desc.fWidth, desc.fHeight,
                                        desc.fSampleCnt, format);
     }
-    return (new GrGLRenderTarget(gpu, desc, idDesc, sb));
+    return sk_sp<GrGLRenderTarget>(new GrGLRenderTarget(gpu, desc, idDesc, sb));
 }
 
 size_t GrGLRenderTarget::onGpuMemorySize() const {
diff --git a/src/gpu/gl/GrGLRenderTarget.h b/src/gpu/gl/GrGLRenderTarget.h
index 85e377f..08dd88d 100644
--- a/src/gpu/gl/GrGLRenderTarget.h
+++ b/src/gpu/gl/GrGLRenderTarget.h
@@ -31,10 +31,10 @@
         bool                       fIsMixedSampled;
     };
 
-    static GrGLRenderTarget* CreateWrapped(GrGLGpu*,
-                                           const GrSurfaceDesc&,
-                                           const IDDesc&,
-                                           int stencilBits);
+    static sk_sp<GrGLRenderTarget> MakeWrapped(GrGLGpu*,
+                                               const GrSurfaceDesc&,
+                                               const IDDesc&,
+                                               int stencilBits);
 
     void setViewport(const GrGLIRect& rect) { fViewport = rect; }
     const GrGLIRect& getViewport() const { return fViewport; }
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index ed75347..4653c5b 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -92,8 +92,8 @@
                                       texture_id.c_str());
 }
 
-GrGLTexture* GrGLTexture::CreateWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc,
-                                        const IDDesc& idDesc) {
-    return new GrGLTexture(gpu, kWrapped, desc, idDesc);
+sk_sp<GrGLTexture> GrGLTexture::MakeWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc,
+                                            const IDDesc& idDesc) {
+    return sk_sp<GrGLTexture>(new GrGLTexture(gpu, kWrapped, desc, idDesc));
 }
 
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index 05d26c8..ee027d7 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -56,7 +56,7 @@
 
     GrGLenum target() const { return fInfo.fTarget; }
 
-    static GrGLTexture* CreateWrapped(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&);
+    static sk_sp<GrGLTexture> MakeWrapped(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&);
 protected:
     // Constructor for subclasses.
     GrGLTexture(GrGLGpu*, const GrSurfaceDesc&, const IDDesc&);
diff --git a/src/gpu/gl/GrGLTextureRenderTarget.cpp b/src/gpu/gl/GrGLTextureRenderTarget.cpp
index 2ba469a..9b37fbb 100644
--- a/src/gpu/gl/GrGLTextureRenderTarget.cpp
+++ b/src/gpu/gl/GrGLTextureRenderTarget.cpp
@@ -44,9 +44,10 @@
     return true;
 }
 
-GrGLTextureRenderTarget* GrGLTextureRenderTarget::CreateWrapped(GrGLGpu* gpu,
-                                                                const GrSurfaceDesc& desc,
-                                                                const GrGLTexture::IDDesc& texIDDesc,
-                                                                const GrGLRenderTarget::IDDesc& rtIDDesc) {
-    return new GrGLTextureRenderTarget(gpu, desc, texIDDesc, rtIDDesc);
+sk_sp<GrGLTextureRenderTarget> GrGLTextureRenderTarget::MakeWrapped(
+    GrGLGpu* gpu, const GrSurfaceDesc& desc,
+    const GrGLTexture::IDDesc& texIDDesc, const GrGLRenderTarget::IDDesc& rtIDDesc)
+{
+    return sk_sp<GrGLTextureRenderTarget>(
+        new GrGLTextureRenderTarget(gpu, desc, texIDDesc, rtIDDesc));
 }
diff --git a/src/gpu/gl/GrGLTextureRenderTarget.h b/src/gpu/gl/GrGLTextureRenderTarget.h
index 0826cf3..c5c020f 100644
--- a/src/gpu/gl/GrGLTextureRenderTarget.h
+++ b/src/gpu/gl/GrGLTextureRenderTarget.h
@@ -40,9 +40,9 @@
 
     void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const override;
 
-    static GrGLTextureRenderTarget* CreateWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc,
-                                                  const GrGLTexture::IDDesc& texIDDesc,
-                                                  const GrGLRenderTarget::IDDesc& rtIDDesc);
+    static sk_sp<GrGLTextureRenderTarget> MakeWrapped(GrGLGpu* gpu, const GrSurfaceDesc& desc,
+                                                      const GrGLTexture::IDDesc& texIDDesc,
+                                                      const GrGLRenderTarget::IDDesc& rtIDDesc);
 protected:
     void onAbandon() override {
         GrGLRenderTarget::onAbandon();
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index b13e162..7d75921 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -756,8 +756,8 @@
     }
 }
 
-GrTexture* GrVkGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
-                                         GrWrapOwnership ownership) {
+sk_sp<GrTexture> GrVkGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
+                                               GrWrapOwnership ownership) {
     if (0 == desc.fTextureHandle) {
         return nullptr;
     }
@@ -791,22 +791,14 @@
     // In VK, we don't have this restriction
     surfDesc.fOrigin = resolve_origin(desc.fOrigin);
 
-    GrVkTexture* texture = nullptr;
-    if (renderTarget) {
-        texture = GrVkTextureRenderTarget::CreateWrappedTextureRenderTarget(this, surfDesc,
-                                                                            ownership, info);
-    } else {
-        texture = GrVkTexture::CreateWrappedTexture(this, surfDesc, ownership, info);
+    if (!renderTarget) {
+        return GrVkTexture::MakeWrappedTexture(this, surfDesc, ownership, info);
     }
-    if (!texture) {
-        return nullptr;
-    }
-
-    return texture;
+    return GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget(this, surfDesc, ownership, info);
 }
 
-GrRenderTarget* GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc,
-                                                   GrWrapOwnership ownership) {
+sk_sp<GrRenderTarget> GrVkGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc,
+                                                         GrWrapOwnership ownership) {
 
     const GrVkImageInfo* info =
         reinterpret_cast<const GrVkImageInfo*>(wrapDesc.fRenderTargetHandle);
@@ -824,12 +816,10 @@
 
     desc.fOrigin = resolve_origin(wrapDesc.fOrigin);
 
-    GrVkRenderTarget* tgt = GrVkRenderTarget::CreateWrappedRenderTarget(this, desc,
-                                                                        ownership,
-                                                                        info);
+    sk_sp<GrVkRenderTarget> tgt = GrVkRenderTarget::MakeWrappedRenderTarget(this, desc,
+                                                                            ownership, info);
     if (tgt && wrapDesc.fStencilBits) {
-        if (!createStencilAttachmentForRenderTarget(tgt, desc.fWidth, desc.fHeight)) {
-            tgt->unref();
+        if (!createStencilAttachmentForRenderTarget(tgt.get(), desc.fWidth, desc.fHeight)) {
             return nullptr;
         }
     }
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 77eb242..b622783 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -50,7 +50,7 @@
 
     ~GrVkGpu() override;
 
-    const GrVkInterface* vkInterface() const { return fBackendContext->fInterface; }
+    const GrVkInterface* vkInterface() const { return fBackendContext->fInterface.get(); }
     const GrVkCaps& vkCaps() const { return *fVkCaps; }
 
     VkDevice device() const { return fDevice; }
@@ -182,11 +182,13 @@
     GrTexture* onCreateCompressedTexture(const GrSurfaceDesc& desc, SkBudgeted,
                                          const SkTArray<GrMipLevel>&) override { return NULL; }
 
-    GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) override;
+    sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) override;
 
-    GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
-                                              GrWrapOwnership) override;
-    GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&) override { return NULL; }
+    sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
+                                                    GrWrapOwnership) override;
+    sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&) override {
+        return nullptr;
+    }
 
     GrBuffer* onCreateBuffer(size_t size, GrBufferType type, GrAccessPattern,
                              const void* data) override;
diff --git a/src/gpu/vk/GrVkRenderTarget.cpp b/src/gpu/vk/GrVkRenderTarget.cpp
index d6895d2..e2f0019 100644
--- a/src/gpu/vk/GrVkRenderTarget.cpp
+++ b/src/gpu/vk/GrVkRenderTarget.cpp
@@ -201,11 +201,11 @@
     return rt;
 }
 
-GrVkRenderTarget*
-GrVkRenderTarget::CreateWrappedRenderTarget(GrVkGpu* gpu,
-                                            const GrSurfaceDesc& desc,
-                                            GrWrapOwnership ownership,
-                                            const GrVkImageInfo* info) {
+sk_sp<GrVkRenderTarget>
+GrVkRenderTarget::MakeWrappedRenderTarget(GrVkGpu* gpu,
+                                          const GrSurfaceDesc& desc,
+                                          GrWrapOwnership ownership,
+                                          const GrVkImageInfo* info) {
     SkASSERT(info);
     // We can wrap a rendertarget without its allocation, as long as we don't take ownership
     SkASSERT(VK_NULL_HANDLE != info->fImage);
@@ -214,9 +214,8 @@
     GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImage::kBorrowed_Wrapped
                                                                       : GrVkImage::kAdopted_Wrapped;
 
-    GrVkRenderTarget* rt = GrVkRenderTarget::Create(gpu, SkBudgeted::kNo, desc, *info, wrapped);
-
-    return rt;
+    return sk_sp<GrVkRenderTarget>(
+        GrVkRenderTarget::Create(gpu, SkBudgeted::kNo, desc, *info, wrapped));
 }
 
 bool GrVkRenderTarget::completeStencilAttachment() {
diff --git a/src/gpu/vk/GrVkRenderTarget.h b/src/gpu/vk/GrVkRenderTarget.h
index e3ebefb..0855a6d 100644
--- a/src/gpu/vk/GrVkRenderTarget.h
+++ b/src/gpu/vk/GrVkRenderTarget.h
@@ -34,9 +34,9 @@
     static GrVkRenderTarget* CreateNewRenderTarget(GrVkGpu*, SkBudgeted, const GrSurfaceDesc&,
                                                    const GrVkImage::ImageDesc&);
 
-    static GrVkRenderTarget* CreateWrappedRenderTarget(GrVkGpu*, const GrSurfaceDesc&,
-                                                       GrWrapOwnership,
-                                                       const GrVkImageInfo*);
+    static sk_sp<GrVkRenderTarget> MakeWrappedRenderTarget(GrVkGpu*, const GrSurfaceDesc&,
+                                                           GrWrapOwnership,
+                                                           const GrVkImageInfo*);
 
     ~GrVkRenderTarget() override;
 
diff --git a/src/gpu/vk/GrVkTexture.cpp b/src/gpu/vk/GrVkTexture.cpp
index bf399a8..8c461f8 100644
--- a/src/gpu/vk/GrVkTexture.cpp
+++ b/src/gpu/vk/GrVkTexture.cpp
@@ -78,10 +78,10 @@
     return new GrVkTexture(gpu, budgeted, desc, info, imageView);
 }
 
-GrVkTexture* GrVkTexture::CreateWrappedTexture(GrVkGpu* gpu,
-                                               const GrSurfaceDesc& desc,
-                                               GrWrapOwnership ownership,
-                                               const GrVkImageInfo* info) {
+sk_sp<GrVkTexture> GrVkTexture::MakeWrappedTexture(GrVkGpu* gpu,
+                                                   const GrSurfaceDesc& desc,
+                                                   GrWrapOwnership ownership,
+                                                   const GrVkImageInfo* info) {
     SkASSERT(info);
     // Wrapped textures require both image and allocation (because they can be mapped)
     SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc.fMemory);
@@ -96,7 +96,7 @@
     GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImage::kBorrowed_Wrapped
                                                                       : GrVkImage::kAdopted_Wrapped;
 
-    return new GrVkTexture(gpu, kWrapped, desc, *info, imageView, wrapped);
+    return sk_sp<GrVkTexture>(new GrVkTexture(gpu, kWrapped, desc, *info, imageView, wrapped));
 }
 
 GrVkTexture::~GrVkTexture() {
diff --git a/src/gpu/vk/GrVkTexture.h b/src/gpu/vk/GrVkTexture.h
index 06d1475..70db548 100644
--- a/src/gpu/vk/GrVkTexture.h
+++ b/src/gpu/vk/GrVkTexture.h
@@ -21,8 +21,8 @@
     static GrVkTexture* CreateNewTexture(GrVkGpu*, SkBudgeted budgeted, const GrSurfaceDesc&,
                                          const GrVkImage::ImageDesc&);
 
-    static GrVkTexture* CreateWrappedTexture(GrVkGpu*, const GrSurfaceDesc&,
-                                             GrWrapOwnership, const GrVkImageInfo*);
+    static sk_sp<GrVkTexture> MakeWrappedTexture(GrVkGpu*, const GrSurfaceDesc&,
+                                                 GrWrapOwnership, const GrVkImageInfo*);
 
     ~GrVkTexture() override;
 
diff --git a/src/gpu/vk/GrVkTextureRenderTarget.cpp b/src/gpu/vk/GrVkTextureRenderTarget.cpp
index 37b68af..cfa63be 100644
--- a/src/gpu/vk/GrVkTextureRenderTarget.cpp
+++ b/src/gpu/vk/GrVkTextureRenderTarget.cpp
@@ -135,11 +135,11 @@
     return trt;
 }
 
-GrVkTextureRenderTarget*
-GrVkTextureRenderTarget::CreateWrappedTextureRenderTarget(GrVkGpu* gpu,
-                                                          const GrSurfaceDesc& desc,
-                                                          GrWrapOwnership ownership,
-                                                          const GrVkImageInfo* info) {
+sk_sp<GrVkTextureRenderTarget>
+GrVkTextureRenderTarget::MakeWrappedTextureRenderTarget(GrVkGpu* gpu,
+                                                        const GrSurfaceDesc& desc,
+                                                        GrWrapOwnership ownership,
+                                                        const GrVkImageInfo* info) {
     SkASSERT(info);
     // Wrapped textures require both image and allocation (because they can be mapped)
     SkASSERT(VK_NULL_HANDLE != info->fImage && VK_NULL_HANDLE != info->fAlloc.fMemory);
@@ -147,9 +147,7 @@
     GrVkImage::Wrapped wrapped = kBorrow_GrWrapOwnership == ownership ? GrVkImage::kBorrowed_Wrapped
                                                                       : GrVkImage::kAdopted_Wrapped;
 
-    GrVkTextureRenderTarget* trt = Create(gpu, desc, *info, SkBudgeted::kNo, wrapped);
-
-    return trt;
+    return sk_sp<GrVkTextureRenderTarget>(Create(gpu, desc, *info, SkBudgeted::kNo, wrapped));
 }
 
 bool GrVkTextureRenderTarget::updateForMipmap(GrVkGpu* gpu, const GrVkImageInfo& newInfo) {
diff --git a/src/gpu/vk/GrVkTextureRenderTarget.h b/src/gpu/vk/GrVkTextureRenderTarget.h
index 2259511..daa1687 100644
--- a/src/gpu/vk/GrVkTextureRenderTarget.h
+++ b/src/gpu/vk/GrVkTextureRenderTarget.h
@@ -28,10 +28,10 @@
                                                                  const GrSurfaceDesc&,
                                                                  const GrVkImage::ImageDesc&);
 
-    static GrVkTextureRenderTarget* CreateWrappedTextureRenderTarget(GrVkGpu*,
-                                                                     const GrSurfaceDesc&,
-                                                                     GrWrapOwnership,
-                                                                     const GrVkImageInfo*);
+    static sk_sp<GrVkTextureRenderTarget> MakeWrappedTextureRenderTarget(GrVkGpu*,
+                                                                         const GrSurfaceDesc&,
+                                                                         GrWrapOwnership,
+                                                                         const GrVkImageInfo*);
 
     bool updateForMipmap(GrVkGpu* gpu, const GrVkImageInfo& newInfo);
 
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index c9315bb..6af8491 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -23,17 +23,17 @@
 #include "SkMipMap.h"
 #include "SkPixelRef.h"
 
-SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, GrTexture* tex,
+SkImage_Gpu::SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType at, sk_sp<GrTexture> tex,
                          sk_sp<SkColorSpace> colorSpace, SkBudgeted budgeted)
     : INHERITED(w, h, uniqueID)
-    , fTexture(SkRef(tex))
+    , fTexture(std::move(tex))
     , fAlphaType(at)
     , fBudgeted(budgeted)
     , fColorSpace(std::move(colorSpace))
     , fAddedRasterVersionToCache(false)
 {
-    SkASSERT(tex->width() == w);
-    SkASSERT(tex->height() == h);
+    SkASSERT(fTexture->width() == w);
+    SkASSERT(fTexture->height() == h);
 }
 
 SkImage_Gpu::~SkImage_Gpu() {
@@ -149,9 +149,9 @@
     if (!subTx) {
         return nullptr;
     }
-    ctx->copySurface(subTx.get(), fTexture, subset, SkIPoint::Make(0, 0));
+    ctx->copySurface(subTx.get(), fTexture.get(), subset, SkIPoint::Make(0, 0));
     return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID,
-                                   fAlphaType, subTx.get(), fColorSpace, fBudgeted);
+                                   fAlphaType, std::move(subTx), fColorSpace, fBudgeted);
 }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -164,7 +164,7 @@
     if (desc.fWidth <= 0 || desc.fHeight <= 0) {
         return nullptr;
     }
-    SkAutoTUnref<GrTexture> tex(ctx->textureProvider()->wrapBackendTexture(desc, ownership));
+    sk_sp<GrTexture> tex = ctx->textureProvider()->wrapBackendTexture(desc, ownership);
     if (!tex) {
         return nullptr;
     }
@@ -174,7 +174,7 @@
 
     const SkBudgeted budgeted = SkBudgeted::kNo;
     return sk_make_sp<SkImage_Gpu>(desc.fWidth, desc.fHeight, kNeedNewImageUniqueID,
-                                   at, tex, colorSpace, budgeted);
+                                   at, std::move(tex), std::move(colorSpace), budgeted);
 }
 
 sk_sp<SkImage> SkImage::MakeFromTexture(GrContext* ctx, const GrBackendTextureDesc& desc,
@@ -271,7 +271,7 @@
     drawContext->drawRect(GrNoClip(), paint, SkMatrix::I(), rect);
     ctx->flushSurfaceWrites(drawContext->accessRenderTarget());
     return sk_make_sp<SkImage_Gpu>(width, height, kNeedNewImageUniqueID,
-                                   kOpaque_SkAlphaType, drawContext->asTexture().get(),
+                                   kOpaque_SkAlphaType, drawContext->asTexture(),
                                    sk_ref_sp(drawContext->getColorSpace()), budgeted);
 }
 
@@ -293,12 +293,12 @@
 }
 
 static sk_sp<SkImage> create_image_from_maker(GrTextureMaker* maker, SkAlphaType at, uint32_t id) {
-    SkAutoTUnref<GrTexture> texture(maker->refTextureForParams(GrTextureParams::ClampNoFilter(),
-                                                               SkSourceGammaTreatment::kRespect));
+    sk_sp<GrTexture> texture(maker->refTextureForParams(GrTextureParams::ClampNoFilter(),
+                                                        SkSourceGammaTreatment::kRespect));
     if (!texture) {
         return nullptr;
     }
-    return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), id, at, texture,
+    return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), id, at, std::move(texture),
                                    sk_ref_sp(maker->getColorSpace()), SkBudgeted::kNo);
 }
 
@@ -345,12 +345,12 @@
     if (!ctx) {
         return nullptr;
     }
-    SkAutoTUnref<GrTexture> texture(GrUploadPixmapToTexture(ctx, pixmap, budgeted));
+    sk_sp<GrTexture> texture(GrUploadPixmapToTexture(ctx, pixmap, budgeted));
     if (!texture) {
         return nullptr;
     }
     return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNewImageUniqueID,
-                                   pixmap.alphaType(), texture,
+                                   pixmap.alphaType(), std::move(texture),
                                    sk_ref_sp(pixmap.info().colorSpace()), budgeted);
 }
 
@@ -702,12 +702,12 @@
     if (!ctx) {
         return nullptr;
     }
-    SkAutoTUnref<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, mipLevelCount));
+    sk_sp<GrTexture> texture(GrUploadMipMapToTexture(ctx, info, texels, mipLevelCount));
     if (!texture) {
         return nullptr;
     }
     texture->texturePriv().setGammaTreatment(gammaTreatment);
     return sk_make_sp<SkImage_Gpu>(texture->width(), texture->height(), kNeedNewImageUniqueID,
-                                   info.alphaType(), texture, sk_ref_sp(info.colorSpace()),
-                                   budgeted);
+                                   info.alphaType(), std::move(texture),
+                                   sk_ref_sp(info.colorSpace()), budgeted);
 }
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 02260bc..b038086 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -23,7 +23,7 @@
      *  An "image" can be a subset/window into a larger texture, so we explicit take the
      *  width and height.
      */
-    SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType, GrTexture*, sk_sp<SkColorSpace>,
+    SkImage_Gpu(int w, int h, uint32_t uniqueID, SkAlphaType, sk_sp<GrTexture>, sk_sp<SkColorSpace>,
                 SkBudgeted);
     ~SkImage_Gpu() override;
 
@@ -43,20 +43,20 @@
                             SkSourceGammaTreatment) const override;
     sk_sp<SkImage> onMakeSubset(const SkIRect&) const override;
 
-    GrTexture* peekTexture() const override { return fTexture; }
+    GrTexture* peekTexture() const override { return fTexture.get(); }
     sk_sp<GrTexture> refPinnedTexture(uint32_t* uniqueID) const override {
         *uniqueID = this->uniqueID();
-        return sk_ref_sp(fTexture.get());
+        return fTexture;
     }
     bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes,
                       int srcX, int srcY, CachingHint) const override;
 
 private:
-    SkAutoTUnref<GrTexture>     fTexture;
-    const SkAlphaType           fAlphaType;
-    const SkBudgeted            fBudgeted;
-    sk_sp<SkColorSpace>         fColorSpace;
-    mutable SkAtomic<bool>      fAddedRasterVersionToCache;
+    sk_sp<GrTexture>       fTexture;
+    const SkAlphaType      fAlphaType;
+    const SkBudgeted       fBudgeted;
+    sk_sp<SkColorSpace>    fColorSpace;
+    mutable SkAtomic<bool> fAddedRasterVersionToCache;
 
 
     typedef SkImage_Base INHERITED;
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 3007313..37e8eeb 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -79,7 +79,7 @@
     GrRenderTarget* rt = fDevice->accessDrawContext()->accessRenderTarget();
     SkASSERT(rt);
     GrTexture* tex = rt->asTexture();
-    SkAutoTUnref<GrTexture> copy;
+    sk_sp<GrTexture> copy;
     // If the original render target is a buffer originally created by the client, then we don't
     // want to ever retarget the SkSurface at another buffer we create. Force a copy now to avoid
     // copy-on-write.
@@ -91,17 +91,17 @@
         if (!copy) {
             return nullptr;
         }
-        if (!ctx->copySurface(copy, rt)) {
+        if (!ctx->copySurface(copy.get(), rt)) {
             return nullptr;
         }
-        tex = copy;
+        tex = copy.get();
     }
     const SkImageInfo info = fDevice->imageInfo();
     sk_sp<SkImage> image;
     if (tex) {
         image = sk_make_sp<SkImage_Gpu>(info.width(), info.height(), kNeedNewImageUniqueID,
-                                        info.alphaType(), tex, sk_ref_sp(info.colorSpace()),
-                                        budgeted);
+                                        info.alphaType(), sk_ref_sp(tex),
+                                        sk_ref_sp(info.colorSpace()), budgeted);
     }
     return image;
 }
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index 7201dc1..33ae767 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -1085,11 +1085,11 @@
 }
 
 #include "SkFontMgr_indirect.h"
-SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(SkRemotableFontMgr* proxy) {
-    SkAutoTUnref<SkFontMgr> impl(SkFontMgr_New_DirectWrite());
-    if (impl.get() == nullptr) {
+SK_API SkFontMgr* SkFontMgr_New_DirectWriteRenderer(sk_sp<SkRemotableFontMgr> proxy) {
+    sk_sp<SkFontMgr> impl(SkFontMgr_New_DirectWrite());
+    if (!impl) {
         return nullptr;
     }
-    return new SkFontMgr_Indirect(impl.get(), proxy);
+    return new SkFontMgr_Indirect(std::move(impl), std::move(proxy));
 }
 #endif//defined(SK_BUILD_FOR_WIN32)
diff --git a/src/utils/SkDeferredCanvas.h b/src/utils/SkDeferredCanvas.h
index 2ac594c..68574ca 100644
--- a/src/utils/SkDeferredCanvas.h
+++ b/src/utils/SkDeferredCanvas.h
@@ -35,7 +35,6 @@
     SkImageInfo onImageInfo() const override;
     bool onGetProps(SkSurfaceProps*) const override;
     void onFlush() override;
-//    SkCanvas* canvasForDrawIter() override;
 
     void willSave() override;
     SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override;
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp
index 4a23a9c..de305c7 100644
--- a/tests/EGLImageTest.cpp
+++ b/tests/EGLImageTest.cpp
@@ -173,7 +173,7 @@
     externalDesc.fWidth = kSize;
     externalDesc.fHeight = kSize;
     externalDesc.fTextureHandle = reinterpret_cast<GrBackendObject>(&externalTexture);
-    SkAutoTUnref<GrTexture> externalTextureObj(
+    sk_sp<GrTexture> externalTextureObj(
         context0->textureProvider()->wrapBackendTexture(externalDesc));
     if (!externalTextureObj) {
         ERRORF(reporter, "Error wrapping external texture in GrTexture.");
@@ -183,7 +183,7 @@
 
     // Should not be able to wrap as a RT
     externalDesc.fFlags = kRenderTarget_GrBackendTextureFlag;
-    SkAutoTUnref<GrTexture> externalTextureRTObj(
+    sk_sp<GrTexture> externalTextureRTObj(
         context0->textureProvider()->wrapBackendTexture(externalDesc));
     if (externalTextureRTObj) {
         ERRORF(reporter, "Should not be able to wrap an EXTERNAL texture as a RT.");
@@ -192,18 +192,18 @@
 
     // Should not be able to wrap with a sample count
     externalDesc.fSampleCnt = 4;
-    SkAutoTUnref<GrTexture> externalTextureMSAAObj(
+    sk_sp<GrTexture> externalTextureMSAAObj(
         context0->textureProvider()->wrapBackendTexture(externalDesc));
     if (externalTextureMSAAObj) {
         ERRORF(reporter, "Should not be able to wrap an EXTERNAL texture with MSAA.");
     }
     externalDesc.fSampleCnt = 0;
 
-    test_read_pixels(reporter, context0, externalTextureObj, pixels.get());
+    test_read_pixels(reporter, context0, externalTextureObj.get(), pixels.get());
 
-    test_write_pixels(reporter, context0, externalTextureObj);
+    test_write_pixels(reporter, context0, externalTextureObj.get());
 
-    test_copy_surface(reporter, context0, externalTextureObj, pixels.get());
+    test_copy_surface(reporter, context0, externalTextureObj.get(), pixels.get());
 
     cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, image);
 }
diff --git a/tests/GrPorterDuffTest.cpp b/tests/GrPorterDuffTest.cpp
index 845dae1..719f787 100644
--- a/tests/GrPorterDuffTest.cpp
+++ b/tests/GrPorterDuffTest.cpp
@@ -1161,16 +1161,14 @@
     }
 
     GrBackendObject backendTex =
-        ctx->getGpu()->createTestingOnlyBackendTexture(nullptr, 100, 100,
-                                                           kRGBA_8888_GrPixelConfig);
+        ctx->getGpu()->createTestingOnlyBackendTexture(nullptr, 100, 100, kRGBA_8888_GrPixelConfig);
     GrBackendTextureDesc fakeDesc;
     fakeDesc.fConfig = kRGBA_8888_GrPixelConfig;
     fakeDesc.fWidth = fakeDesc.fHeight = 100;
     fakeDesc.fTextureHandle = backendTex;
-    SkAutoTUnref<GrTexture> fakeTexture(ctx->textureProvider()->wrapBackendTexture(fakeDesc,
-        kBorrow_GrWrapOwnership));
     GrXferProcessor::DstTexture fakeDstTexture;
-    fakeDstTexture.setTexture(fakeTexture);
+    fakeDstTexture.setTexture(
+        ctx->textureProvider()->wrapBackendTexture(fakeDesc, kBorrow_GrWrapOwnership));
 
     static const GrColor testColors[] = {
         0,
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index b6ca406..5a69e53 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -54,10 +54,10 @@
     backendDesc.fHeight = 256;
     backendDesc.fSampleCnt = 0;
     backendDesc.fTextureHandle = backendTex;
-    GrSurface* texRT2 = context->textureProvider()->wrapBackendTexture(
+    sk_sp<GrSurface> texRT2 = context->textureProvider()->wrapBackendTexture(
         backendDesc, kBorrow_GrWrapOwnership);
-    REPORTER_ASSERT(reporter, texRT2 == texRT2->asRenderTarget());
-    REPORTER_ASSERT(reporter, texRT2 == texRT2->asTexture());
+    REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asRenderTarget());
+    REPORTER_ASSERT(reporter, texRT2.get() == texRT2->asTexture());
     REPORTER_ASSERT(reporter, static_cast<GrSurface*>(texRT2->asRenderTarget()) ==
                     texRT2->asTexture());
     REPORTER_ASSERT(reporter, texRT2->asRenderTarget() ==
@@ -66,7 +66,6 @@
                     static_cast<GrSurface*>(texRT2->asTexture()));
 
     texRT1->unref();
-    texRT2->unref();
     tex1->unref();
     context->getGpu()->deleteTestingOnlyBackendTexture(backendTex);
 }
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index e7de369..a0ce16f 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -889,7 +889,7 @@
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(DeferredTextureImage, reporter, ctxInfo) {
     GrContext* context = ctxInfo.grContext();
     sk_gpu_test::TestContext* testContext = ctxInfo.testContext();
-    SkAutoTUnref<GrContextThreadSafeProxy> proxy(context->threadSafeProxy());
+    sk_sp<GrContextThreadSafeProxy> proxy = context->threadSafeProxy();
 
     GrContextFactory otherFactory;
     ContextInfo otherContextInfo =
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 99a4e5b..1b8071e 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -4007,7 +4007,7 @@
     static void TestPathRef(skiatest::Reporter* reporter) {
         static const int kRepeatCnt = 10;
 
-        SkAutoTUnref<SkPathRef> pathRef(new SkPathRef);
+        sk_sp<SkPathRef> pathRef(new SkPathRef);
 
         SkPathRef::Editor ed(&pathRef);
 
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index a21b5a2..1491326 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -187,7 +187,7 @@
             }
         }
 
-        SkAutoTUnref<GrTexture> rectangleTexture(
+        sk_sp<GrTexture> rectangleTexture(
             context->textureProvider()->wrapBackendTexture(rectangleDesc));
         if (!rectangleTexture) {
             ERRORF(reporter, "Error wrapping rectangle texture in GrTexture.");
@@ -195,15 +195,15 @@
             continue;
         }
 
-        test_read_pixels(reporter, context, rectangleTexture, refPixels);
+        test_read_pixels(reporter, context, rectangleTexture.get(), refPixels);
 
-        test_copy_surface_src(reporter, context, rectangleTexture, refPixels);
+        test_copy_surface_src(reporter, context, rectangleTexture.get(), refPixels);
 
-        test_copy_surface_dst(reporter, context, rectangleTexture);
+        test_copy_surface_dst(reporter, context, rectangleTexture.get());
 
-        test_write_pixels(reporter, context, rectangleTexture);
+        test_write_pixels(reporter, context, rectangleTexture.get());
 
-        test_clear(reporter, context, rectangleTexture);
+        test_clear(reporter, context, rectangleTexture.get());
 
         GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID));
     }
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index b6f13e6..3e4efb1 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -221,13 +221,14 @@
     desc.fHeight = kH;
 
     desc.fTextureHandle = texHandles[0];
-    SkAutoTUnref<GrTexture> borrowed(context->textureProvider()->wrapBackendTexture(
-                                     desc, kBorrow_GrWrapOwnership));
+    sk_sp<GrTexture> borrowed(context->textureProvider()->wrapBackendTexture(
+                              desc, kBorrow_GrWrapOwnership));
 
     desc.fTextureHandle = texHandles[1];
-    SkAutoTUnref<GrTexture> adopted(context->textureProvider()->wrapBackendTexture(
-                                    desc, kAdopt_GrWrapOwnership));
+    sk_sp<GrTexture> adopted(context->textureProvider()->wrapBackendTexture(
+                             desc, kAdopt_GrWrapOwnership));
 
+    printf("\nborrowed: %p, adopted: %p\n", borrowed.get(), adopted.get());
     REPORTER_ASSERT(reporter, borrowed != nullptr && adopted != nullptr);
     if (!borrowed || !adopted) {
         return;
diff --git a/tests/VkWrapTests.cpp b/tests/VkWrapTests.cpp
index b3456c2..58c4b35 100644
--- a/tests/VkWrapTests.cpp
+++ b/tests/VkWrapTests.cpp
@@ -39,9 +39,8 @@
     desc.fWidth = kW;
     desc.fHeight = kH;
     desc.fTextureHandle = backendObj;
-    GrTexture* tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership);
+    sk_sp<GrTexture> tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership);
     REPORTER_ASSERT(reporter, tex);
-    tex->unref();
 
     // image is null
     GrVkImageInfo backendCopy = *backendTex;
@@ -64,7 +63,6 @@
     backendCopy.fAlloc = backendTex->fAlloc;
     tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership);
     REPORTER_ASSERT(reporter, tex);
-    tex->unref();
 
     gpu->deleteTestingOnlyBackendTexture(backendObj, true);
 }
@@ -85,9 +83,8 @@
     desc.fSampleCnt = 0;
     desc.fStencilBits = 0;
     desc.fRenderTargetHandle = backendObj;
-    GrRenderTarget* rt = gpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership);
+    sk_sp<GrRenderTarget> rt = gpu->wrapBackendRenderTarget(desc, kBorrow_GrWrapOwnership);
     REPORTER_ASSERT(reporter, rt);
-    rt->unref();
 
     // image is null
     GrVkImageInfo backendCopy = *backendTex;
@@ -112,7 +109,6 @@
     backendCopy.fAlloc = backendTex->fAlloc;
     rt = gpu->wrapBackendRenderTarget(desc, kAdopt_GrWrapOwnership);
     REPORTER_ASSERT(reporter, rt);
-    rt->unref();
 
     gpu->deleteTestingOnlyBackendTexture(backendObj, true);
 }
@@ -131,9 +127,8 @@
     desc.fWidth = kW;
     desc.fHeight = kH;
     desc.fTextureHandle = backendObj;
-    GrTexture* tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership);
+    sk_sp<GrTexture> tex = gpu->wrapBackendTexture(desc, kBorrow_GrWrapOwnership);
     REPORTER_ASSERT(reporter, tex);
-    tex->unref();
 
     // image is null
     GrVkImageInfo backendCopy = *backendTex;
@@ -156,7 +151,6 @@
     backendCopy.fAlloc = backendTex->fAlloc;
     tex = gpu->wrapBackendTexture(desc, kAdopt_GrWrapOwnership);
     REPORTER_ASSERT(reporter, tex);
-    tex->unref();
 
     gpu->deleteTestingOnlyBackendTexture(backendObj, true);
 }
diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp
index 60c10e8..387ef32 100644
--- a/tools/gpu/GrTest.cpp
+++ b/tools/gpu/GrTest.cpp
@@ -337,15 +337,16 @@
         return nullptr;
     }
 
-    GrTexture* onWrapBackendTexture(const GrBackendTextureDesc&,
-                                    GrWrapOwnership) override { return nullptr; }
-
-    GrRenderTarget* onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
-                                              GrWrapOwnership) override {
+    sk_sp<GrTexture> onWrapBackendTexture(const GrBackendTextureDesc&, GrWrapOwnership) override {
         return nullptr;
     }
 
-    GrRenderTarget* onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&) override {
+    sk_sp<GrRenderTarget> onWrapBackendRenderTarget(const GrBackendRenderTargetDesc&,
+                                                    GrWrapOwnership) override {
+        return nullptr;
+    }
+
+    sk_sp<GrRenderTarget> onWrapBackendTextureAsRenderTarget(const GrBackendTextureDesc&) override {
         return nullptr;
     }
 
diff --git a/tools/gpu/vk/VkTestContext.h b/tools/gpu/vk/VkTestContext.h
index 5c6408a..ecec17b 100644
--- a/tools/gpu/vk/VkTestContext.h
+++ b/tools/gpu/vk/VkTestContext.h
@@ -24,7 +24,7 @@
 
     bool isValid() const override { return NULL != this->vk(); }
 
-    const GrVkInterface* vk() const { return fVk->fInterface; }
+    const GrVkInterface* vk() const { return fVk->fInterface.get(); }
 
 protected:
     VkTestContext(sk_sp<const GrVkBackendContext> vk) : fVk(std::move(vk)) {}