switch surface to sk_sp

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1817383002
CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot

Review URL: https://codereview.chromium.org/1817383002
diff --git a/bench/DisplacementBench.cpp b/bench/DisplacementBench.cpp
index c22b8fd..eadafb6 100644
--- a/bench/DisplacementBench.cpp
+++ b/bench/DisplacementBench.cpp
@@ -48,7 +48,7 @@
     void makeCheckerboard() {
         const int w = this->isSmall() ? FILTER_WIDTH_SMALL : FILTER_WIDTH_LARGE;
         const int h = this->isSmall() ? FILTER_HEIGHT_LARGE : FILTER_HEIGHT_LARGE;
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(w, h));
+        auto surface(SkSurface::MakeRasterN32Premul(w, h));
         SkCanvas* canvas = surface->getCanvas();
         canvas->clear(0x00000000);
         SkPaint darkPaint;
diff --git a/bench/ImageBench.cpp b/bench/ImageBench.cpp
index b07d267..fbfce05 100644
--- a/bench/ImageBench.cpp
+++ b/bench/ImageBench.cpp
@@ -31,12 +31,12 @@
     void onPerCanvasPreDraw(SkCanvas* canvas) override {
         // create an Image reflecting the canvas (gpu or cpu)
         SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
-        SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
+        auto surface(canvas->makeSurface(info));
         canvas->drawColor(SK_ColorRED);
         fImage = surface->makeImageSnapshot();
 
         // create a cpu-backed Surface
-        fRasterSurface.reset(SkSurface::NewRaster(info));
+        fRasterSurface = SkSurface::MakeRaster(info);
     }
 
     void onPerCanvasPostDraw(SkCanvas*) override {
@@ -57,7 +57,7 @@
 private:
     SkString                fName;
     sk_sp<SkImage>   fImage;
-    SkAutoTUnref<SkSurface> fRasterSurface;
+    sk_sp<SkSurface> fRasterSurface;
 
     typedef Benchmark INHERITED;
 };
diff --git a/bench/MergeBench.cpp b/bench/MergeBench.cpp
index b24f988..e1f7d97 100644
--- a/bench/MergeBench.cpp
+++ b/bench/MergeBench.cpp
@@ -51,7 +51,7 @@
     }
 
     void make_bitmap() {
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(80, 80));
+        auto surface(SkSurface::MakeRasterN32Premul(80, 80));
         surface->getCanvas()->clear(0x00000000);
         SkPaint paint;
         paint.setAntiAlias(true);
@@ -63,7 +63,7 @@
     }
 
     void make_checkerboard() {
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(80, 80));
+        auto surface(SkSurface::MakeRasterN32Premul(80, 80));
         SkCanvas* canvas = surface->getCanvas();
         canvas->clear(0x00000000);
         SkPaint darkPaint;
diff --git a/bench/SKPBench.cpp b/bench/SKPBench.cpp
index 1d378b5..add415d 100644
--- a/bench/SKPBench.cpp
+++ b/bench/SKPBench.cpp
@@ -72,7 +72,7 @@
         for (int x = bounds.fLeft; x < bounds.fRight; x += tileW) {
             const SkIRect tileRect = SkIRect::MakeXYWH(x, y, tileW, tileH);
             *fTileRects.append() = tileRect;
-            *fSurfaces.push() = canvas->newSurface(ii);
+            *fSurfaces.push() = canvas->makeSurface(ii).release();
 
             // Never want the contents of a tile to include stuff the parent
             // canvas clips out
diff --git a/bench/nanobench.cpp b/bench/nanobench.cpp
index 3a3bca6..c0f674f 100644
--- a/bench/nanobench.cpp
+++ b/bench/nanobench.cpp
@@ -132,8 +132,8 @@
 
 bool Target::init(SkImageInfo info, Benchmark* bench) {
     if (Benchmark::kRaster_Backend == config.backend) {
-        this->surface.reset(SkSurface::NewRaster(info));
-        if (!this->surface.get()) {
+        this->surface = SkSurface::MakeRaster(info);
+        if (!this->surface) {
             return false;
         }
     }
@@ -183,10 +183,10 @@
         uint32_t flags = this->config.useDFText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag :
                                                   0;
         SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
-        this->surface.reset(SkSurface::NewRenderTarget(gGrFactory->get(this->config.ctxType,
-                                                                       this->config.ctxOptions),
+        this->surface = SkSurface::MakeRenderTarget(gGrFactory->get(this->config.ctxType,
+                                                                    this->config.ctxOptions),
                                                          SkBudgeted::kNo, info,
-                                                         this->config.samples, &props));
+                                                         this->config.samples, &props);
         this->gl = gGrFactory->getContextInfo(this->config.ctxType,
                                               this->config.ctxOptions).fGLContext;
         if (!this->surface.get()) {
diff --git a/bench/nanobench.h b/bench/nanobench.h
index ad538dd..5e4efbf 100644
--- a/bench/nanobench.h
+++ b/bench/nanobench.h
@@ -44,7 +44,7 @@
     virtual ~Target() { }
 
     const Config config;
-    SkAutoTDelete<SkSurface> surface;
+    sk_sp<SkSurface> surface;
 
     /** Called once per target, immediately before any timing or drawing. */
     virtual void setup() { }
diff --git a/cmake/example.cpp b/cmake/example.cpp
index 93611d7..96bf4d3 100644
--- a/cmake/example.cpp
+++ b/cmake/example.cpp
@@ -47,15 +47,15 @@
 
 static std::shared_ptr<SkSurface> create_raster_surface(int w, int h) {
     std::cout << "Using raster surface" << std::endl;
-    return adopt(SkSurface::NewRasterN32Premul(w, h));
+    return adopt(SkSurface::MakeRasterN32Premul(w, h).release());
 }
 
 static std::shared_ptr<SkSurface> create_opengl_surface(int w, int h) {
     std::cout << "Using opengl surface" << std::endl;
     std::shared_ptr<GrContext> grContext = adopt(GrContext::Create(kOpenGL_GrBackend, 0));
-    return adopt(SkSurface::NewRenderTarget(grContext.get(),
+    return adopt(SkSurface::MakeRenderTarget(grContext.get(),
                                             SkBudgeted::kNo,
-                                            SkImageInfo::MakeN32Premul(w,h)));
+                                            SkImageInfo::MakeN32Premul(w,h)).release());
 }
 
 int main(int, char**) {
diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h
index ed27645..73adeb0 100644
--- a/dm/DMGpuSupport.h
+++ b/dm/DMGpuSupport.h
@@ -28,16 +28,16 @@
 
 static const bool kGPUDisabled = false;
 
-static inline SkSurface* NewGpuSurface(GrContextFactory* grFactory,
-                                       GrContextFactory::GLContextType type,
-                                       GrContextFactory::GLContextOptions options,
-                                       SkImageInfo info,
-                                       int samples,
-                                       bool useDIText) {
+static inline sk_sp<SkSurface> NewGpuSurface(GrContextFactory* grFactory,
+                                             GrContextFactory::GLContextType type,
+                                             GrContextFactory::GLContextOptions options,
+                                             SkImageInfo info,
+                                             int samples,
+                                             bool useDIText) {
     uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag : 0;
     SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
-    return SkSurface::NewRenderTarget(grFactory->get(type, options), SkBudgeted::kNo,
-                                      info, samples, &props);
+    return SkSurface::MakeRenderTarget(grFactory->get(type, options), SkBudgeted::kNo,
+                                       info, samples, &props);
 }
 
 }  // namespace DM
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 6fd46c8..78782a0 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -990,7 +990,7 @@
     }
 #endif
 
-    SkAutoTUnref<SkSurface> surface(
+    auto surface(
             NewGpuSurface(&factory, fContextType, fContextOptions, info, fSampleCount, fUseDIText));
     if (!surface) {
         return "Could not create a surface.";
@@ -1309,19 +1309,19 @@
         const int xTiles = (size.width()  + fW - 1) / fW,
                   yTiles = (size.height() + fH - 1) / fH;
         SkMultiPictureDraw mpd(xTiles*yTiles);
-        SkTDArray<SkSurface*> surfaces;
-        surfaces.setReserve(xTiles*yTiles);
+        SkTArray<sk_sp<SkSurface>> surfaces;
+//        surfaces.setReserve(xTiles*yTiles);
 
         SkImageInfo info = canvas->imageInfo().makeWH(fW, fH);
         for (int j = 0; j < yTiles; j++) {
             for (int i = 0; i < xTiles; i++) {
                 // This lets our ultimate Sink determine the best kind of surface.
                 // E.g., if it's a GpuSink, the surfaces and images are textures.
-                SkSurface* s = canvas->newSurface(info);
+                auto s = canvas->makeSurface(info);
                 if (!s) {
-                    s = SkSurface::NewRaster(info);  // Some canvases can't create surfaces.
+                    s = SkSurface::MakeRaster(info);  // Some canvases can't create surfaces.
                 }
-                surfaces.push(s);
+                surfaces.push_back(s);
                 SkCanvas* c = s->getCanvas();
                 c->translate(SkIntToScalar(-i * fW),
                              SkIntToScalar(-j * fH));  // Line up the canvas with this tile.
@@ -1335,7 +1335,6 @@
                 canvas->drawImage(image, SkIntToScalar(i*fW), SkIntToScalar(j*fH));
             }
         }
-        surfaces.unrefAll();
         return "";
     });
 }
diff --git a/example/HelloWorld.h b/example/HelloWorld.h
index ef4e417..619ee7c 100644
--- a/example/HelloWorld.h
+++ b/example/HelloWorld.h
@@ -36,11 +36,11 @@
     SkSurface* createSurface() override {
         SkSurfaceProps props(INHERITED::getSurfaceProps());
         if (kGPU_DeviceType == fType) {
-            return SkSurface::NewRenderTargetDirect(fRenderTarget, &props);
+            return SkSurface::MakeRenderTargetDirect(fRenderTarget, &props).release();
         }
         static const SkImageInfo info = SkImageInfo::MakeN32Premul(
                 SkScalarRoundToInt(this->width()), SkScalarRoundToInt(this->height()));
-        return fSurface = SkSurface::NewRaster(info, &props);
+        return fSurface = SkSurface::MakeRaster(info, &props).release();
     }
 
     void draw(SkCanvas* canvas) override;
diff --git a/gm/bigtileimagefilter.cpp b/gm/bigtileimagefilter.cpp
index 84b9816..7d3d3af 100644
--- a/gm/bigtileimagefilter.cpp
+++ b/gm/bigtileimagefilter.cpp
@@ -11,7 +11,7 @@
 #include "gm.h"
 
 static sk_sp<SkImage> create_circle_texture(int size, SkColor color) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(size, size));
+    auto surface(SkSurface::MakeRasterN32Premul(size, size));
     SkCanvas* canvas = surface->getCanvas();
     canvas->clear(0xFF000000);
 
diff --git a/gm/color4f.cpp b/gm/color4f.cpp
index ec9bbcb..7704dee 100644
--- a/gm/color4f.cpp
+++ b/gm/color4f.cpp
@@ -77,7 +77,7 @@
     for (auto profile : profiles) {
         const SkImageInfo info = SkImageInfo::Make(1024, 100, kN32_SkColorType, kPremul_SkAlphaType,
                                                    profile);
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+        auto surface(SkSurface::MakeRaster(info));
         surface->getCanvas()->drawPaint(bg);
         draw_into_canvas(surface->getCanvas());
         surface->draw(canvas, 0, 0, nullptr);
diff --git a/gm/complexclip_blur_tiled.cpp b/gm/complexclip_blur_tiled.cpp
index b619e67..9413e64 100644
--- a/gm/complexclip_blur_tiled.cpp
+++ b/gm/complexclip_blur_tiled.cpp
@@ -40,9 +40,9 @@
         }
         int ts = SkScalarCeilToInt(tile_size);
         SkImageInfo info = SkImageInfo::MakeN32Premul(ts, ts);
-        SkAutoTUnref<SkSurface> tileSurface(canvas->newSurface(info));
-        if (!tileSurface.get()) {
-            tileSurface.reset(SkSurface::NewRaster(info));
+        auto tileSurface(canvas->makeSurface(info));
+        if (!tileSurface) {
+            tileSurface = SkSurface::MakeRaster(info);
         }
         SkCanvas* tileCanvas = tileSurface->getCanvas();
         for (SkScalar y = bounds.top(); y < bounds.bottom(); y += tile_size) {
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index 545911c..0d5b1ff 100644
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -51,9 +51,8 @@
         SkImageInfo info = SkImageInfo::MakeN32Premul(onISize());
         SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
                              SkSurfaceProps::kLegacyFontHost_InitType);
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo,
-                                                                   info, 0, &props));
-        SkCanvas* canvas = surface.get() ? surface->getCanvas() : inputCanvas;
+        auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props));
+        SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas;
         // init our new canvas with the old canvas's matrix
         canvas->setMatrix(inputCanvas->getTotalMatrix());
 #else
diff --git a/gm/discard.cpp b/gm/discard.cpp
index 6f64b9c..d75f0ab 100644
--- a/gm/discard.cpp
+++ b/gm/discard.cpp
@@ -45,8 +45,7 @@
         size.fWidth /= 10;
         size.fHeight /= 10;
         SkImageInfo info = SkImageInfo::MakeN32Premul(size);
-        SkSurface* surface = SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info);
-
+        auto surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info);
         if (nullptr == surface) {
             return;
         }
@@ -78,7 +77,6 @@
         }
 
         surface->getCanvas()->discard();
-        surface->unref();
     }
 
 private:
diff --git a/gm/drawatlas.cpp b/gm/drawatlas.cpp
index 4d2f6d4..334aba7 100644
--- a/gm/drawatlas.cpp
+++ b/gm/drawatlas.cpp
@@ -13,9 +13,9 @@
 class DrawAtlasGM : public skiagm::GM {
     static sk_sp<SkImage> MakeAtlas(SkCanvas* caller, const SkRect& target) {
         SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
-        SkAutoTUnref<SkSurface> surface(caller->newSurface(info));
+        auto surface(caller->makeSurface(info));
         if (nullptr == surface) {
-            surface.reset(SkSurface::NewRaster(info));
+            surface = SkSurface::MakeRaster(info);
         }
         SkCanvas* canvas = surface->getCanvas();
         // draw red everywhere, but we don't expect to see it in the draw, testing the notion
diff --git a/gm/drawatlascolor.cpp b/gm/drawatlascolor.cpp
index 85a7a94..e8fd236 100644
--- a/gm/drawatlascolor.cpp
+++ b/gm/drawatlascolor.cpp
@@ -19,9 +19,9 @@
     const int kBlockSize = atlasSize/2;
 
     SkImageInfo info = SkImageInfo::MakeN32Premul(atlasSize, atlasSize);
-    SkAutoTUnref<SkSurface> surface(caller->newSurface(info));
+    auto surface(caller->makeSurface(info));
     if (nullptr == surface) {
-        surface.reset(SkSurface::NewRaster(info));
+        surface = SkSurface::MakeRaster(info);
     }
     SkCanvas* canvas = surface->getCanvas();
 
diff --git a/gm/drawbitmaprect.cpp b/gm/drawbitmaprect.cpp
index 8ec7cee..883e81b 100644
--- a/gm/drawbitmaprect.cpp
+++ b/gm/drawbitmaprect.cpp
@@ -36,10 +36,10 @@
 static sk_sp<SkImage> makebm(SkCanvas* origCanvas, SkBitmap* resultBM, int w, int h) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
     
-    SkAutoTUnref<SkSurface> surface(origCanvas->newSurface(info));
+    auto surface(origCanvas->makeSurface(info));
     if (nullptr == surface) {
         // picture canvas will return null, so fall-back to raster
-        surface.reset(SkSurface::NewRaster(info));
+        surface = SkSurface::MakeRaster(info);
     }
 
     SkCanvas* canvas = surface->getCanvas();
diff --git a/gm/drawminibitmaprect.cpp b/gm/drawminibitmaprect.cpp
index c494605..f5164f7 100644
--- a/gm/drawminibitmaprect.cpp
+++ b/gm/drawminibitmaprect.cpp
@@ -15,9 +15,9 @@
 
 static sk_sp<SkImage> makebm(SkCanvas* caller, int w, int h) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
-    SkAutoTUnref<SkSurface> surface(caller->newSurface(info));
+    auto surface(caller->makeSurface(info));
     if (nullptr == surface) {
-        surface.reset(SkSurface::NewRaster(info));
+        surface = SkSurface::MakeRaster(info);
     }
     SkCanvas* canvas = surface->getCanvas();
 
diff --git a/gm/fatpathfill.cpp b/gm/fatpathfill.cpp
index d76cd46..46e810e 100644
--- a/gm/fatpathfill.cpp
+++ b/gm/fatpathfill.cpp
@@ -15,8 +15,8 @@
 #define SMALL_H 3
 #define REPEAT_LOOP 5
 
-static SkSurface* new_surface(int width, int height) {
-    return SkSurface::NewRasterN32Premul(width, height);
+static sk_sp<SkSurface> new_surface(int width, int height) {
+    return SkSurface::MakeRasterN32Premul(width, height);
 }
 
 static void draw_pixel_centers(SkCanvas* canvas) {
@@ -49,7 +49,7 @@
 DEF_SIMPLE_GM(fatpathfill, canvas,
               SMALL_W * ZOOM,
               SMALL_H * ZOOM * REPEAT_LOOP) {
-        SkAutoTUnref<SkSurface> surface(new_surface(SMALL_W, SMALL_H));
+        auto surface(new_surface(SMALL_W, SMALL_H));
 
         canvas->scale(ZOOM, ZOOM);
 
@@ -62,7 +62,7 @@
             line.moveTo(1, 2);
             line.lineTo(SkIntToScalar(4 + i), 1);
             paint.getFillPath(line, &path);
-            draw_fatpath(canvas, surface, path);
+            draw_fatpath(canvas, surface.get(), path);
 
             canvas->translate(0, SMALL_H);
         }
diff --git a/gm/filterfastbounds.cpp b/gm/filterfastbounds.cpp
index 9dabdcb..1de30e5 100644
--- a/gm/filterfastbounds.cpp
+++ b/gm/filterfastbounds.cpp
@@ -264,7 +264,7 @@
         //-----------
         // Paints with a SkImageSource as a source
 
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
+        auto surface(SkSurface::MakeRasterN32Premul(10, 10));
         {
             SkPaint p;
             SkCanvas* temp = surface->getCanvas();
diff --git a/gm/image.cpp b/gm/image.cpp
index b32e430..8cc3023 100644
--- a/gm/image.cpp
+++ b/gm/image.cpp
@@ -167,21 +167,20 @@
         sk_bzero(fBuffer, fBufferSize);
 
         SkImageInfo info = SkImageInfo::MakeN32Premul(W, H);
-        SkAutoTUnref<SkSurface> surf0(SkSurface::NewRasterDirect(info, fBuffer, RB));
-        SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info));
-        SkAutoTUnref<SkSurface> surf2;  // gpu
+        sk_sp<SkSurface> surf0(SkSurface::MakeRasterDirect(info, fBuffer, RB));
+        sk_sp<SkSurface> surf1(SkSurface::MakeRaster(info));
+        sk_sp<SkSurface> surf2;  // gpu
 
 #if SK_SUPPORT_GPU
-        surf2.reset(SkSurface::NewRenderTarget(canvas->getGrContext(),
-                                               SkBudgeted::kNo, info));
+        surf2 = SkSurface::MakeRenderTarget(canvas->getGrContext(), SkBudgeted::kNo, info);
 #endif
 
-        test_surface(canvas, surf0, true);
+        test_surface(canvas, surf0.get(), true);
         canvas->translate(80, 0);
-        test_surface(canvas, surf1, true);
+        test_surface(canvas, surf1.get(), true);
         if (surf2) {
             canvas->translate(80, 0);
-            test_surface(canvas, surf2, true);
+            test_surface(canvas, surf2.get(), true);
         }
     }
 
@@ -238,7 +237,7 @@
 }
 
 static sk_sp<SkImage> make_raster(const SkImageInfo& info, GrContext*, void (*draw)(SkCanvas*)) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     draw(surface->getCanvas());
     return surface->makeImageSnapshot();
 }
@@ -258,7 +257,7 @@
 
 static sk_sp<SkImage> make_gpu(const SkImageInfo& info, GrContext* ctx, void (*draw)(SkCanvas*)) {
     if (!ctx) { return nullptr; }
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo, info));
+    auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
     draw(surface->getCanvas());
     return surface->makeImageSnapshot();
 }
@@ -335,7 +334,7 @@
 }
 
 static SkImageGenerator* gen_raster(const SkImageInfo& info) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     draw_opaque_contents(surface->getCanvas());
     return new ImageGeneratorFromImage(surface->makeImageSnapshot().get());
 }
@@ -481,9 +480,9 @@
         },
         // Create a texture image
         [context, render_image]() -> sk_sp<SkImage> {
-            SkAutoTUnref<SkSurface> surface(
-                SkSurface::NewRenderTarget(context, SkBudgeted::kYes,
-                                           SkImageInfo::MakeN32Premul(kSize, kSize)));
+            auto surface(
+                SkSurface::MakeRenderTarget(context, SkBudgeted::kYes,
+                                            SkImageInfo::MakeN32Premul(kSize, kSize)));
             if (!surface) {
                 return nullptr;
             }
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index b5eb522..32092213 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -211,8 +211,7 @@
         : SkImageGenerator(info)
         , fCtx(SkRef(ctx))
     {
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo,
-                                                                   info, 0));
+        auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
         surface->getCanvas()->clear(0);
         surface->getCanvas()->translate(-100, -100);
         surface->getCanvas()->drawPicture(pic);
diff --git a/gm/image_shader.cpp b/gm/image_shader.cpp
index 0615390..5fed7d1 100644
--- a/gm/image_shader.cpp
+++ b/gm/image_shader.cpp
@@ -27,7 +27,7 @@
 typedef sk_sp<SkImage> (*ImageMakerProc)(GrContext*, SkPicture*, const SkImageInfo&);
 
 static sk_sp<SkImage> make_raster(GrContext*, SkPicture* pic, const SkImageInfo& info) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     surface->getCanvas()->clear(0);
     surface->getCanvas()->drawPicture(pic);
     return surface->makeImageSnapshot();
@@ -37,8 +37,7 @@
     if (!ctx) {
         return nullptr;
     }
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo,
-                                                               info, 0));
+    auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
     surface->getCanvas()->clear(0);
     surface->getCanvas()->drawPicture(pic);
     return surface->makeImageSnapshot();
diff --git a/gm/imagealphathreshold.cpp b/gm/imagealphathreshold.cpp
index eafc32f..8d65cf8 100644
--- a/gm/imagealphathreshold.cpp
+++ b/gm/imagealphathreshold.cpp
@@ -95,9 +95,9 @@
 
     void onDraw(SkCanvas* canvas) override {
         SkImageInfo info = SkImageInfo::MakeN32(WIDTH, HEIGHT, kOpaque_SkAlphaType);
-        SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
+        auto surface(canvas->makeSurface(info));
         if (nullptr == surface) {
-            surface.reset(SkSurface::NewRaster(info));
+            surface = SkSurface::MakeRaster(info);
         }
         surface->getCanvas()->clear(SK_ColorWHITE);
         draw_rects(surface->getCanvas());
diff --git a/gm/imagefilters.cpp b/gm/imagefilters.cpp
index 21ce0fe..ab9ddf4 100644
--- a/gm/imagefilters.cpp
+++ b/gm/imagefilters.cpp
@@ -68,9 +68,9 @@
 
 static sk_sp<SkImage> make_image(SkCanvas* canvas) {
     const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
-    SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
+    auto surface(canvas->makeSurface(info));
     if (!surface) {
-        surface.reset(SkSurface::NewRaster(info));
+        surface = SkSurface::MakeRaster(info);
     }
     surface->getCanvas()->drawRect(SkRect::MakeXYWH(25, 25, 50, 50), SkPaint());
     return surface->makeImageSnapshot();
diff --git a/gm/imagefiltersclipped.cpp b/gm/imagefiltersclipped.cpp
index 26ee24b..01b0a43 100644
--- a/gm/imagefiltersclipped.cpp
+++ b/gm/imagefiltersclipped.cpp
@@ -47,7 +47,7 @@
         SkScalar x = SkIntToScalar(width / 2);
         SkScalar y = SkIntToScalar(height / 2);
         SkScalar radius = SkMinScalar(x, y) * 0.8f;
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, height));
+        auto surface(SkSurface::MakeRasterN32Premul(width, height));
         SkCanvas* canvas = surface->getCanvas();
         canvas->clear(0x00000000);
         SkColor colors[2];
diff --git a/gm/imagefilterscropexpand.cpp b/gm/imagefilterscropexpand.cpp
index ada206c..450610a 100644
--- a/gm/imagefilterscropexpand.cpp
+++ b/gm/imagefilterscropexpand.cpp
@@ -143,7 +143,7 @@
         SkScalar x = SkIntToScalar(width / 2);
         SkScalar y = SkIntToScalar(height / 2);
         SkScalar radius = SkMinScalar(x, y) * 0.8f;
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, height));
+        auto surface(SkSurface::MakeRasterN32Premul(width, height));
         SkCanvas* canvas = surface->getCanvas();
         canvas->clear(0x00000000);
         SkColor colors[2];
diff --git a/gm/imagefiltersscaled.cpp b/gm/imagefiltersscaled.cpp
index 391f4e5..9c01500 100644
--- a/gm/imagefiltersscaled.cpp
+++ b/gm/imagefiltersscaled.cpp
@@ -139,7 +139,7 @@
         SkScalar x = SkIntToScalar(width / 2);
         SkScalar y = SkIntToScalar(height / 2);
         SkScalar radius = SkScalarMul(SkMinScalar(x, y), SkIntToScalar(4) / SkIntToScalar(5));
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, height));
+        auto surface(SkSurface::MakeRasterN32Premul(width, height));
         SkCanvas* canvas = surface->getCanvas();
         canvas->clear(0x00000000);
         SkColor colors[2];
diff --git a/gm/imagefilterstransformed.cpp b/gm/imagefilterstransformed.cpp
index 4243902..e9a6a5d 100644
--- a/gm/imagefilterstransformed.cpp
+++ b/gm/imagefilterstransformed.cpp
@@ -29,7 +29,7 @@
     SkScalar y = SkIntToScalar(height / 2);
     SkScalar radius = SkMinScalar(x, y) * 0.8f;
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, height));
+    auto surface(SkSurface::MakeRasterN32Premul(width, height));
     SkCanvas* canvas = surface->getCanvas();
 
     canvas->clear(0x00000000);
diff --git a/gm/imagescalealigned.cpp b/gm/imagescalealigned.cpp
index 66ad8b6..474490f 100644
--- a/gm/imagescalealigned.cpp
+++ b/gm/imagescalealigned.cpp
@@ -73,7 +73,7 @@
         const SkPoint end   = SkPoint::Make(start.x() + vec.x() * (kSegLen - 1),
                                             start.y() + vec.y() * (kSegLen - 1));
 
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(kSegLen, kSegLen));
+        auto surface(SkSurface::MakeRasterN32Premul(kSegLen, kSegLen));
         surface->getCanvas()->clear(SK_ColorTRANSPARENT);
 
         SkPaint paint;
diff --git a/gm/imagesource2.cpp b/gm/imagesource2.cpp
index 46c42f1..db8a9f6 100644
--- a/gm/imagesource2.cpp
+++ b/gm/imagesource2.cpp
@@ -41,7 +41,7 @@
             SK_ColorWHITE,   SK_ColorGRAY,
         };
 
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(kImageSize, kImageSize));
+        auto surface(SkSurface::MakeRasterN32Premul(kImageSize, kImageSize));
         SkCanvas* canvas = surface->getCanvas();
 
         int curColor = 0;
diff --git a/gm/imagetoyuvplanes.cpp b/gm/imagetoyuvplanes.cpp
index ddead1b..63d3fa9 100644
--- a/gm/imagetoyuvplanes.cpp
+++ b/gm/imagetoyuvplanes.cpp
@@ -13,12 +13,12 @@
 #include "SkImage.h"
 
 static sk_sp<SkImage> create_image(GrContext* context, int width, int height) {
-    SkAutoTUnref<SkSurface> surface;
+    sk_sp<SkSurface> surface;
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
     if (context) {
-        surface.reset(SkSurface::NewRenderTarget(context,  SkBudgeted::kYes, info, 0));
+        surface = SkSurface::MakeRenderTarget(context,  SkBudgeted::kYes, info);
     } else {
-        surface.reset(SkSurface::NewRaster(info));
+        surface = SkSurface::MakeRaster(info);
     }
     if (!surface) {
         return nullptr;
diff --git a/gm/lcdblendmodes.cpp b/gm/lcdblendmodes.cpp
index c3fe9ff..874714b 100644
--- a/gm/lcdblendmodes.cpp
+++ b/gm/lcdblendmodes.cpp
@@ -61,9 +61,9 @@
         canvas->drawRect(r, p);
 
         SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
-        SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
+        auto surface(canvas->makeSurface(info));
         if (nullptr == surface) {
-            surface.reset(SkSurface::NewRaster(info));
+            surface = SkSurface::MakeRaster(info);
         }
 
         SkCanvas* surfCanvas = surface->getCanvas();
diff --git a/gm/localmatriximagefilter.cpp b/gm/localmatriximagefilter.cpp
index f996558..dd86c96 100644
--- a/gm/localmatriximagefilter.cpp
+++ b/gm/localmatriximagefilter.cpp
@@ -16,9 +16,9 @@
 
 static sk_sp<SkImage> make_image(SkCanvas* rootCanvas) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
-    SkAutoTUnref<SkSurface> surface(rootCanvas->newSurface(info));
+    auto surface(rootCanvas->makeSurface(info));
     if (!surface) {
-        surface.reset(SkSurface::NewRaster(info));
+        surface = SkSurface::MakeRaster(info);
     }
 
     SkPaint paint;
diff --git a/gm/mipmap.cpp b/gm/mipmap.cpp
index 4b1912a..9a0f060 100644
--- a/gm/mipmap.cpp
+++ b/gm/mipmap.cpp
@@ -13,7 +13,7 @@
 
 static sk_sp<SkImage> make_image() {
     const SkImageInfo info = SkImageInfo::MakeN32Premul(319, 52);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     SkCanvas* canvas = surface->getCanvas();
     canvas->drawColor(sk_tool_utils::color_to_565(0xFFF8F8F8));
 
diff --git a/gm/multipicturedraw.cpp b/gm/multipicturedraw.cpp
index a4b09b2..03934a6 100644
--- a/gm/multipicturedraw.cpp
+++ b/gm/multipicturedraw.cpp
@@ -241,15 +241,14 @@
     return recorder.finishRecordingAsPicture();
 }
 
-static SkSurface* create_compat_surface(SkCanvas* canvas, int width, int height) {
+static sk_sp<SkSurface> create_compat_surface(SkCanvas* canvas, int width, int height) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
 
-    SkSurface* surface = canvas->newSurface(info);
+    auto surface = canvas->makeSurface(info);
     if (nullptr == surface) {
         // picture canvas returns nullptr so fall back to raster
-        surface = SkSurface::NewRaster(info);
+        surface = SkSurface::MakeRaster(info);
     }
-
     return surface;
 }
 
@@ -257,13 +256,12 @@
 // fragments potentially generated by the MultiPictureDraw object
 class ComposeStep {
 public:
-    ComposeStep() : fSurf(nullptr), fX(0.0f), fY(0.0f), fPaint(nullptr) { }
+    ComposeStep() : fX(0.0f), fY(0.0f), fPaint(nullptr) { }
     ~ComposeStep() {
-        SkSafeUnref(fSurf);
         delete fPaint;
     }
 
-    SkSurface* fSurf;
+    sk_sp<SkSurface> fSurf;
     SkScalar   fX;
     SkScalar   fY;
     SkPaint*   fPaint;
diff --git a/gm/ninepatchstretch.cpp b/gm/ninepatchstretch.cpp
index f269376..9b0b94e 100644
--- a/gm/ninepatchstretch.cpp
+++ b/gm/ninepatchstretch.cpp
@@ -8,11 +8,11 @@
 #include "gm.h"
 #include "SkSurface.h"
 
-static SkSurface* make_surface(SkCanvas* root, int N) {
+static sk_sp<SkSurface> make_surface(SkCanvas* root, int N) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(N, N);
-    SkSurface* surface = root->newSurface(info);
+    auto surface = root->makeSurface(info);
     if (!surface) {
-        surface = SkSurface::NewRaster(info);
+        surface = SkSurface::MakeRaster(info);
     }
     return surface;
 }
@@ -22,7 +22,7 @@
     const int kStretchy = 8;
     const int kSize = 2*kFixed + kStretchy;
 
-    SkAutoTUnref<SkSurface> surface(make_surface(root, kSize));
+    auto surface(make_surface(root, kSize));
     SkCanvas* canvas = surface->getCanvas();
 
     SkRect r = SkRect::MakeWH(SkIntToScalar(kSize), SkIntToScalar(kSize));
diff --git a/gm/perspshaders.cpp b/gm/perspshaders.cpp
index b2ac328..2b09cc6 100644
--- a/gm/perspshaders.cpp
+++ b/gm/perspshaders.cpp
@@ -13,9 +13,9 @@
 
 static sk_sp<SkImage> make_image(SkCanvas* origCanvas, int w, int h) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(w, h);
-    SkAutoTUnref<SkSurface> surface(origCanvas->newSurface(info));
+    auto surface(origCanvas->makeSurface(info));
     if (nullptr == surface) {
-        surface.reset(SkSurface::NewRaster(info));
+        surface = SkSurface::MakeRaster(info);
     }
     SkCanvas* canvas = surface->getCanvas();
 
diff --git a/gm/resizeimagefilter.cpp b/gm/resizeimagefilter.cpp
index 2236b76..b8ed100 100644
--- a/gm/resizeimagefilter.cpp
+++ b/gm/resizeimagefilter.cpp
@@ -87,7 +87,7 @@
              deviceSize,
              kHigh_SkFilterQuality);
 
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(16, 16));
+        auto surface(SkSurface::MakeRasterN32Premul(16, 16));
         SkCanvas* surfaceCanvas = surface->getCanvas();
         surfaceCanvas->clear(0x000000);
         {
diff --git a/gm/srcmode.cpp b/gm/srcmode.cpp
index 28bb04b..93a9bc7 100644
--- a/gm/srcmode.cpp
+++ b/gm/srcmode.cpp
@@ -115,7 +115,7 @@
         }
     }
 
-    static SkSurface* compat_surface(SkCanvas* canvas, const SkISize& size, bool skipGPU) {
+    static sk_sp<SkSurface> compat_surface(SkCanvas* canvas, const SkISize& size, bool skipGPU) {
         SkImageInfo info = SkImageInfo::MakeN32Premul(size);
 
         bool callNewSurface = true;
@@ -124,17 +124,16 @@
             callNewSurface = false;
         }
 #endif
-        SkSurface* surface = callNewSurface ? canvas->newSurface(info) : nullptr;
+        sk_sp<SkSurface> surface = callNewSurface ? canvas->makeSurface(info) : nullptr;
         if (nullptr == surface) {
             // picture canvas will return null, so fall-back to raster
-            surface = SkSurface::NewRaster(info);
+            surface = SkSurface::MakeRaster(info);
         }
         return surface;
     }
 
     virtual void onDraw(SkCanvas* canvas) {
-        SkAutoTUnref<SkSurface> surf(compat_surface(canvas, this->getISize(),
-                                                    this->isCanvasDeferred()));
+        auto surf(compat_surface(canvas, this->getISize(), this->isCanvasDeferred()));
         surf->getCanvas()->drawColor(SK_ColorWHITE);
         this->drawContent(surf->getCanvas());
         surf->draw(canvas, 0, 0, nullptr);
diff --git a/gm/surface.cpp b/gm/surface.cpp
index c817f8d..436ea95 100644
--- a/gm/surface.cpp
+++ b/gm/surface.cpp
@@ -21,8 +21,8 @@
     return SkGradientShader::MakeLinear(pts, colors, nullptr, 2, SkShader::kClamp_TileMode);
 }
 
-static SkSurface* make_surface(GrContext* ctx, const SkImageInfo& info, SkPixelGeometry geo,
-                               int disallowAA, int disallowDither) {
+static sk_sp<SkSurface> make_surface(GrContext* ctx, const SkImageInfo& info, SkPixelGeometry geo,
+                                     int disallowAA, int disallowDither) {
     uint32_t flags = 0;
     if (disallowAA) {
         flags |= SkSurfaceProps::kDisallowAntiAlias_Flag;
@@ -33,9 +33,9 @@
 
     SkSurfaceProps props(flags, geo);
     if (ctx) {
-        return SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props);
+        return SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props);
     } else {
-        return SkSurface::NewRaster(info, &props);
+        return SkSurface::MakeRaster(info, &props);
     }
 }
 
@@ -92,8 +92,7 @@
             for (int disallowDither = 0; disallowDither <= 1; ++disallowDither) {
                 SkScalar y = 0;
                 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
-                    SkAutoTUnref<SkSurface> surface(make_surface(ctx, info, rec[i].fGeo,
-                                                                 disallowAA, disallowDither));
+                    auto surface(make_surface(ctx, info, rec[i].fGeo, disallowAA, disallowDither));
                     test_draw(surface->getCanvas(), rec[i].fLabel);
                     surface->draw(canvas, x, y, nullptr);
                     y += H;
@@ -134,16 +133,16 @@
     void onDraw(SkCanvas* canvas) override {
         SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
 
-        SkAutoTUnref<SkSurface> surf(canvas->newSurface(info, nullptr));
-        if (!surf.get()) {
-            surf.reset(SkSurface::NewRaster(info));
+        auto surf(canvas->makeSurface(info, nullptr));
+        if (!surf) {
+            surf = SkSurface::MakeRaster(info);
         }
         drawInto(surf->getCanvas());
 
         sk_sp<SkImage> image(surf->makeImageSnapshot());
         canvas->drawImage(image, 10, 10, nullptr);
 
-        SkAutoTUnref<SkSurface> surf2(surf->newSurface(info));
+        auto surf2(surf->makeSurface(info));
         drawInto(surf2->getCanvas());
 
         // Assert that the props were communicated transitively through the first image
diff --git a/gm/textblobgeometrychange.cpp b/gm/textblobgeometrychange.cpp
index bae2381..0632908 100644
--- a/gm/textblobgeometrychange.cpp
+++ b/gm/textblobgeometrychange.cpp
@@ -44,7 +44,7 @@
 
         SkImageInfo info = SkImageInfo::MakeN32Premul(200, 200);
         SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
-        SkAutoTUnref<SkSurface> surface(canvas->newSurface(info, &props));
+        auto surface(canvas->makeSurface(info, &props));
         if (surface) {
             SkCanvas* c = surface->getCanvas();
 
diff --git a/gm/textblobmixedsizes.cpp b/gm/textblobmixedsizes.cpp
index 7923489..b2697a8 100644
--- a/gm/textblobmixedsizes.cpp
+++ b/gm/textblobmixedsizes.cpp
@@ -98,7 +98,7 @@
 
     void onDraw(SkCanvas* inputCanvas) override {
         SkCanvas* canvas = inputCanvas;
-        SkAutoTUnref<SkSurface> surface;
+        sk_sp<SkSurface> surface;
         if (fUseDFT) {
 #if SK_SUPPORT_GPU
             // Create a new Canvas to enable DFT
@@ -106,8 +106,7 @@
             SkImageInfo info = SkImageInfo::MakeN32Premul(onISize());
             SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag,
                                  SkSurfaceProps::kLegacyFontHost_InitType);
-            surface.reset(SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo, info, 0,
-                                                     &props));
+            surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props);
             canvas = surface.get() ? surface->getCanvas() : inputCanvas;
             // init our new canvas with the old canvas's matrix
             canvas->setMatrix(inputCanvas->getTotalMatrix());
diff --git a/gm/textblobrandomfont.cpp b/gm/textblobrandomfont.cpp
index f21380e..ce726f2 100644
--- a/gm/textblobrandomfont.cpp
+++ b/gm/textblobrandomfont.cpp
@@ -102,7 +102,7 @@
 
         SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
         SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
-        SkAutoTUnref<SkSurface> surface(canvas->newSurface(info, &props));
+        auto surface(canvas->makeSurface(info, &props));
         if (surface) {
             SkPaint paint;
             paint.setAntiAlias(true);
diff --git a/gm/transparency.cpp b/gm/transparency.cpp
index 5e05761..5f32460 100644
--- a/gm/transparency.cpp
+++ b/gm/transparency.cpp
@@ -62,7 +62,7 @@
             sk_tool_utils::color_to_565(0xFF666666), 8);
     {
         SkAutoCanvasRestore autoCanvasRestore(canvas, true);
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(256, 9));
+        auto surface(SkSurface::MakeRasterN32Premul(256, 9));
         make_transparency(surface->getCanvas(), 256.0f, 9.0f);
         canvas->scale(7.0f, 120.0f);
         surface->draw(canvas, 0, 0, nullptr);
diff --git a/gm/verylargebitmap.cpp b/gm/verylargebitmap.cpp
index b3ed560..78f8f59 100644
--- a/gm/verylargebitmap.cpp
+++ b/gm/verylargebitmap.cpp
@@ -23,7 +23,7 @@
 }
 
 static sk_sp<SkImage> make_raster_image(int width, int height, SkColor colors[2]) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, height));
+    auto surface(SkSurface::MakeRasterN32Premul(width, height));
     draw(surface->getCanvas(), width, height, colors);
     return surface->makeImageSnapshot();
 }
diff --git a/gm/xfermodes3.cpp b/gm/xfermodes3.cpp
index 4cd05df5..84bc1e2 100644
--- a/gm/xfermodes3.cpp
+++ b/gm/xfermodes3.cpp
@@ -60,7 +60,7 @@
             0x80,
         };
 
-        SkAutoTUnref<SkSurface> tempSurface(this->possiblyCreateTempSurface(canvas, kSize, kSize));
+        auto tempSurface(this->possiblyCreateTempSurface(canvas, kSize, kSize));
 
         int test = 0;
         int x = 0, y = 0;
@@ -83,7 +83,7 @@
                     modePaint.setStyle(kStrokes[s].fStyle);
                     modePaint.setStrokeWidth(kStrokes[s].fWidth);
 
-                    this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempSurface);
+                    this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempSurface.get());
 
                     ++test;
                     x += kSize + 10;
@@ -100,7 +100,7 @@
                     modePaint.setStyle(kStrokes[s].fStyle);
                     modePaint.setStrokeWidth(kStrokes[s].fWidth);
 
-                    this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempSurface);
+                    this->drawMode(canvas, x, y, kSize, kSize, modePaint, tempSurface.get());
 
                     ++test;
                     x += kSize + 10;
@@ -122,13 +122,13 @@
      * So when running on a GPU canvas we explicitly create a temporary canvas using a texture with
      * dimensions exactly matching the layer size.
      */
-    SkSurface* possiblyCreateTempSurface(SkCanvas* baseCanvas, int w, int h) {
+    sk_sp<SkSurface> possiblyCreateTempSurface(SkCanvas* baseCanvas, int w, int h) {
 #if SK_SUPPORT_GPU
         GrContext* context = baseCanvas->getGrContext();
         SkImageInfo baseInfo = baseCanvas->imageInfo();
         SkImageInfo info = SkImageInfo::Make(w, h, baseInfo.colorType(), baseInfo.alphaType(),
                                              baseInfo.profileType());
-        return SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr);
+        return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr);
 #else
         return nullptr;
 #endif
diff --git a/gyp/skia_for_android_framework_defines.gypi b/gyp/skia_for_android_framework_defines.gypi
index a761084..88a9e23 100644
--- a/gyp/skia_for_android_framework_defines.gypi
+++ b/gyp/skia_for_android_framework_defines.gypi
@@ -23,6 +23,7 @@
       'SK_SUPPORT_LEGACY_DRAWFILTER',
       'SK_SUPPORT_LEGACY_CREATESHADER_PTR',
       'SK_SUPPORT_LEGACY_PATHEFFECT_PTR',
+      'SK_SUPPORT_LEGACY_NEW_SURFACE_API',
     ],
   },
 }
diff --git a/include/core/SkBitmapDevice.h b/include/core/SkBitmapDevice.h
index d1cb9ad..b53bfd0 100644
--- a/include/core/SkBitmapDevice.h
+++ b/include/core/SkBitmapDevice.h
@@ -160,7 +160,7 @@
 
     SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
 
-    SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override;
+    sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) override;
 
     SkImageFilter::Cache* getImageFilterCache() override;
 
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index d551031..bdb2eb0 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -186,7 +186,10 @@
      *  inherits the properties of the surface that owns this canvas. If this canvas has no parent
      *  surface, then the new surface is created with default properties.
      */
-    SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps* = NULL);
+    sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps* = nullptr);
+#ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
+    SkSurface* newSurface(const SkImageInfo& info, const SkSurfaceProps* props = NULL);
+#endif
 
     /**
      * Return the GPU context of the device that is associated with the canvas.
@@ -1252,7 +1255,7 @@
 
 protected:
     // default impl defers to getDevice()->newSurface(info)
-    virtual SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&);
+    virtual sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&);
 
     // default impl defers to its device
     virtual bool onPeekPixels(SkPixmap*);
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index cd13d54..7339342 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -296,7 +296,7 @@
     }
 
 protected:
-    virtual SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) { return NULL; }
+    virtual sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&);
     virtual bool onPeekPixels(SkPixmap*) { return false; }
 
     /**
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index c420c52..ec76d26 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -37,16 +37,16 @@
      *  If the requested surface cannot be created, or the request is not a
      *  supported configuration, NULL will be returned.
      */
-    static SkSurface* NewRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes,
-                                      const SkSurfaceProps* = NULL);
+    static sk_sp<SkSurface> MakeRasterDirect(const SkImageInfo&, void* pixels, size_t rowBytes,
+                                             const SkSurfaceProps* = nullptr);
 
     /**
      *  The same as NewRasterDirect, but also accepts a call-back routine, which is invoked
      *  when the surface is deleted, and is passed the pixel memory and the specified context.
      */
-    static SkSurface* NewRasterDirectReleaseProc(const SkImageInfo&, void* pixels, size_t rowBytes,
+    static sk_sp<SkSurface> MakeRasterDirectReleaseProc(const SkImageInfo&, void* pixels, size_t rowBytes,
                                                  void (*releaseProc)(void* pixels, void* context),
-                                                 void* context, const SkSurfaceProps* = NULL);
+                                                 void* context, const SkSurfaceProps* = nullptr);
 
     /**
      *  Return a new surface, with the memory for the pixels automatically allocated, but respecting
@@ -57,30 +57,28 @@
      *  If the requested surface cannot be created, or the request is not a
      *  supported configuration, NULL will be returned.
      */
-    static SkSurface* NewRaster(const SkImageInfo&, size_t rowBytes, const SkSurfaceProps*);
+    static sk_sp<SkSurface> MakeRaster(const SkImageInfo&, size_t rowBytes, const SkSurfaceProps*);
 
     /**
      *  Allocate a new surface, automatically computing the rowBytes.
      */
-    static SkSurface* NewRaster(const SkImageInfo&, const SkSurfaceProps* = NULL);
+    static sk_sp<SkSurface> MakeRaster(const SkImageInfo&, const SkSurfaceProps* = nullptr);
 
     /**
      *  Helper version of NewRaster. It creates a SkImageInfo with the
      *  specified width and height, and populates the rest of info to match
      *  pixels in SkPMColor format.
      */
-    static SkSurface* NewRasterN32Premul(int width, int height, const SkSurfaceProps* props = NULL) {
-        return NewRaster(SkImageInfo::MakeN32Premul(width, height), props);
+    static sk_sp<SkSurface> MakeRasterN32Premul(int width, int height,
+                                                const SkSurfaceProps* props = nullptr) {
+        return MakeRaster(SkImageInfo::MakeN32Premul(width, height), props);
     }
 
     /**
      *  Return a new surface using the specified render target.
      */
-    static SkSurface* NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*);
-
-    static SkSurface* NewRenderTargetDirect(GrRenderTarget* target) {
-        return NewRenderTargetDirect(target, NULL);
-    }
+    static sk_sp<SkSurface> MakeRenderTargetDirect(GrRenderTarget*,
+                                                   const SkSurfaceProps* = nullptr);
 
     /**
      *  Used to wrap a pre-existing backend 3D API texture as a SkSurface. The kRenderTarget flag
@@ -88,21 +86,17 @@
      *  of the texture and the client must ensure the texture is valid for the lifetime of the
      *  SkSurface.
      */
-    static SkSurface* NewFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
-                                            const SkSurfaceProps*);
-    // Legacy alias
-    static SkSurface* NewWrappedRenderTarget(GrContext* ctx, const GrBackendTextureDesc& desc,
-                                             const SkSurfaceProps* props) {
-        return NewFromBackendTexture(ctx, desc, props);
-    }
+    static sk_sp<SkSurface> MakeFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
+                                                   const SkSurfaceProps*);
 
     /**
      *  Used to wrap a pre-existing 3D API rendering target as a SkSurface. Skia will not assume
      *  ownership of the render target and the client must ensure the render target is valid for the
      *  lifetime of the SkSurface.
      */
-    static SkSurface* NewFromBackendRenderTarget(GrContext*, const GrBackendRenderTargetDesc&,
-                                                 const SkSurfaceProps*);
+    static sk_sp<SkSurface> MakeFromBackendRenderTarget(GrContext*,
+                                                        const GrBackendRenderTargetDesc&,
+                                                        const SkSurfaceProps*);
 
     /**
      *  Used to wrap a pre-existing 3D API texture as a SkSurface. Skia will treat the texture as
@@ -112,7 +106,7 @@
      *  of the texture and the client must ensure the texture is valid for the lifetime of the
      *  SkSurface.
      */
-    static SkSurface* NewFromBackendTextureAsRenderTarget(
+    static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(
             GrContext*, const GrBackendTextureDesc&, const SkSurfaceProps*);
 
     /**
@@ -122,13 +116,71 @@
      *  The GrTextureStorageAllocator will be reused if SkImage snapshots create
      *  additional textures.
      */
-    static SkSurface* NewRenderTarget(
-            GrContext*, SkBudgeted, const SkImageInfo&, int sampleCount,
-            const SkSurfaceProps* = NULL, GrTextureStorageAllocator = GrTextureStorageAllocator());
+    static sk_sp<SkSurface> MakeRenderTarget(
+            GrContext*, SkBudgeted, const SkImageInfo&, int sampleCount, const SkSurfaceProps*,
+            GrTextureStorageAllocator = GrTextureStorageAllocator());
 
+    static sk_sp<SkSurface> MakeRenderTarget(GrContext* gr, SkBudgeted b, const SkImageInfo& info) {
+        return MakeRenderTarget(gr, b, info, 0, nullptr);
+    }
+
+#ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
+    static SkSurface* NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes,
+                                      const SkSurfaceProps* props = NULL) {
+        return MakeRasterDirect(info, pixels, rowBytes, props).release();
+    }
+    static SkSurface* NewRasterDirectReleaseProc(const SkImageInfo& info, void* pixels,
+                                                 size_t rowBytes,
+                                                 void (*releaseProc)(void* pixels, void* context),
+                                                 void* context, const SkSurfaceProps* props = NULL){
+        return MakeRasterDirectReleaseProc(info, pixels, rowBytes, releaseProc, context,
+                                           props).release();
+    }
+    static SkSurface* NewRaster(const SkImageInfo& info, size_t rowBytes,
+                                const SkSurfaceProps* props) {
+        return MakeRaster(info, rowBytes, props).release();
+    }
+    static SkSurface* NewRaster(const SkImageInfo& info, const SkSurfaceProps* props = NULL) {
+        return MakeRaster(info, props).release();
+    }
+    static SkSurface* NewRasterN32Premul(int width, int height,
+                                         const SkSurfaceProps* props = NULL) {
+        return NewRaster(SkImageInfo::MakeN32Premul(width, height), props);
+    }
+    static SkSurface* NewRenderTargetDirect(GrRenderTarget* rt, const SkSurfaceProps* props) {
+        return MakeRenderTargetDirect(rt, props).release();
+    }
+    static SkSurface* NewRenderTargetDirect(GrRenderTarget* target) {
+        return NewRenderTargetDirect(target, NULL);
+    }
+    static SkSurface* NewFromBackendTexture(GrContext* ctx, const GrBackendTextureDesc& desc,
+                                            const SkSurfaceProps* props) {
+        return MakeFromBackendTexture(ctx, desc, props).release();
+    }
+    // Legacy alias
+    static SkSurface* NewWrappedRenderTarget(GrContext* ctx, const GrBackendTextureDesc& desc,
+                                             const SkSurfaceProps* props) {
+        return NewFromBackendTexture(ctx, desc, props);
+    }
+    static SkSurface* NewFromBackendRenderTarget(GrContext* ctx, const GrBackendRenderTargetDesc& d,
+                                                 const SkSurfaceProps* props) {
+        return MakeFromBackendRenderTarget(ctx, d, props).release();
+    }
+    static SkSurface* NewFromBackendTextureAsRenderTarget(GrContext* ctx,
+                                                          const GrBackendTextureDesc& desc,
+                                                          const SkSurfaceProps* props) {
+        return MakeFromBackendTextureAsRenderTarget(ctx, desc, props).release();
+    }
+    static SkSurface* NewRenderTarget(GrContext* ctx, SkBudgeted b, const SkImageInfo& info,
+                                      int sampleCount, const SkSurfaceProps* props = NULL,
+                                      GrTextureStorageAllocator a = GrTextureStorageAllocator()) {
+        return MakeRenderTarget(ctx, b, info, sampleCount, props, a).release();
+    }
     static SkSurface* NewRenderTarget(GrContext* gr, SkBudgeted b, const SkImageInfo& info) {
         return NewRenderTarget(gr, b, info, 0);
     }
+    SkSurface* newSurface(const SkImageInfo& info) { return this->makeSurface(info).release(); }
+#endif
 
     int width() const { return fWidth; }
     int height() const { return fHeight; }
@@ -223,7 +275,7 @@
      *  ... // draw using canvasB
      *  canvasA->drawSurface(surfaceB); // <--- this will always be optimal!
      */
-    SkSurface* newSurface(const SkImageInfo&);
+    sk_sp<SkSurface> makeSurface(const SkImageInfo&);
 
     /**
      *  Returns an image of the current state of the surface pixels up to this
diff --git a/public.bzl b/public.bzl
index 20914ea..f55cd35 100644
--- a/public.bzl
+++ b/public.bzl
@@ -522,6 +522,7 @@
     # Chrome DEFINES.
     "SK_USE_FLOATBITS",
     "SK_USE_FREETYPE_EMBOLDEN",
+    "SK_SUPPORT_LEGACY_NEW_SURFACE_API",
     "SK_SUPPORT_LEGACY_MINOR_EFFECT_PTR",
     "SK_SUPPORT_LEGACY_PATHEFFECT_PTR",
     # Turn on a few Google3-specific build fixes.
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index afd942b..3149711 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -291,7 +291,7 @@
 #if SK_SUPPORT_GPU
         if (IsGpuDeviceType(dType) && fCurContext) {
             SkSurfaceProps props(win->getSurfaceProps());
-            return SkSurface::NewRenderTargetDirect(fCurRenderTarget, &props);
+            return SkSurface::MakeRenderTargetDirect(fCurRenderTarget, &props).release();
         }
 #endif
         return nullptr;
@@ -1066,7 +1066,7 @@
         const SkScalar w = SkScalarCeilToScalar(tile.width());
         const SkScalar h = SkScalarCeilToScalar(tile.height());
         SkImageInfo info = SkImageInfo::MakeN32Premul(SkScalarTruncToInt(w), SkScalarTruncToInt(h));
-        SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
+        auto surface(canvas->makeSurface(info));
         SkCanvas* tileCanvas = surface->getCanvas();
 
         for (SkScalar y = 0; y < height(); y += h) {
diff --git a/samplecode/SampleAtlas.cpp b/samplecode/SampleAtlas.cpp
index 1075f4d..3061b14 100644
--- a/samplecode/SampleAtlas.cpp
+++ b/samplecode/SampleAtlas.cpp
@@ -41,7 +41,7 @@
 
 static sk_sp<SkImage> make_atlas(int atlasSize, int cellSize) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(atlasSize, atlasSize);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     SkCanvas* canvas = surface->getCanvas();
 
     SkPaint paint;
diff --git a/samplecode/SampleFatBits.cpp b/samplecode/SampleFatBits.cpp
index 4b15e37..dd58881 100644
--- a/samplecode/SampleFatBits.cpp
+++ b/samplecode/SampleFatBits.cpp
@@ -91,9 +91,9 @@
         fShader = sk_tool_utils::create_checkerboard_shader(0xFFCCCCCC, 0xFFFFFFFF, zoom);
 
         SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
-        fMinSurface.reset(SkSurface::NewRaster(info));
+        fMinSurface = SkSurface::MakeRaster(info);
         info = info.makeWH(width * zoom, height * zoom);
-        fMaxSurface.reset(SkSurface::NewRaster(info));
+        fMaxSurface = SkSurface::MakeRaster(info);
     }
 
     void drawBG(SkCanvas*);
@@ -111,8 +111,8 @@
     SkMatrix fMatrix, fInverse;
     SkRect   fBounds, fClipRect;
     sk_sp<SkShader> fShader;
-    SkAutoTUnref<SkSurface> fMinSurface;
-    SkAutoTUnref<SkSurface> fMaxSurface;
+    sk_sp<SkSurface> fMinSurface;
+    sk_sp<SkSurface> fMaxSurface;
 
     void setupPaint(SkPaint* paint) {
         bool aa = this->getAA();
@@ -162,7 +162,7 @@
     }
 
     void copyMinToMax() {
-        erase(fMaxSurface);
+        erase(fMaxSurface.get());
         SkCanvas* canvas = fMaxSurface->getCanvas();
         canvas->save();
         canvas->concat(fMatrix);
@@ -275,7 +275,7 @@
         apply_grid(pts, 2);
     }
 
-    erase(fMinSurface);
+    erase(fMinSurface.get());
     this->setupPaint(&paint);
     paint.setColor(FAT_PIXEL_COLOR);
     if (fUseClip) {
@@ -310,7 +310,7 @@
     SkRect r;
     r.set(pts, 2);
 
-    erase(fMinSurface);
+    erase(fMinSurface.get());
     this->setupPaint(&paint);
     paint.setColor(FAT_PIXEL_COLOR);
     {
@@ -356,7 +356,7 @@
     path.lineTo(pts[2]);
     path.close();
 
-    erase(fMinSurface);
+    erase(fMinSurface.get());
     this->setupPaint(&paint);
     paint.setColor(FAT_PIXEL_COLOR);
     fMinSurface->getCanvas()->drawPath(path, paint);
diff --git a/samplecode/SampleFilterQuality.cpp b/samplecode/SampleFilterQuality.cpp
index 9098901..ee99845 100644
--- a/samplecode/SampleFilterQuality.cpp
+++ b/samplecode/SampleFilterQuality.cpp
@@ -19,10 +19,10 @@
 #include "SkRandom.h"
 #include "SkTime.h"
 
-static SkSurface* make_surface(SkCanvas* canvas, const SkImageInfo& info) {
-    SkSurface* surface = canvas->newSurface(info);
+static sk_sp<SkSurface> make_surface(SkCanvas* canvas, const SkImageInfo& info) {
+    auto surface = canvas->makeSurface(info);
     if (!surface) {
-        surface = SkSurface::NewRaster(info);
+        surface = SkSurface::MakeRaster(info);
     }
     return surface;
 }
@@ -41,7 +41,7 @@
 
 static sk_sp<SkImage> make_image() {
     SkImageInfo info = SkImageInfo::MakeN32(N, N, kOpaque_SkAlphaType);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     SkCanvas* canvas = surface->getCanvas();
     canvas->drawColor(SK_ColorWHITE);
 
@@ -66,7 +66,7 @@
     
     SkImageInfo info = SkImageInfo::MakeN32(orig->width() * D, orig->height() * D,
                                             kOpaque_SkAlphaType);
-    SkAutoTUnref<SkSurface> surface(origSurf->newSurface(info));
+    auto surface(origSurf->makeSurface(info));
     SkCanvas* canvas = surface->getCanvas();
     canvas->drawColor(SK_ColorWHITE);
     canvas->scale(S, S);
@@ -217,12 +217,12 @@
 
         SkISize size = SkISize::Make(fImage->width(), fImage->height());
 
-        SkAutoTUnref<SkSurface> surface;
+        sk_sp<SkSurface> surface;
         if (fShowFatBits) {
             // scale up so we don't clip rotations
             SkImageInfo info = SkImageInfo::MakeN32(fImage->width() * 2, fImage->height() * 2,
                                                     kOpaque_SkAlphaType);
-            surface.reset(make_surface(canvas, info));
+            surface = make_surface(canvas, info);
             canvas = surface->getCanvas();
             canvas->drawColor(SK_ColorWHITE);
             size.set(info.width(), info.height());
@@ -234,7 +234,7 @@
 
         if (surface) {
             sk_sp<SkImage> orig(surface->makeImageSnapshot());
-            sk_sp<SkImage> zoomed(zoom_up(surface, orig.get()));
+            sk_sp<SkImage> zoomed(zoom_up(surface.get(), orig.get()));
             origCanvas->drawImage(zoomed.get(),
                                   SkScalarHalf(fCell.width() - zoomed->width()),
                                   SkScalarHalf(fCell.height() - zoomed->height()));
diff --git a/samplecode/SampleQuadStroker.cpp b/samplecode/SampleQuadStroker.cpp
index 48f29f7..40f01fd 100644
--- a/samplecode/SampleQuadStroker.cpp
+++ b/samplecode/SampleQuadStroker.cpp
@@ -76,7 +76,7 @@
     }
 }
 
-static void erase(SkSurface* surface) {
+static void erase(const sk_sp<SkSurface>& surface) {
     SkCanvas* canvas = surface->getCanvas();
     if (canvas) {
         canvas->clear(SK_ColorTRANSPARENT);
@@ -110,8 +110,8 @@
     SkRect fBounds;
     SkMatrix fMatrix, fInverse;
     sk_sp<SkShader> fShader;
-    SkAutoTUnref<SkSurface> fMinSurface;
-    SkAutoTUnref<SkSurface> fMaxSurface;
+    sk_sp<SkSurface> fMinSurface;
+    sk_sp<SkSurface> fMaxSurface;
     StrokeTypeButton fCubicButton;
     StrokeTypeButton fConicButton;
     StrokeTypeButton fQuadButton;
@@ -267,9 +267,9 @@
         fShader = sk_tool_utils::create_checkerboard_shader(0xFFCCCCCC, 0xFFFFFFFF, zoom);
 
         SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
-        fMinSurface.reset(SkSurface::NewRaster(info));
+        fMinSurface = SkSurface::MakeRaster(info);
         info = info.makeWH(width * zoom, height * zoom);
-        fMaxSurface.reset(SkSurface::NewRaster(info));
+        fMaxSurface = SkSurface::MakeRaster(info);
     }
 
     void draw_points(SkCanvas* canvas, const SkPath& path, SkColor color,
diff --git a/samplecode/SampleTextureDomain.cpp b/samplecode/SampleTextureDomain.cpp
index 2c6dd64..59d0822 100644
--- a/samplecode/SampleTextureDomain.cpp
+++ b/samplecode/SampleTextureDomain.cpp
@@ -60,7 +60,7 @@
         // Note:  GPU-backed bitmaps follow a different rendering path
         // when copying from one GPU device to another.
         SkImageInfo info = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
-        SkAutoTUnref<SkSurface> surface(canvas->newSurface(info));
+        auto surface(canvas->makeSurface(info));
 
         srcRect.setXYWH(1, 1, 3, 3);
         dstRect.setXYWH(1, 1, 3, 3);
diff --git a/src/c/sk_surface.cpp b/src/c/sk_surface.cpp
index 75a1643..fcc2246 100644
--- a/src/c/sk_surface.cpp
+++ b/src/c/sk_surface.cpp
@@ -433,7 +433,7 @@
     }
 
     SkSurfaceProps surfProps(0, geo);
-    return (sk_surface_t*)SkSurface::NewRaster(info, &surfProps);
+    return (sk_surface_t*)SkSurface::MakeRaster(info, &surfProps).release();
 }
 
 sk_surface_t* sk_surface_new_raster_direct(const sk_imageinfo_t* cinfo, void* pixels,
@@ -449,7 +449,7 @@
     }
 
     SkSurfaceProps surfProps(0, geo);
-    return (sk_surface_t*)SkSurface::NewRasterDirect(info, pixels, rowBytes, &surfProps);
+    return (sk_surface_t*)SkSurface::MakeRasterDirect(info, pixels, rowBytes, &surfProps).release();
 }
 
 void sk_surface_unref(sk_surface_t* csurf) {
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index fc0e63e..c8ac8d2 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -360,8 +360,8 @@
     draw.drawSprite(static_cast<SkBitmapDevice*>(device)->fBitmap, x, y, paint);
 }
 
-SkSurface* SkBitmapDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
-    return SkSurface::NewRaster(info, &props);
+sk_sp<SkSurface> SkBitmapDevice::makeSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
+    return SkSurface::MakeRaster(info, &props);
 }
 
 SkImageFilter::Cache* SkBitmapDevice::getImageFilterCache() {
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index f7f8702..7c1c07b 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1314,16 +1314,16 @@
     }
 }
 
-SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* props) {
+sk_sp<SkSurface> SkCanvas::makeSurface(const SkImageInfo& info, const SkSurfaceProps* props) {
     if (nullptr == props) {
         props = &fProps;
     }
     return this->onNewSurface(info, *props);
 }
 
-SkSurface* SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
+sk_sp<SkSurface> SkCanvas::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
     SkBaseDevice* dev = this->getDevice();
-    return dev ? dev->newSurface(info, props) : nullptr;
+    return dev ? dev->makeSurface(info, props) : nullptr;
 }
 
 SkImageInfo SkCanvas::imageInfo() const {
@@ -3043,3 +3043,9 @@
 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() {
     fCanvas->restoreToCount(fSaveCount);
 }
+
+#ifdef SK_SUPPORT_LEGACY_NEW_SURFACE_API
+SkSurface* SkCanvas::newSurface(const SkImageInfo& info, const SkSurfaceProps* props) {
+    return this->makeSurface(info, props).release();
+}
+#endif
diff --git a/src/core/SkDevice.cpp b/src/core/SkDevice.cpp
index fb4b48f..d854520 100644
--- a/src/core/SkDevice.cpp
+++ b/src/core/SkDevice.cpp
@@ -452,3 +452,6 @@
     return flags;
 }
 
+sk_sp<SkSurface> SkBaseDevice::makeSurface(SkImageInfo const&, SkSurfaceProps const&) {
+    return nullptr;
+}
diff --git a/src/core/SkPictureImageGenerator.cpp b/src/core/SkPictureImageGenerator.cpp
index f90ac0f..6f4ffa1 100644
--- a/src/core/SkPictureImageGenerator.cpp
+++ b/src/core/SkPictureImageGenerator.cpp
@@ -139,9 +139,8 @@
     //
     // TODO: respect the usage, by possibly creating a different (pow2) surface
     //
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted::kYes,
-                                                               surfaceInfo));
-    if (!surface.get()) {
+    sk_sp<SkSurface> surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kYes, surfaceInfo));
+    if (!surface) {
         return nullptr;
     }
 
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp
index 2718ee9..459402b 100644
--- a/src/core/SkPictureRecord.cpp
+++ b/src/core/SkPictureRecord.cpp
@@ -791,7 +791,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SkSurface* SkPictureRecord::onNewSurface(const SkImageInfo& info, const SkSurfaceProps&) {
+sk_sp<SkSurface> SkPictureRecord::onNewSurface(const SkImageInfo& info, const SkSurfaceProps&) {
     return nullptr;
 }
 
diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h
index 089bc81..129f94f 100644
--- a/src/core/SkPictureRecord.h
+++ b/src/core/SkPictureRecord.h
@@ -149,7 +149,7 @@
         SkASSERT(fWriter.bytesWritten() == initialOffset + size);
     }
 
-    SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
+    sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
     bool onPeekPixels(SkPixmap*) override { return false; }
 
     void willSave() override;
diff --git a/src/core/SkPixmap.cpp b/src/core/SkPixmap.cpp
index 787c922..e73440e 100644
--- a/src/core/SkPixmap.cpp
+++ b/src/core/SkPixmap.cpp
@@ -259,8 +259,7 @@
     }
     bitmap.setIsVolatile(true); // so we don't try to cache it
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterDirect(dst.info(), dst.writable_addr(),
-                                                               dst.rowBytes()));
+    auto surface(SkSurface::MakeRasterDirect(dst.info(), dst.writable_addr(), dst.rowBytes()));
     if (!surface) {
         return false;
     }
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 4e23da2..ff5c27d 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -11,6 +11,7 @@
 #include "SkPicture.h"
 #include "SkPictureUtils.h"
 #include "SkRecorder.h"
+#include "SkSurface.h"
 
 //#define WRAP_BITMAP_AS_IMAGE
 
@@ -381,3 +382,6 @@
     APPEND(ClipRegion, this->devBounds(), deviceRgn, op);
 }
 
+sk_sp<SkSurface> SkRecorder::onNewSurface(const SkImageInfo&, const SkSurfaceProps&) {
+    return nullptr;
+}
diff --git a/src/core/SkRecorder.h b/src/core/SkRecorder.h
index 44fb839..1299efb 100644
--- a/src/core/SkRecorder.h
+++ b/src/core/SkRecorder.h
@@ -122,7 +122,7 @@
     void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override;
     void onDrawAnnotation(const SkRect&, const char[], SkData*) override;
 
-    SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override { return nullptr; }
+    sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
 
     void flushMiniRecorder();
 
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index ecdd910..dfbde75 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -41,7 +41,7 @@
 
     virtual sk_sp<SkImage> onMakeTightSubset(const SkIRect& subset) const = 0;
 
-    virtual SkSurface* onMakeTightSurface(const SkImageInfo& info) const = 0;
+    virtual sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const = 0;
 
 private:
     typedef SkSpecialImage INHERITED;
@@ -105,8 +105,7 @@
 }
 
 sk_sp<SkSurface> SkSpecialImage::makeTightSurface(const SkImageInfo& info) const {
-    sk_sp<SkSurface> tmp(as_SIB(this)->onMakeTightSurface(info));
-    return tmp;
+    return as_SIB(this)->onMakeTightSurface(info);
 }
 
 sk_sp<SkSpecialImage> SkSpecialImage::makeSubset(const SkIRect& subset) const {
@@ -244,14 +243,14 @@
         return fImage->makeSubset(subset);
     }
 
-    SkSurface* onMakeTightSurface(const SkImageInfo& info) const override {
+    sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
 #if SK_SUPPORT_GPU
         GrTexture* texture = as_IB(fImage.get())->peekTexture();
         if (texture) {
-            return SkSurface::NewRenderTarget(texture->getContext(), SkBudgeted::kYes, info, 0);
+            return SkSurface::MakeRenderTarget(texture->getContext(), SkBudgeted::kYes, info);
         }
 #endif
-        return SkSurface::NewRaster(info, nullptr);
+        return SkSurface::MakeRaster(info, nullptr);
     }
 
 private:
@@ -369,8 +368,8 @@
         return SkImage::MakeFromBitmap(subsetBM);
     }
 
-    SkSurface* onMakeTightSurface(const SkImageInfo& info) const override {
-        return SkSurface::NewRaster(info);
+    sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
+        return SkSurface::MakeRaster(info);
     }
 
 private:
@@ -512,8 +511,8 @@
                                        fAlphaType, subTx, SkBudgeted::kYes);
     }
 
-    SkSurface* onMakeTightSurface(const SkImageInfo& info) const override {
-        return SkSurface::NewRenderTarget(fTexture->getContext(), SkBudgeted::kYes, info);
+    sk_sp<SkSurface> onMakeTightSurface(const SkImageInfo& info) const override {
+        return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::kYes, info);
     }
 
 private:
diff --git a/src/gpu/GrLayerHoister.cpp b/src/gpu/GrLayerHoister.cpp
index 5638d8a..f1a51a8 100644
--- a/src/gpu/GrLayerHoister.cpp
+++ b/src/gpu/GrLayerHoister.cpp
@@ -232,7 +232,7 @@
     if (atlased.count() > 0) {
         // All the atlased layers are rendered into the same GrTexture
         SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(
+        auto surface(SkSurface::MakeRenderTargetDirect(
                                         atlased[0].fLayer->texture()->asRenderTarget(), &props));
 
         SkCanvas* atlasCanvas = surface->getCanvas();
@@ -334,7 +334,7 @@
 
         // Each non-atlased layer has its own GrTexture
         SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(
+        auto surface(SkSurface::MakeRenderTargetDirect(
                                         layer->texture()->asRenderTarget(), &props));
 
         SkCanvas* layerCanvas = surface->getCanvas();
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 823e9b8..f4a1d4e 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1799,12 +1799,12 @@
     }
 }
 
-SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
+sk_sp<SkSurface> SkGpuDevice::makeSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
     ASSERT_SINGLE_OWNER
     // TODO: Change the signature of newSurface to take a budgeted parameter.
     static const SkBudgeted kBudgeted = SkBudgeted::kNo;
-    return SkSurface::NewRenderTarget(fContext, kBudgeted, info, fRenderTarget->desc().fSampleCnt,
-                                      &props);
+    return SkSurface::MakeRenderTarget(fContext, kBudgeted, info, fRenderTarget->desc().fSampleCnt,
+                                       &props);
 }
 
 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture* mainPicture,
diff --git a/src/gpu/SkGpuDevice.h b/src/gpu/SkGpuDevice.h
index e57da44..8d69e4c 100644
--- a/src/gpu/SkGpuDevice.h
+++ b/src/gpu/SkGpuDevice.h
@@ -180,7 +180,7 @@
 
     SkBaseDevice* onCreateDevice(const CreateInfo&, const SkPaint*) override;
 
-    SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override;
+    sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) override;
 
     SkImageFilter::Cache* getImageFilterCache() override;
 
diff --git a/src/image/SkImage_Base.h b/src/image/SkImage_Base.h
index 8dc2cb6..ec5556a 100644
--- a/src/image/SkImage_Base.h
+++ b/src/image/SkImage_Base.h
@@ -39,8 +39,8 @@
     // but only inspect them (or encode them).
     virtual bool getROPixels(SkBitmap*, CachingHint = kAllow_CachingHint) const = 0;
 
-    virtual SkSurface* onNewSurface(const SkImageInfo& info) const {
-        return SkSurface::NewRaster(info);
+    virtual sk_sp<SkSurface> onNewSurface(const SkImageInfo& info) const {
+        return SkSurface::MakeRaster(info);
     }
 
     // Caller must call unref when they are done.
diff --git a/src/image/SkImage_Generator.cpp b/src/image/SkImage_Generator.cpp
index f8af12a..44dd7b1 100644
--- a/src/image/SkImage_Generator.cpp
+++ b/src/image/SkImage_Generator.cpp
@@ -79,7 +79,7 @@
 
     const SkImageInfo info = SkImageInfo::MakeN32(subset.width(), subset.height(),
                                       this->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     if (!surface) {
         return nullptr;
     }
diff --git a/src/image/SkImage_Gpu.h b/src/image/SkImage_Gpu.h
index 8f59af1..333a963 100644
--- a/src/image/SkImage_Gpu.h
+++ b/src/image/SkImage_Gpu.h
@@ -42,8 +42,8 @@
     bool onReadPixels(const SkImageInfo&, void* dstPixels, size_t dstRowBytes,
                       int srcX, int srcY, CachingHint) const override;
 
-    SkSurface* onNewSurface(const SkImageInfo& info) const override {
-        return SkSurface::NewRenderTarget(fTexture->getContext(), SkBudgeted::kNo, info);
+    sk_sp<SkSurface> onNewSurface(const SkImageInfo& info) const override {
+        return SkSurface::MakeRenderTarget(fTexture->getContext(), SkBudgeted::kNo, info);
     }
 
     bool asBitmapForImageFilters(SkBitmap* bitmap) const override;
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 764d5eb..83daab7 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -176,7 +176,7 @@
     // TODO : could consider heurist of sharing pixels, if subset is pretty close to complete
 
     SkImageInfo info = SkImageInfo::MakeN32(subset.width(), subset.height(), fBitmap.alphaType());
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     if (!surface) {
         return nullptr;
     }
diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp
index bb807ba..b3a65fa 100644
--- a/src/image/SkSurface.cpp
+++ b/src/image/SkSurface.cpp
@@ -172,7 +172,7 @@
     return asSB(this)->refCachedImage(budgeted, unique);
 }
 
-SkSurface* SkSurface::newSurface(const SkImageInfo& info) {
+sk_sp<SkSurface> SkSurface::makeSurface(const SkImageInfo& info) {
     return asSB(this)->onNewSurface(info);
 }
 
@@ -222,27 +222,28 @@
 
 #if !SK_SUPPORT_GPU
 
-SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*) {
+sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget*, const SkSurfaceProps*) {
     return nullptr;
 }
 
-SkSurface* SkSurface::NewRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&, int,
-                                      const SkSurfaceProps*, GrTextureStorageAllocator) {
+sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext*, SkBudgeted, const SkImageInfo&, int,
+                                             const SkSurfaceProps*, GrTextureStorageAllocator) {
     return nullptr;
 }
 
-SkSurface* SkSurface::NewFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
-                                             const SkSurfaceProps*) {
+sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext*, const GrBackendTextureDesc&,
+                                                   const SkSurfaceProps*) {
     return nullptr;
 }
 
-SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext*, const GrBackendRenderTargetDesc&,
-                                                 const SkSurfaceProps*) {
+sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*,
+                                                        const GrBackendRenderTargetDesc&,
+                                                        const SkSurfaceProps*) {
     return nullptr;
 }
 
-SkSurface* NewFromBackendTextureAsRenderTarget(GrContext*, const GrBackendTextureDesc&,
-                                               const SkSurfaceProps*) {
+sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext*, const GrBackendTextureDesc&,
+                                                      const SkSurfaceProps*) {
     return nullptr;
 }
 
diff --git a/src/image/SkSurface_Base.h b/src/image/SkSurface_Base.h
index 96dd305..7164c88 100644
--- a/src/image/SkSurface_Base.h
+++ b/src/image/SkSurface_Base.h
@@ -35,7 +35,7 @@
      */
     virtual SkCanvas* onNewCanvas() = 0;
 
-    virtual SkSurface* onNewSurface(const SkImageInfo&) = 0;
+    virtual sk_sp<SkSurface> onNewSurface(const SkImageInfo&) = 0;
 
     /**
      *  Allocate an SkImage that represents the current contents of the surface.
@@ -43,7 +43,7 @@
      *  must faithfully represent the current contents, even if the surface
      *  is changed after this called (e.g. it is drawn to via its canvas).
      */
-    virtual SkImage* onNewImageSnapshot(SkBudgeted, ForceCopyMode) = 0;
+    virtual sk_sp<SkImage> onNewImageSnapshot(SkBudgeted, ForceCopyMode) = 0;
 
     /**
      *  Default implementation:
@@ -124,7 +124,7 @@
     }
     ForceCopyMode fcm = (kYes_ForceUnique == unique) ? kYes_ForceCopyMode :
                                                        kNo_ForceCopyMode;
-    snap = this->onNewImageSnapshot(budgeted, fcm);
+    snap = this->onNewImageSnapshot(budgeted, fcm).release();
     if (kNo_ForceUnique == unique) {
         SkASSERT(!fCachedImage);
         fCachedImage = SkSafeRef(snap);
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 649db12..a023acd 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -68,16 +68,16 @@
     return new SkCanvas(fDevice, flags);
 }
 
-SkSurface* SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
+sk_sp<SkSurface> SkSurface_Gpu::onNewSurface(const SkImageInfo& info) {
     GrRenderTarget* rt = fDevice->accessRenderTarget();
     int sampleCount = rt->numColorSamples();
     // TODO: Make caller specify this (change virtual signature of onNewSurface).
     static const SkBudgeted kBudgeted = SkBudgeted::kNo;
-    return SkSurface::NewRenderTarget(fDevice->context(), kBudgeted, info, sampleCount,
-                                      &this->props());
+    return SkSurface::MakeRenderTarget(fDevice->context(), kBudgeted, info, sampleCount,
+                                       &this->props());
 }
 
-SkImage* SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted, ForceCopyMode forceCopyMode) {
+sk_sp<SkImage> SkSurface_Gpu::onNewImageSnapshot(SkBudgeted budgeted, ForceCopyMode forceCopyMode) {
     GrRenderTarget* rt = fDevice->accessRenderTarget();
     SkASSERT(rt);
     GrTexture* tex = rt->asTexture();
@@ -99,10 +99,10 @@
         tex = copy;
     }
     const SkImageInfo info = fDevice->imageInfo();
-    SkImage* image = nullptr;
+    sk_sp<SkImage> image;
     if (tex) {
-        image = new SkImage_Gpu(info.width(), info.height(), kNeedNewImageUniqueID,
-                                info.alphaType(), tex, budgeted);
+        image = sk_make_sp<SkImage_Gpu>(info.width(), info.height(), kNeedNewImageUniqueID,
+                                        info.alphaType(), tex, budgeted);
     }
     return image;
 }
@@ -134,29 +134,32 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurfaceProps* props) {
+sk_sp<SkSurface> SkSurface::MakeRenderTargetDirect(GrRenderTarget* target,
+                                                   const SkSurfaceProps* props) {
     SkAutoTUnref<SkGpuDevice> device(
         SkGpuDevice::Create(target, props, SkGpuDevice::kUninit_InitContents));
     if (!device) {
         return nullptr;
     }
-    return new SkSurface_Gpu(device);
+    return sk_make_sp<SkSurface_Gpu>(device);
 }
 
-SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, SkBudgeted budgeted, const SkImageInfo& info,
-                                      int sampleCount, const SkSurfaceProps* props,
-                                      GrTextureStorageAllocator customAllocator) {
+sk_sp<SkSurface> SkSurface::MakeRenderTarget(GrContext* ctx, SkBudgeted budgeted,
+                                             const SkImageInfo& info, int sampleCount,
+                                             const SkSurfaceProps* props,
+                                             GrTextureStorageAllocator customAllocator) {
     SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(
             ctx, budgeted, info, sampleCount, props, SkGpuDevice::kClear_InitContents,
             customAllocator));
     if (!device) {
         return nullptr;
     }
-    return new SkSurface_Gpu(device);
+    return sk_make_sp<SkSurface_Gpu>(device);
 }
 
-SkSurface* SkSurface::NewFromBackendTexture(GrContext* context, const GrBackendTextureDesc& desc,
-                                            const SkSurfaceProps* props) {
+sk_sp<SkSurface> SkSurface::MakeFromBackendTexture(GrContext* context,
+                                                   const GrBackendTextureDesc& desc,
+                                                   const SkSurfaceProps* props) {
     if (nullptr == context) {
         return nullptr;
     }
@@ -173,12 +176,12 @@
     if (!device) {
         return nullptr;
     }
-    return new SkSurface_Gpu(device);
+    return sk_make_sp<SkSurface_Gpu>(device);
 }
 
-SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext* context,
-                                                 const GrBackendRenderTargetDesc& desc,
-                                                 const SkSurfaceProps* props) {
+sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
+                                                        const GrBackendRenderTargetDesc& desc,
+                                                        const SkSurfaceProps* props) {
     if (nullptr == context) {
         return nullptr;
     }
@@ -191,12 +194,12 @@
     if (!device) {
         return nullptr;
     }
-    return new SkSurface_Gpu(device);
+    return sk_make_sp<SkSurface_Gpu>(device);
 }
 
-SkSurface* SkSurface::NewFromBackendTextureAsRenderTarget(GrContext* context,
-                                                          const GrBackendTextureDesc& desc,
-                                                          const SkSurfaceProps* props) {
+sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context,
+                                                                 const GrBackendTextureDesc& desc,
+                                                                 const SkSurfaceProps* props) {
     if (nullptr == context) {
         return nullptr;
     }
@@ -210,7 +213,7 @@
     if (!device) {
         return nullptr;
     }
-    return new SkSurface_Gpu(device);
+    return sk_make_sp<SkSurface_Gpu>(device);
 }
 
 #endif
diff --git a/src/image/SkSurface_Gpu.h b/src/image/SkSurface_Gpu.h
index 72e9caf..1e76f26 100644
--- a/src/image/SkSurface_Gpu.h
+++ b/src/image/SkSurface_Gpu.h
@@ -22,8 +22,8 @@
     GrBackendObject onGetTextureHandle(BackendHandleAccess) override;
     bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) override;
     SkCanvas* onNewCanvas() override;
-    SkSurface* onNewSurface(const SkImageInfo&) override;
-    SkImage* onNewImageSnapshot(SkBudgeted, ForceCopyMode) override;
+    sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override;
+    sk_sp<SkImage> onNewImageSnapshot(SkBudgeted, ForceCopyMode) override;
     void onCopyOnWrite(ContentChangeMode) override;
     void onDiscard() override;
     void onPrepareForExternalIO() override;
diff --git a/src/image/SkSurface_Raster.cpp b/src/image/SkSurface_Raster.cpp
index b5844d1..8c9c154 100644
--- a/src/image/SkSurface_Raster.cpp
+++ b/src/image/SkSurface_Raster.cpp
@@ -23,8 +23,8 @@
     SkSurface_Raster(SkPixelRef*, const SkSurfaceProps*);
 
     SkCanvas* onNewCanvas() override;
-    SkSurface* onNewSurface(const SkImageInfo&) override;
-    SkImage* onNewImageSnapshot(SkBudgeted, ForceCopyMode) override;
+    sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override;
+    sk_sp<SkImage> onNewImageSnapshot(SkBudgeted, ForceCopyMode) override;
     void onDraw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) override;
     void onCopyOnWrite(ContentChangeMode) override;
     void onRestoreBackingMutability() override;
@@ -109,8 +109,8 @@
 
 SkCanvas* SkSurface_Raster::onNewCanvas() { return new SkCanvas(fBitmap, this->props()); }
 
-SkSurface* SkSurface_Raster::onNewSurface(const SkImageInfo& info) {
-    return SkSurface::NewRaster(info, &this->props());
+sk_sp<SkSurface> SkSurface_Raster::onNewSurface(const SkImageInfo& info) {
+    return SkSurface::MakeRaster(info, &this->props());
 }
 
 void SkSurface_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y,
@@ -118,7 +118,7 @@
     canvas->drawBitmap(fBitmap, x, y, paint);
 }
 
-SkImage* SkSurface_Raster::onNewImageSnapshot(SkBudgeted, ForceCopyMode forceCopyMode) {
+sk_sp<SkImage> SkSurface_Raster::onNewImageSnapshot(SkBudgeted, ForceCopyMode forceCopyMode) {
     if (fWeOwnThePixels) {
         // SkImage_raster requires these pixels are immutable for its full lifetime.
         // We'll undo this via onRestoreBackingMutability() if we can avoid the COW.
@@ -131,7 +131,7 @@
 
     // Our pixels are in memory, so read access on the snapshot SkImage could be cheap.
     // Lock the shared pixel ref to ensure peekPixels() is usable.
-    return SkMakeImageFromRasterBitmap(fBitmap, forceCopyMode).release();
+    return SkMakeImageFromRasterBitmap(fBitmap, forceCopyMode);
 }
 
 void SkSurface_Raster::onRestoreBackingMutability() {
@@ -169,9 +169,9 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-SkSurface* SkSurface::NewRasterDirectReleaseProc(const SkImageInfo& info, void* pixels, size_t rb,
-                                                 void (*releaseProc)(void* pixels, void* context),
-                                                 void* context, const SkSurfaceProps* props) {
+sk_sp<SkSurface> SkSurface::MakeRasterDirectReleaseProc(const SkImageInfo& info, void* pixels,
+        size_t rb, void (*releaseProc)(void* pixels, void* context), void* context,
+        const SkSurfaceProps* props) {
     if (nullptr == releaseProc) {
         context = nullptr;
     }
@@ -182,16 +182,16 @@
         return nullptr;
     }
 
-    return new SkSurface_Raster(info, pixels, rb, releaseProc, context, props);
+    return sk_make_sp<SkSurface_Raster>(info, pixels, rb, releaseProc, context, props);
 }
 
-SkSurface* SkSurface::NewRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes,
-                                      const SkSurfaceProps* props) {
-    return NewRasterDirectReleaseProc(info, pixels, rowBytes, nullptr, nullptr, props);
+sk_sp<SkSurface> SkSurface::MakeRasterDirect(const SkImageInfo& info, void* pixels, size_t rowBytes,
+                                             const SkSurfaceProps* props) {
+    return MakeRasterDirectReleaseProc(info, pixels, rowBytes, nullptr, nullptr, props);
 }
 
-SkSurface* SkSurface::NewRaster(const SkImageInfo& info, size_t rowBytes,
-                                const SkSurfaceProps* props) {
+sk_sp<SkSurface> SkSurface::MakeRaster(const SkImageInfo& info, size_t rowBytes,
+                                       const SkSurfaceProps* props) {
     if (!SkSurface_Raster::Valid(info)) {
         return nullptr;
     }
@@ -203,9 +203,9 @@
     if (rowBytes) {
         SkASSERT(pr->rowBytes() == rowBytes);
     }
-    return new SkSurface_Raster(pr, props);
+    return sk_make_sp<SkSurface_Raster>(pr, props);
 }
 
-SkSurface* SkSurface::NewRaster(const SkImageInfo& info, const SkSurfaceProps* props) {
-    return NewRaster(info, 0, props);
+sk_sp<SkSurface> SkSurface::MakeRaster(const SkImageInfo& info, const SkSurfaceProps* props) {
+    return MakeRaster(info, 0, props);
 }
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index 66048ff..9ab3b0d 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1412,8 +1412,8 @@
     fClipStack = nullptr;
 }
 
-SkSurface* SkPDFDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
-    return SkSurface::NewRaster(info, &props);
+sk_sp<SkSurface> SkPDFDevice::makeSurface(const SkImageInfo& info, const SkSurfaceProps& props) {
+    return SkSurface::MakeRaster(info, &props);
 }
 
 ContentEntry* SkPDFDevice::getLastContentEntry() {
@@ -2115,8 +2115,7 @@
 }
 
 static const SkImage* color_filter(const SkImage* image, SkColorFilter* colorFilter) {
-    sk_sp<SkSurface> surface(SkSurface::NewRaster(
-            SkImageInfo::MakeN32Premul(image->dimensions())));
+    auto surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(image->dimensions())));
     if (!surface) {
         return image;
     }
@@ -2194,8 +2193,7 @@
 
         SkISize wh = rect_to_size(physicalPerspectiveBounds).toCeil();
 
-        sk_sp<SkSurface> surface(
-                SkSurface::NewRaster(SkImageInfo::MakeN32Premul(wh)));
+        auto surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(wh)));
         if (!surface) {
             return;
         }
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index 138ec19..cfc2b54 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -195,7 +195,7 @@
         return fLegacyBitmap;
     }
 
-    SkSurface* newSurface(const SkImageInfo&, const SkSurfaceProps&) override;
+    sk_sp<SkSurface> makeSurface(const SkImageInfo&, const SkSurfaceProps&) override;
 
     void drawAnnotation(const SkDraw&, const SkRect&, const char key[], SkData* value) override;
 
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index d0b6a4b..c25bbf4 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -716,11 +716,11 @@
     int width = lua2int_def(L, 2, 0);
     int height = lua2int_def(L, 3, 0);
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
-    SkSurface* surface = get_ref<SkCanvas>(L, 1)->newSurface(info);
+    auto surface = get_ref<SkCanvas>(L, 1)->makeSurface(info);
     if (nullptr == surface) {
         lua_pushnil(L);
     } else {
-        push_ref(L, surface)->unref();
+        push_ref(L, surface);
     }
     return 1;
 }
@@ -1769,11 +1769,11 @@
     int width = lua2int_def(L, 2, 0);
     int height = lua2int_def(L, 3, 0);
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
-    SkSurface* surface = get_ref<SkSurface>(L, 1)->newSurface(info);
+    auto surface = get_ref<SkSurface>(L, 1)->makeSurface(info);
     if (nullptr == surface) {
         lua_pushnil(L);
     } else {
-        push_ref(L, surface)->unref();
+        push_ref(L, surface);
     }
     return 1;
 }
@@ -2063,11 +2063,11 @@
     int height = lua2int_def(L, 2, 0);
     SkImageInfo info = SkImageInfo::MakeN32Premul(width, height);
     SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
-    SkSurface* surface = SkSurface::NewRaster(info, &props);
+    auto surface = SkSurface::MakeRaster(info, &props);
     if (nullptr == surface) {
         lua_pushnil(L);
     } else {
-        push_ref(L, surface)->unref();
+        push_ref(L, surface);
     }
     return 1;
 }
diff --git a/src/utils/SkRGBAToYUV.cpp b/src/utils/SkRGBAToYUV.cpp
index eebbda4..63d9152 100644
--- a/src/utils/SkRGBAToYUV.cpp
+++ b/src/utils/SkRGBAToYUV.cpp
@@ -38,7 +38,7 @@
 
     for (int i = 0; i < 3; ++i) {
         size_t rb = rowBytes[i] ? rowBytes[i] : sizes[i].fWidth;
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterDirect(
+        auto surface(SkSurface::MakeRasterDirect(
                 SkImageInfo::MakeA8(sizes[i].fWidth, sizes[i].fHeight), planes[i], rb));
         if (!surface) {
             return false;
diff --git a/src/views/SkWindow.cpp b/src/views/SkWindow.cpp
index 056b3ea..481a1f9 100644
--- a/src/views/SkWindow.cpp
+++ b/src/views/SkWindow.cpp
@@ -32,7 +32,8 @@
 
 SkSurface* SkWindow::createSurface() {
     const SkBitmap& bm = this->getBitmap();
-    return SkSurface::NewRasterDirect(bm.info(), bm.getPixels(), bm.rowBytes(), &fSurfaceProps);
+    return SkSurface::MakeRasterDirect(bm.info(), bm.getPixels(), bm.rowBytes(),
+                                       &fSurfaceProps).release();
 }
 
 void SkWindow::setMatrix(const SkMatrix& matrix) {
diff --git a/tests/BlurTest.cpp b/tests/BlurTest.cpp
index 39ef738..dc3d6c7 100644
--- a/tests/BlurTest.cpp
+++ b/tests/BlurTest.cpp
@@ -564,7 +564,7 @@
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SmallBoxBlurBug, reporter, ctx) {
 
     SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(ctx, SkBudgeted::kNo, info));
+    auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info));
     SkCanvas* canvas = surface->getCanvas();
 
     SkRect r = SkRect::MakeXYWH(10, 10, 100, 100);
diff --git a/tests/DrawBitmapRectTest.cpp b/tests/DrawBitmapRectTest.cpp
index 8928d4c..23fa244 100644
--- a/tests/DrawBitmapRectTest.cpp
+++ b/tests/DrawBitmapRectTest.cpp
@@ -41,7 +41,7 @@
     bm.setPixelRef(new FailurePixelRef(info), 0, 0)->unref();
     // now our bitmap has a pixelref, but we know it will fail to lock
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(200, 200));
+    auto surface(SkSurface::MakeRasterN32Premul(200, 200));
     SkCanvas* canvas = surface->getCanvas();
 
     const SkFilterQuality levels[] = {
diff --git a/tests/DrawFilterTest.cpp b/tests/DrawFilterTest.cpp
index f3e0a77..ed23b70 100644
--- a/tests/DrawFilterTest.cpp
+++ b/tests/DrawFilterTest.cpp
@@ -27,7 +27,7 @@
  *  it was before the save.
  */
 static void test_saverestore(skiatest::Reporter* reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
+    auto surface(SkSurface::MakeRasterN32Premul(10, 10));
     SkCanvas* canvas = surface->getCanvas();
 
     SkAutoTUnref<TestFilter> df(new TestFilter);
diff --git a/tests/DrawPathTest.cpp b/tests/DrawPathTest.cpp
index 8c46b10..9038406 100644
--- a/tests/DrawPathTest.cpp
+++ b/tests/DrawPathTest.cpp
@@ -18,7 +18,7 @@
     SkPMColor pixel[1];
     output.installPixels(SkImageInfo::MakeN32Premul(1, 1), pixel, 4);
 
-    SkSurface* surf = SkSurface::NewRasterN32Premul(300, 33300);
+    auto surf = SkSurface::MakeRasterN32Premul(300, 33300);
     SkCanvas* canvas = surf->getCanvas();
 
     SkRect r = { 0, 33000, 300, 33300 };
@@ -46,7 +46,6 @@
     } else {
         REPORTER_ASSERT_MESSAGE(reporter, false, "readPixels failed");
     }
-    surf->unref();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -95,7 +94,7 @@
     moveToH(&path, &data[0]);
     cubicToH(&path, &data[2]);
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
+    auto surface(SkSurface::MakeRasterN32Premul(640, 480));
 
     SkPaint paint;
     paint.setAntiAlias(true);
@@ -132,7 +131,7 @@
 
     SkPaint paint;
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
+    auto surface(SkSurface::MakeRasterN32Premul(640, 480));
     SkCanvas* canvas = surface->getCanvas();
     canvas->save();
     canvas->clipRect(SkRect::MakeWH(19, 11));
@@ -171,7 +170,7 @@
     SkPaint paint;
     paint.setAntiAlias(true);
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
+    auto surface(SkSurface::MakeRasterN32Premul(640, 480));
     surface->getCanvas()->drawPath(path, paint);
 }
 
@@ -213,7 +212,7 @@
     SkPaint paint;
     paint.setAntiAlias(true);
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
+    auto surface(SkSurface::MakeRasterN32Premul(640, 480));
     surface->getCanvas()->drawPath(path, paint);
 }
 
@@ -241,7 +240,7 @@
     m.postTranslate(0.001f, 0.001f);
     path.transform(m, &p2);
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
+    auto surface(SkSurface::MakeRasterN32Premul(640, 480));
     SkCanvas* canvas = surface->getCanvas();
     canvas->translate(-16366, -1383);
     canvas->drawPath(p2, paint);
@@ -262,7 +261,7 @@
 static void test_giantaa() {
     const int W = 400;
     const int H = 400;
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(33000, 10));
+    auto surface(SkSurface::MakeRasterN32Premul(33000, 10));
 
     SkPaint paint;
     paint.setAntiAlias(true);
@@ -316,7 +315,7 @@
 // http://crbug.com/472147
 // This is a simplified version from the bug. RRect radii not properly scaled.
 static void test_crbug_472147_simple(skiatest::Reporter* reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000));
+    auto surface(SkSurface::MakeRasterN32Premul(1000, 1000));
     SkCanvas* canvas = surface->getCanvas();
     SkPaint p;
     SkRect r = SkRect::MakeLTRB(-246.0f, 33.0f, 848.0f, 33554464.0f);
@@ -331,7 +330,7 @@
 // http://crbug.com/472147
 // RRect radii not properly scaled.
 static void test_crbug_472147_actual(skiatest::Reporter* reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000));
+    auto surface(SkSurface::MakeRasterN32Premul(1000, 1000));
     SkCanvas* canvas = surface->getCanvas();
     SkPaint p;
     SkRect r = SkRect::MakeLTRB(-246.0f, 33.0f, 848.0f, 33554464.0f);
diff --git a/tests/GpuDrawPathTest.cpp b/tests/GpuDrawPathTest.cpp
index 1f9361a..bab6d3a 100644
--- a/tests/GpuDrawPathTest.cpp
+++ b/tests/GpuDrawPathTest.cpp
@@ -80,9 +80,8 @@
     for (auto& test_func : { &test_drawPathEmpty, &test_drawSameRectOvals }) {
         for (auto& sampleCount : {0, 4, 16}) {
             SkImageInfo info = SkImageInfo::MakeN32Premul(255, 255);
-            SkAutoTUnref<SkSurface> surface(
-                SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info,
-                                           sampleCount, nullptr));
+            auto surface(
+                SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, sampleCount, nullptr));
             if (!surface) {
                 continue;
             }
diff --git a/tests/GrTextureMipMapInvalidationTest.cpp b/tests/GrTextureMipMapInvalidationTest.cpp
index b047550..539a8ce 100644
--- a/tests/GrTextureMipMapInvalidationTest.cpp
+++ b/tests/GrTextureMipMapInvalidationTest.cpp
@@ -41,7 +41,7 @@
     REPORTER_ASSERT(reporter, false == tex->texturePriv().hasMipMaps());
 
     // Painting with downscale and medium filter quality should result in mipmap creation
-    SkSurface* surface = SkSurface::NewRenderTargetDirect(texRT2->asRenderTarget());
+    auto surface = SkSurface::MakeRenderTargetDirect(texRT2->asRenderTarget());
     SkPaint paint;
     paint.setFilterQuality(kMedium_SkFilterQuality);
     surface->getCanvas()->scale(0.2f, 0.2f);
@@ -56,7 +56,6 @@
     REPORTER_ASSERT(reporter, true == tex->texturePriv().hasMipMaps());
     REPORTER_ASSERT(reporter, true == tex->texturePriv().mipMapsAreDirty());
 
-    surface->unref();
     texRT1->unref();
     texRT2->unref();
 }
diff --git a/tests/GradientTest.cpp b/tests/GradientTest.cpp
index 6521070..0014089 100644
--- a/tests/GradientTest.cpp
+++ b/tests/GradientTest.cpp
@@ -184,7 +184,7 @@
 }
 
 static void test_nearly_vertical(skiatest::Reporter* reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(200, 200));
+    auto surface(SkSurface::MakeRasterN32Premul(200, 200));
 
     const SkPoint pts[] = {{ 100, 50 }, { 100.0001f, 50000 }};
     const SkColor colors[] = { SK_ColorBLACK, SK_ColorWHITE };
@@ -200,7 +200,7 @@
 // The old code had an assert which this test triggered.
 // We now explicitly clamp the resulting fx value.
 static void test_linear_fuzz(skiatest::Reporter* reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1300, 630));
+    auto surface(SkSurface::MakeRasterN32Premul(1300, 630));
 
     const SkPoint pts[] = {{ 179.5f, -179.5f }, { 1074.5f, 715.5f }};
     const SkColor colors[] = { SK_ColorBLACK, SK_ColorWHITE, SK_ColorBLACK, SK_ColorWHITE };
@@ -216,7 +216,7 @@
 // https://bugs.chromium.org/p/skia/issues/detail?id=5023
 // We should still shade pixels for which the radius is exactly 0.
 static void test_two_point_conical_zero_radius(skiatest::Reporter* reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(5, 5));
+    auto surface(SkSurface::MakeRasterN32Premul(5, 5));
     surface->getCanvas()->clear(SK_ColorRED);
 
     const SkColor colors[] = { SK_ColorGREEN, SK_ColorBLUE };
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 3350b4a..acdd369 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -231,7 +231,7 @@
 #endif
 
 static sk_sp<SkImage> make_small_image() {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(kBitmapSize, kBitmapSize));
+    auto surface(SkSurface::MakeRasterN32Premul(kBitmapSize, kBitmapSize));
     SkCanvas* canvas = surface->getCanvas();
     canvas->clear(0x00000000);
     SkPaint darkPaint;
@@ -1495,7 +1495,7 @@
 
 // Verify that SkImageSource survives serialization
 DEF_TEST(ImageFilterImageSourceSerialization, reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
+    auto surface(SkSurface::MakeRasterN32Premul(10, 10));
     surface->getCanvas()->clear(SK_ColorGREEN);
     sk_sp<SkImage> image(surface->makeImageSnapshot());
     SkAutoTUnref<SkImageFilter> filter(SkImageSource::Create(image.get()));
@@ -1562,7 +1562,7 @@
 }
 
 DEF_TEST(BlurLargeImage, reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(SkImageInfo::MakeN32Premul(100, 100)));
+    auto surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(100, 100)));
     test_large_blur_input(reporter, surface->getCanvas());
 }
 
@@ -1597,9 +1597,8 @@
 }
 
 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) {
-    SkAutoTUnref<SkSurface> surface(
-        SkSurface::NewRenderTarget(context, SkBudgeted::kYes,
-                                   SkImageInfo::MakeN32Premul(100, 100)));
+    auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kYes,
+                                             SkImageInfo::MakeN32Premul(100, 100)));
     test_large_blur_input(reporter, surface->getCanvas());
 }
 #endif
diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp
index 6f13708..6b8b64a 100644
--- a/tests/ImageIsOpaqueTest.cpp
+++ b/tests/ImageIsOpaqueTest.cpp
@@ -48,18 +48,19 @@
     }
 }
 
-static void check_isopaque(skiatest::Reporter* reporter, SkSurface* surface, bool expectedOpaque) {
+static void check_isopaque(skiatest::Reporter* reporter, const sk_sp<SkSurface>& surface,
+                           bool expectedOpaque) {
     sk_sp<SkImage> image(surface->makeImageSnapshot());
     REPORTER_ASSERT(reporter, image->isOpaque() == expectedOpaque);
 }
 
 DEF_TEST(ImageIsOpaqueTest, reporter) {
     SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
-    SkAutoTUnref<SkSurface> surfaceTransparent(SkSurface::NewRaster(infoTransparent));
+    auto surfaceTransparent(SkSurface::MakeRaster(infoTransparent));
     check_isopaque(reporter, surfaceTransparent, false);
 
     SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
-    SkAutoTUnref<SkSurface> surfaceOpaque(SkSurface::NewRaster(infoOpaque));
+    auto surfaceOpaque(SkSurface::MakeRaster(infoOpaque));
     check_isopaque(reporter, surfaceOpaque, true);
 }
 
@@ -67,13 +68,11 @@
 
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageIsOpaqueTest_Gpu, reporter, context) {
     SkImageInfo infoTransparent = SkImageInfo::MakeN32Premul(5, 5);
-    SkAutoTUnref<SkSurface> surfaceTransparent(
-        SkSurface::NewRenderTarget(context, SkBudgeted::kNo, infoTransparent));
+    auto surfaceTransparent(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, infoTransparent));
     check_isopaque(reporter, surfaceTransparent, false);
 
     SkImageInfo infoOpaque = SkImageInfo::MakeN32(5, 5, kOpaque_SkAlphaType);
-    SkAutoTUnref<SkSurface> surfaceOpaque(
-        SkSurface::NewRenderTarget(context,SkBudgeted::kNo, infoOpaque));
+    auto surfaceOpaque(SkSurface::MakeRenderTarget(context,SkBudgeted::kNo, infoOpaque));
 
     check_isopaque(reporter, surfaceOpaque, true);
 }
diff --git a/tests/ImageNewShaderTest.cpp b/tests/ImageNewShaderTest.cpp
index b6266ed..4ae0b6d 100644
--- a/tests/ImageNewShaderTest.cpp
+++ b/tests/ImageNewShaderTest.cpp
@@ -104,8 +104,8 @@
 DEF_TEST(ImageNewShader, reporter) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5);
 
-    SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRaster(info));
-    SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRaster(info));
+    auto sourceSurface(SkSurface::MakeRaster(info));
+    auto destinationSurface(SkSurface::MakeRaster(info));
 
     runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
 }
@@ -115,10 +115,8 @@
 void gpuToGpu(skiatest::Reporter* reporter, GrContext* context) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5);
 
-    SkAutoTUnref<SkSurface> sourceSurface(
-        SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info));
-    SkAutoTUnref<SkSurface> destinationSurface(
-        SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info));
+    auto sourceSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
+    auto destinationSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
 
     runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
 }
@@ -126,9 +124,8 @@
 void gpuToRaster(skiatest::Reporter* reporter, GrContext* context) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5);
 
-    SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRenderTarget(context,
-        SkBudgeted::kNo, info));
-    SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRaster(info));
+    auto sourceSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
+    auto destinationSurface(SkSurface::MakeRaster(info));
 
     runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
 }
@@ -136,9 +133,8 @@
 void rasterToGpu(skiatest::Reporter* reporter, GrContext* context) {
     SkImageInfo info = SkImageInfo::MakeN32Premul(5, 5);
 
-    SkAutoTUnref<SkSurface> sourceSurface(SkSurface::NewRaster(info));
-    SkAutoTUnref<SkSurface> destinationSurface(SkSurface::NewRenderTarget(context,
-        SkBudgeted::kNo, info));
+    auto sourceSurface(SkSurface::MakeRaster(info));
+    auto destinationSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
 
     runShaderTest(reporter, sourceSurface.get(), destinationSurface.get(), info);
 }
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index ce3cb99..15ee54c 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -62,13 +62,13 @@
 }
 static sk_sp<SkImage> create_image() {
     const SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     draw_image_test_pattern(surface->getCanvas());
     return surface->makeImageSnapshot();
 }
 static sk_sp<SkImage> create_image_565() {
     const SkImageInfo info = SkImageInfo::Make(20, 20, kRGB_565_SkColorType, kOpaque_SkAlphaType);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     draw_image_test_pattern(surface->getCanvas());
     return surface->makeImageSnapshot();
 }
@@ -146,8 +146,7 @@
 #if SK_SUPPORT_GPU
 static sk_sp<SkImage> create_gpu_image(GrContext* context) {
     const SkImageInfo info = SkImageInfo::MakeN32(20, 20, kOpaque_SkAlphaType);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkBudgeted::kNo,
-                                                               info));
+    auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
     draw_image_test_pattern(surface->getCanvas());
     return surface->makeImageSnapshot();
 }
@@ -224,7 +223,7 @@
 
 // Test that image encoding failures do not break picture serialization/deserialization.
 DEF_TEST(Image_Serialize_Encoding_Failure, reporter) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(100, 100));
+    auto surface(SkSurface::MakeRasterN32Premul(100, 100));
     surface->getCanvas()->clear(SK_ColorGREEN);
     sk_sp<SkImage> image(surface->makeImageSnapshot());
     REPORTER_ASSERT(reporter, image);
@@ -287,7 +286,7 @@
     const SkPMColor red   = SkPackARGB32(0xFF, 0xFF, 0, 0);
     const SkPMColor green = SkPackARGB32(0xFF, 0, 0xFF, 0);
     SkImageInfo info = SkImageInfo::MakeN32Premul(2, 2);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     surface->getCanvas()->clear(0xFF00FF00);
 
     SkPMColor pixels[4];
@@ -373,7 +372,7 @@
     sk_sp<SkImage> image(create_gpu_image(context));
     const uint32_t uniqueID = image->uniqueID();
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
 
     // now we can test drawing a gpu-backed image into a cpu-backed surface
 
diff --git a/tests/IndexedPngOverflowTest.cpp b/tests/IndexedPngOverflowTest.cpp
index f516898..1a48b64 100644
--- a/tests/IndexedPngOverflowTest.cpp
+++ b/tests/IndexedPngOverflowTest.cpp
@@ -33,7 +33,7 @@
     bool success = decode_memory(gPng, sizeof(gPng), &image);
     REPORTER_ASSERT(reporter, success);
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(SkImageInfo::MakeN32Premul(20, 1)));
+    auto surface(SkSurface::MakeRaster(SkImageInfo::MakeN32Premul(20, 1)));
     SkCanvas* canvas = surface->getCanvas();
     SkRect destRect = SkRect::MakeXYWH(0, 0, 20, 1);
     canvas->drawBitmapRect(image, destRect, nullptr);
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 2ba4000..dd6f41c 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -99,7 +99,7 @@
 static void test_path_crbug364224() {
     SkPath path;
     SkPaint paint;
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(84, 88));
+    auto surface(SkSurface::MakeRasterN32Premul(84, 88));
     SkCanvas* canvas = surface->getCanvas();
 
     make_path_crbug364224_simplified(&path);
@@ -293,7 +293,7 @@
 
     SkPaint paint;
     paint.setAntiAlias(true);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(84, 88));
+    auto surface(SkSurface::MakeRasterN32Premul(84, 88));
     surface->getCanvas()->drawPath(path, paint);
 }
 
@@ -412,7 +412,7 @@
     SkPaint paint;
     paint.setAntiAlias(true);
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(1000, 1000));
+    auto surface(SkSurface::MakeRasterN32Premul(1000, 1000));
 
     build_path_simple_170666(path);
     surface->getCanvas()->drawPath(path, paint);
@@ -553,7 +553,7 @@
 }
 
 static void test_clipped_cubic() {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(640, 480));
+    auto surface(SkSurface::MakeRasterN32Premul(640, 480));
 
     // This path used to assert, because our cubic-chopping code incorrectly
     // moved control points after the chop. This test should be run in SK_DEBUG
@@ -626,9 +626,7 @@
     SkPaint paint;
     paint.setAntiAlias(true);
 
-    SkSurface* surface = SkSurface::NewRasterN32Premul(19, 130);
-    surface->getCanvas()->drawPath(path, paint);
-    surface->unref();
+    SkSurface::MakeRasterN32Premul(19, 130)->getCanvas()->drawPath(path, paint);
 }
 
 // Inspired by http://code.google.com/p/chromium/issues/detail?id=141651
diff --git a/tests/ReadPixelsTest.cpp b/tests/ReadPixelsTest.cpp
index 87e5116..b538fc8 100644
--- a/tests/ReadPixelsTest.cpp
+++ b/tests/ReadPixelsTest.cpp
@@ -324,7 +324,7 @@
     SkIRect::MakeLTRB(3 * DEV_W / 4, -10, DEV_W + 10, DEV_H + 10),
 };
 
-static void test_readpixels(skiatest::Reporter* reporter, SkSurface* surface,
+static void test_readpixels(skiatest::Reporter* reporter, const sk_sp<SkSurface>& surface,
                             BitmapInit lastBitmapInit) {
     SkCanvas* canvas = surface->getCanvas();
     fill_src_canvas(canvas);
@@ -382,7 +382,7 @@
 }
 DEF_TEST(ReadPixels, reporter) {
     const SkImageInfo info = SkImageInfo::MakeN32Premul(DEV_W, DEV_H);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     // SW readback fails a premul check when reading back to an unaligned rowbytes.
     test_readpixels(reporter, surface, kLastAligned_BitmapInit);
 }
@@ -397,7 +397,7 @@
         desc.fOrigin = origin;
         SkAutoTUnref<GrTexture> surfaceTexture(
             context->textureProvider()->createTexture(desc, SkBudgeted::kNo));
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(surfaceTexture->asRenderTarget()));
+        auto surface(SkSurface::MakeRenderTargetDirect(surfaceTexture->asRenderTarget()));
         desc.fFlags = kNone_GrSurfaceFlags;
         test_readpixels(reporter, surface, kLast_BitmapInit);
     }
@@ -603,8 +603,8 @@
 
     // do they draw the same?
     const SkImageInfo info = SkImageInfo::MakeN32Premul(128, 128);
-    SkAutoTUnref<SkSurface> surfA(SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0));
-    SkAutoTUnref<SkSurface> surfB(SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0));
+    auto surfA(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
+    auto surfB(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
 
     if (false) {
         //
@@ -613,8 +613,8 @@
         //
         SkFilterQuality quality = kLow_SkFilterQuality;
 
-        SkAutoTUnref<SkData> dataA(draw_into_surface(surfA, bm_subset, quality));
-        SkAutoTUnref<SkData> dataB(draw_into_surface(surfB, tx_subset, quality));
+        SkAutoTUnref<SkData> dataA(draw_into_surface(surfA.get(), bm_subset, quality));
+        SkAutoTUnref<SkData> dataB(draw_into_surface(surfB.get(), tx_subset, quality));
 
         REPORTER_ASSERT(reporter, dataA->equals(dataB));
         if (false) {
diff --git a/tests/RecordDrawTest.cpp b/tests/RecordDrawTest.cpp
index 8d91fbc..17d9711 100644
--- a/tests/RecordDrawTest.cpp
+++ b/tests/RecordDrawTest.cpp
@@ -279,7 +279,7 @@
         bool fDrawImageRectCalled;
     };
 
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
+    auto surface(SkSurface::MakeRasterN32Premul(10, 10));
     surface->getCanvas()->clear(SK_ColorGREEN);
     sk_sp<SkImage> image(surface->makeImageSnapshot());
 
diff --git a/tests/RecorderTest.cpp b/tests/RecorderTest.cpp
index 59d5a8e..a709a51 100644
--- a/tests/RecorderTest.cpp
+++ b/tests/RecorderTest.cpp
@@ -74,7 +74,7 @@
 
     sk_sp<SkImage> image;
     {
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(100, 100));
+        auto surface(SkSurface::MakeRasterN32Premul(100, 100));
         surface->getCanvas()->clear(SK_ColorGREEN);
         image = surface->makeImageSnapshot();
     }
diff --git a/tests/ResourceCacheTest.cpp b/tests/ResourceCacheTest.cpp
index 784ae7e..0931876 100644
--- a/tests/ResourceCacheTest.cpp
+++ b/tests/ResourceCacheTest.cpp
@@ -37,8 +37,7 @@
     desc.fWidth = gWidth;
     desc.fHeight = gHeight;
     SkImageInfo info = SkImageInfo::MakeN32Premul(gWidth, gHeight);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context,
-                                                               SkBudgeted::kNo, info));
+    auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info));
     SkCanvas* canvas = surface->getCanvas();
 
     const SkIRect size = SkIRect::MakeWH(gWidth, gHeight);
diff --git a/tests/SkResourceCacheTest.cpp b/tests/SkResourceCacheTest.cpp
index 7ae5f64..3c0d1ff 100644
--- a/tests/SkResourceCacheTest.cpp
+++ b/tests/SkResourceCacheTest.cpp
@@ -264,7 +264,7 @@
 
 static void test_discarded_image(skiatest::Reporter* reporter, const SkMatrix& transform,
                                  sk_sp<SkImage> (*buildImage)()) {
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
+    auto surface(SkSurface::MakeRasterN32Premul(10, 10));
     SkCanvas* canvas = surface->getCanvas();
 
     // SkBitmapCache is global, so other threads could be evicting our bitmaps.  Loop a few times
@@ -313,7 +313,7 @@
 
     for (size_t i = 0; i < SK_ARRAY_COUNT(xforms); ++i) {
         test_discarded_image(reporter, xforms[i], []() {
-            SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
+            auto surface(SkSurface::MakeRasterN32Premul(10, 10));
             surface->getCanvas()->clear(SK_ColorCYAN);
             return surface->makeImageSnapshot();
         });
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 89c7765..4aaabd8 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -27,57 +27,57 @@
     SkASSERT(pixels == context);
     sk_free(pixels);
 }
-static SkSurface* create_surface(SkAlphaType at = kPremul_SkAlphaType,
-                                 SkImageInfo* requestedInfo = nullptr) {
+static sk_sp<SkSurface> create_surface(SkAlphaType at = kPremul_SkAlphaType,
+                                       SkImageInfo* requestedInfo = nullptr) {
     const SkImageInfo info = SkImageInfo::MakeN32(10, 10, at);
     if (requestedInfo) {
         *requestedInfo = info;
     }
-    return SkSurface::NewRaster(info);
+    return SkSurface::MakeRaster(info);
 }
-static SkSurface* create_direct_surface(SkAlphaType at = kPremul_SkAlphaType,
-                                        SkImageInfo* requestedInfo = nullptr) {
+static sk_sp<SkSurface> create_direct_surface(SkAlphaType at = kPremul_SkAlphaType,
+                                              SkImageInfo* requestedInfo = nullptr) {
     const SkImageInfo info = SkImageInfo::MakeN32(10, 10, at);
     if (requestedInfo) {
         *requestedInfo = info;
     }
     const size_t rowBytes = info.minRowBytes();
     void* storage = sk_malloc_throw(info.getSafeSize(rowBytes));
-    return SkSurface::NewRasterDirectReleaseProc(info, storage, rowBytes,
-                                                 release_direct_surface_storage,
-                                                 storage);
+    return SkSurface::MakeRasterDirectReleaseProc(info, storage, rowBytes,
+                                                  release_direct_surface_storage,
+                                                  storage);
 }
 #if SK_SUPPORT_GPU
-static SkSurface* create_gpu_surface(GrContext* context, SkAlphaType at = kPremul_SkAlphaType,
-                                     SkImageInfo* requestedInfo = nullptr) {
+static sk_sp<SkSurface> create_gpu_surface(GrContext* context, SkAlphaType at = kPremul_SkAlphaType,
+                                           SkImageInfo* requestedInfo = nullptr) {
     const SkImageInfo info = SkImageInfo::MakeN32(10, 10, at);
     if (requestedInfo) {
         *requestedInfo = info;
     }
-    return SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr);
+    return SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr);
 }
-static SkSurface* create_gpu_scratch_surface(GrContext* context,
-                                             SkAlphaType at = kPremul_SkAlphaType,
-                                             SkImageInfo* requestedInfo = nullptr) {
+static sk_sp<SkSurface> create_gpu_scratch_surface(GrContext* context,
+                                                   SkAlphaType at = kPremul_SkAlphaType,
+                                                   SkImageInfo* requestedInfo = nullptr) {
     const SkImageInfo info = SkImageInfo::MakeN32(10, 10, at);
     if (requestedInfo) {
         *requestedInfo = info;
     }
-    return SkSurface::NewRenderTarget(context, SkBudgeted::kYes, info, 0, nullptr);
+    return SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, info, 0, nullptr);
 }
 #endif
 
 DEF_TEST(SurfaceEmpty, reporter) {
     const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
-    REPORTER_ASSERT(reporter, nullptr == SkSurface::NewRaster(info));
-    REPORTER_ASSERT(reporter, nullptr == SkSurface::NewRasterDirect(info, nullptr, 0));
+    REPORTER_ASSERT(reporter, nullptr == SkSurface::MakeRaster(info));
+    REPORTER_ASSERT(reporter, nullptr == SkSurface::MakeRasterDirect(info, nullptr, 0));
 
 }
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceEmpty_Gpu, reporter, context) {
     const SkImageInfo info = SkImageInfo::Make(0, 0, kN32_SkColorType, kPremul_SkAlphaType);
     REPORTER_ASSERT(reporter, nullptr ==
-                    SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr));
+                    SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, nullptr));
 }
 #endif
 
@@ -107,8 +107,7 @@
     wrappedDesc.fFlags = kRenderTarget_GrBackendTextureFlag;
     wrappedDesc.fTextureHandle = texHandle;
 
-    SkAutoTUnref<SkSurface> surface(
-        SkSurface::NewWrappedRenderTarget(context, wrappedDesc, nullptr));
+    auto surface(SkSurface::MakeFromBackendTexture(context, wrappedDesc, nullptr));
     REPORTER_ASSERT(reporter, surface);
     if (surface) {
         // Validate that we can draw to the canvas and that the original texture color is preserved
@@ -152,7 +151,7 @@
 #endif
 
 static void test_canvas_peek(skiatest::Reporter* reporter,
-                             SkSurface* surface,
+                             sk_sp<SkSurface>& surface,
                              const SkImageInfo& requestInfo,
                              bool expectPeekSuccess) {
     const SkColor color = SK_ColorRED;
@@ -181,7 +180,7 @@
 DEF_TEST(SurfaceCanvasPeek, reporter) {
     for (auto& surface_func : { &create_surface, &create_direct_surface }) {
         SkImageInfo requestInfo;
-        SkAutoTUnref<SkSurface> surface(surface_func(kPremul_SkAlphaType, &requestInfo));
+        auto surface(surface_func(kPremul_SkAlphaType, &requestInfo));
         test_canvas_peek(reporter, surface, requestInfo, true);
     }
 }
@@ -189,7 +188,7 @@
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCanvasPeek_Gpu, reporter, context) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         SkImageInfo requestInfo;
-        SkAutoTUnref<SkSurface> surface(surface_func(context, kPremul_SkAlphaType, &requestInfo));
+        auto surface(surface_func(context, kPremul_SkAlphaType, &requestInfo));
         test_canvas_peek(reporter, surface, requestInfo, false);
     }
 }
@@ -199,7 +198,7 @@
 // the bitmap's genID when we draw to it, else they won't know it has new values. When they are
 // exclusively using surface/image, and we can hide accessBitmap from device, we can remove this
 // test.
-void test_access_pixels(skiatest::Reporter* reporter, SkSurface* surface) {
+void test_access_pixels(skiatest::Reporter* reporter, const sk_sp<SkSurface>& surface) {
     SkCanvas* canvas = surface->getCanvas();
     canvas->clear(0);
 
@@ -214,20 +213,20 @@
 }
 DEF_TEST(SurfaceAccessPixels, reporter) {
     for (auto& surface_func : { &create_surface, &create_direct_surface }) {
-        SkAutoTUnref<SkSurface> surface(surface_func(kPremul_SkAlphaType, nullptr));
+        auto surface(surface_func(kPremul_SkAlphaType, nullptr));
         test_access_pixels(reporter, surface);
     }
 }
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceAccessPixels_Gpu, reporter, context) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
-        SkAutoTUnref<SkSurface> surface(surface_func(context, kPremul_SkAlphaType, nullptr));
+        auto surface(surface_func(context, kPremul_SkAlphaType, nullptr));
         test_access_pixels(reporter, surface);
     }
 }
 #endif
 
-static void test_snapshot_alphatype(skiatest::Reporter* reporter, SkSurface* surface,
+static void test_snapshot_alphatype(skiatest::Reporter* reporter, const sk_sp<SkSurface>& surface,
                                     bool expectOpaque) {
     REPORTER_ASSERT(reporter, surface);
     if (surface) {
@@ -242,7 +241,7 @@
     for (auto& surface_func : { &create_surface, &create_direct_surface }) {
         for (auto& isOpaque : { true, false }) {
             SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
-            SkAutoTUnref<SkSurface> surface(surface_func(alphaType, nullptr));
+            auto surface(surface_func(alphaType, nullptr));
             test_snapshot_alphatype(reporter, surface, isOpaque);
         }
     }
@@ -252,7 +251,7 @@
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         for (auto& isOpaque : { true, false }) {
             SkAlphaType alphaType = isOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
-            SkAutoTUnref<SkSurface> surface(surface_func(context, alphaType, nullptr));
+            auto surface(surface_func(context, alphaType, nullptr));
             test_snapshot_alphatype(reporter, surface, isOpaque);
         }
     }
@@ -293,8 +292,8 @@
     for (auto& handle_access_func :
             { &get_surface_backend_texture_handle, &get_surface_backend_render_target_handle }) {
         for (auto& accessMode : accessModes) {
-            SkAutoTUnref<SkSurface> surface(create_surface());
-            test_backend_handle_access_copy_on_write(reporter, surface, accessMode,
+            auto surface(create_surface());
+            test_backend_handle_access_copy_on_write(reporter, surface.get(), accessMode,
                                                      handle_access_func);
         }
     }
@@ -310,9 +309,8 @@
         for (auto& handle_access_func :
                 { &get_surface_backend_texture_handle, &get_surface_backend_render_target_handle }) {
             for (auto& accessMode : accessModes) {
-                SkAutoTUnref<SkSurface> surface(surface_func(context, kPremul_SkAlphaType,
-                                                             nullptr));
-                test_backend_handle_access_copy_on_write(reporter, surface, accessMode,
+                auto surface(surface_func(context, kPremul_SkAlphaType, nullptr));
+                test_backend_handle_access_copy_on_write(reporter, surface.get(), accessMode,
                                                          handle_access_func);
             }
         }
@@ -390,16 +388,18 @@
         return reinterpret_cast<intptr_t>(pixels);
     };
 
-    SkAutoTUnref<SkSurface> surface(create_surface());
-    test_unique_image_snap(reporter, surface, false, getImageBackingStore, getSufaceBackingStore);
-    surface.reset(create_direct_surface());
-    test_unique_image_snap(reporter, surface, true, getImageBackingStore, getSufaceBackingStore);
+    auto surface(create_surface());
+    test_unique_image_snap(reporter, surface.get(), false, getImageBackingStore,
+                           getSufaceBackingStore);
+    surface = create_direct_surface();
+    test_unique_image_snap(reporter, surface.get(), true, getImageBackingStore,
+                           getSufaceBackingStore);
 }
 
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(UniqueImageSnapshot_Gpu, reporter, context) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
-        SkAutoTUnref<SkSurface> surface(surface_func(context, kOpaque_SkAlphaType, nullptr));
+        auto surface(surface_func(context, kOpaque_SkAlphaType, nullptr));
 
         auto imageBackingStore = [reporter](SkImage* image) {
             GrTexture* texture = as_IB(image)->peekTexture();
@@ -420,7 +420,8 @@
             return static_cast<intptr_t>(rt->getUniqueID());
         };
 
-        test_unique_image_snap(reporter, surface, false, imageBackingStore, surfaceBackingStore);
+        test_unique_image_snap(reporter, surface.get(), false, imageBackingStore,
+                               surfaceBackingStore);
 
         // Test again with a "direct" render target;
         GrBackendObject textureObject = context->getGpu()->createTestingOnlyBackendTexture(nullptr,
@@ -433,9 +434,8 @@
         desc.fTextureHandle = textureObject;
         GrTexture* texture = context->textureProvider()->wrapBackendTexture(desc);
         {
-            SkAutoTUnref<SkSurface> surface(
-                SkSurface::NewRenderTargetDirect(texture->asRenderTarget()));
-            test_unique_image_snap(reporter, surface, true, imageBackingStore,
+            auto surface(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget()));
+            test_unique_image_snap(reporter, surface.get(), true, imageBackingStore,
                                    surfaceBackingStore);
         }
         texture->unref();
@@ -504,9 +504,8 @@
         for (auto& test_func : { &test_backend_handle_unique_id, &test_backend_handle_gen_id }) {
             for (auto& handle_access_func :
                 { &get_surface_backend_texture_handle, &get_surface_backend_render_target_handle}) {
-                SkAutoTUnref<SkSurface> surface(surface_func(context, kPremul_SkAlphaType,
-                                                             nullptr));
-                test_func(reporter, surface, handle_access_func);
+                auto surface(surface_func(context, kPremul_SkAlphaType, nullptr));
+                test_func(reporter, surface.get(), handle_access_func);
             }
         }
     }
@@ -589,14 +588,13 @@
         testPaint))
 }
 DEF_TEST(SurfaceCopyOnWrite, reporter) {
-    SkAutoTUnref<SkSurface> surface(create_surface());
-    test_copy_on_write(reporter, surface);
+    test_copy_on_write(reporter, create_surface().get());
 }
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCopyOnWrite_Gpu, reporter, context) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
-        SkAutoTUnref<SkSurface> surface(surface_func(context, kPremul_SkAlphaType, nullptr));
-        test_copy_on_write(reporter, surface);
+        auto surface(surface_func(context, kPremul_SkAlphaType, nullptr));
+        test_copy_on_write(reporter, surface.get());
     }
 }
 #endif
@@ -612,14 +610,13 @@
     canvas->clear(2);  // Must not assert internally
 }
 DEF_TEST(SurfaceWriteableAfterSnapshotRelease, reporter) {
-    SkAutoTUnref<SkSurface> surface(create_surface());
-    test_writable_after_snapshot_release(reporter, surface);
+    test_writable_after_snapshot_release(reporter, create_surface().get());
 }
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceWriteableAfterSnapshotRelease_Gpu, reporter, context) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
-        SkAutoTUnref<SkSurface> surface(surface_func(context, kPremul_SkAlphaType, nullptr));
-        test_writable_after_snapshot_release(reporter, surface);
+        auto surface(surface_func(context, kPremul_SkAlphaType, nullptr));
+        test_writable_after_snapshot_release(reporter, surface.get());
     }
 }
 #endif
@@ -659,15 +656,15 @@
 }
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfaceCRBug263329_Gpu, reporter, context) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
-        SkAutoTUnref<SkSurface> surface1(surface_func(context, kPremul_SkAlphaType, nullptr));
-        SkAutoTUnref<SkSurface> surface2(surface_func(context, kPremul_SkAlphaType, nullptr));
-        test_crbug263329(reporter, surface1, surface2);
+        auto surface1(surface_func(context, kPremul_SkAlphaType, nullptr));
+        auto surface2(surface_func(context, kPremul_SkAlphaType, nullptr));
+        test_crbug263329(reporter, surface1.get(), surface2.get());
     }
 }
 #endif
 
 DEF_TEST(SurfaceGetTexture, reporter) {
-    SkAutoTUnref<SkSurface> surface(create_surface());
+    auto surface(create_surface());
     sk_sp<SkImage> image(surface->makeImageSnapshot());
     REPORTER_ASSERT(reporter, as_IB(image)->peekTexture() == nullptr);
     surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
@@ -676,7 +673,7 @@
 #if SK_SUPPORT_GPU
 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(SurfacepeekTexture_Gpu, reporter, context) {
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
-        SkAutoTUnref<SkSurface> surface(surface_func(context, kPremul_SkAlphaType, nullptr));
+        auto surface(surface_func(context, kPremul_SkAlphaType, nullptr));
         sk_sp<SkImage> image(surface->makeImageSnapshot());
         GrTexture* texture = as_IB(image)->peekTexture();
         REPORTER_ASSERT(reporter, texture);
@@ -693,8 +690,9 @@
 #include "SkImage_Gpu.h"
 #include "SkSurface_Gpu.h"
 
-static SkBudgeted is_budgeted(SkSurface* surf) {
-    return ((SkSurface_Gpu*)surf)->getDevice()->accessRenderTarget()->resourcePriv().isBudgeted();
+static SkBudgeted is_budgeted(const sk_sp<SkSurface>& surf) {
+    SkSurface_Gpu* gsurf = (SkSurface_Gpu*)surf.get();
+    return gsurf->getDevice()->accessRenderTarget()->resourcePriv().isBudgeted();
 }
 
 static SkBudgeted is_budgeted(SkImage* image) {
@@ -709,8 +707,7 @@
     SkImageInfo info = SkImageInfo::MakeN32Premul(8,8);
     for (auto sbudgeted : { SkBudgeted::kNo, SkBudgeted::kYes }) {
         for (auto ibudgeted : { SkBudgeted::kNo, SkBudgeted::kYes }) {
-            SkAutoTUnref<SkSurface>
-                surface(SkSurface::NewRenderTarget(context, sbudgeted, info, 0));
+            auto surface(SkSurface::MakeRenderTarget(context, sbudgeted, info));
             SkASSERT(surface);
             REPORTER_ASSERT(reporter, sbudgeted == is_budgeted(surface));
 
@@ -763,8 +760,7 @@
             { SkSurface::kDiscard_ContentChangeMode, SkSurface::kRetain_ContentChangeMode};
     for (auto& test_func : { &test_no_canvas1, &test_no_canvas2 }) {
         for (auto& mode : modes) {
-            SkAutoTUnref<SkSurface> surface(create_surface());
-            test_func(reporter, surface, mode);
+            test_func(reporter, create_surface().get(), mode);
         }
     }
 }
@@ -775,9 +771,8 @@
     for (auto& surface_func : { &create_gpu_surface, &create_gpu_scratch_surface }) {
         for (auto& test_func : { &test_no_canvas1, &test_no_canvas2 }) {
             for (auto& mode : modes) {
-                SkAutoTUnref<SkSurface> surface(
-                    surface_func(context, kPremul_SkAlphaType, nullptr));
-                test_func(reporter, surface, mode);
+                auto surface(surface_func(context, kPremul_SkAlphaType, nullptr));
+                test_func(reporter, surface.get(), mode);
             }
         }
     }
@@ -807,26 +802,25 @@
 DEF_TEST(surface_rowbytes, reporter) {
     const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
 
-    SkAutoTUnref<SkSurface> surf0(SkSurface::NewRaster(info));
-    check_rowbytes_remain_consistent(surf0, reporter);
+    auto surf0(SkSurface::MakeRaster(info));
+    check_rowbytes_remain_consistent(surf0.get(), reporter);
 
     // specify a larger rowbytes
-    SkAutoTUnref<SkSurface> surf1(SkSurface::NewRaster(info, 500, nullptr));
-    check_rowbytes_remain_consistent(surf1, reporter);
+    auto surf1(SkSurface::MakeRaster(info, 500, nullptr));
+    check_rowbytes_remain_consistent(surf1.get(), reporter);
 
     // Try some illegal rowByte values
-    SkSurface* s = SkSurface::NewRaster(info, 396, nullptr);    // needs to be at least 400
+    auto s = SkSurface::MakeRaster(info, 396, nullptr);    // needs to be at least 400
     REPORTER_ASSERT(reporter, nullptr == s);
-    s = SkSurface::NewRaster(info, 1 << 30, nullptr); // allocation to large
+    s = SkSurface::MakeRaster(info, 1 << 30, nullptr); // allocation to large
     REPORTER_ASSERT(reporter, nullptr == s);
 }
 
 #if SK_SUPPORT_GPU
 
-void test_surface_clear(skiatest::Reporter* reporter, SkSurface* surfacePtr,
+void test_surface_clear(skiatest::Reporter* reporter, sk_sp<SkSurface> surface,
                         std::function<GrSurface*(SkSurface*)> grSurfaceGetter,
                         uint32_t expectedValue) {
-    SkAutoTUnref<SkSurface> surface(surfacePtr);
     if (!surface) {
         ERRORF(reporter, "Could not create GPU SkSurface.");
         return;
@@ -836,12 +830,11 @@
     SkAutoTDeleteArray<uint32_t> pixels(new uint32_t[w * h]);
     memset(pixels.get(), ~expectedValue, sizeof(uint32_t) * w * h);
 
-    SkAutoTUnref<GrSurface> grSurface(SkSafeRef(grSurfaceGetter(surface)));
+    SkAutoTUnref<GrSurface> grSurface(SkSafeRef(grSurfaceGetter(surface.get())));
     if (!grSurface) {
         ERRORF(reporter, "Could access render target of GPU SkSurface.");
         return;
     }
-    SkASSERT(surface->unique());
     surface.reset();
     grSurface->readPixels(0, 0, w, h, kRGBA_8888_GrPixelConfig, pixels.get());
     for (int y = 0; y < h; ++y) {
@@ -875,7 +868,7 @@
     };
     for (auto grSurfaceGetter : grSurfaceGetters) {
         for (auto& surface_func : {&create_gpu_surface, &create_gpu_scratch_surface}) {
-            SkSurface* surface = surface_func(context, kPremul_SkAlphaType, nullptr);
+            auto surface = surface_func(context, kPremul_SkAlphaType, nullptr);
             test_surface_clear(reporter, surface, grSurfaceGetter, 0x0);
         }
         // Wrapped RTs are *not* supposed to clear (to allow client to partially update a surface).
@@ -895,7 +888,7 @@
         desc.fFlags = kRenderTarget_GrBackendTextureFlag;
         desc.fTextureHandle = textureObject;
 
-        SkSurface* surface = SkSurface::NewFromBackendTexture(context, desc, nullptr);
+        auto surface = SkSurface::MakeFromBackendTexture(context, desc, nullptr);
         test_surface_clear(reporter, surface, grSurfaceGetter, 0xABABABAB);
         context->getGpu()->deleteTestingOnlyBackendTexture(textureObject);
     }
diff --git a/tests/TextBlobCacheTest.cpp b/tests/TextBlobCacheTest.cpp
index b7456d6..6ec3263 100644
--- a/tests/TextBlobCacheTest.cpp
+++ b/tests/TextBlobCacheTest.cpp
@@ -66,8 +66,7 @@
     }
 
     SkImageInfo info = SkImageInfo::Make(kWidth, kHeight, kN32_SkColorType, kPremul_SkAlphaType);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info,
-                                                               0, &props));
+    auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0, &props));
     REPORTER_ASSERT(reporter, surface);
     if (!surface) {
         return;
@@ -133,7 +132,7 @@
     // create surface where LCD is impossible
     info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
     SkSurfaceProps propsNoLCD(0, kUnknown_SkPixelGeometry);
-    SkAutoTUnref<SkSurface> surfaceNoLCD(canvas->newSurface(info, &propsNoLCD));
+    auto surfaceNoLCD(canvas->makeSurface(info, &propsNoLCD));
     REPORTER_ASSERT(reporter, surface);
     if (!surface) {
         return;
diff --git a/tests/TextureStorageAllocator.cpp b/tests/TextureStorageAllocator.cpp
index 5c9962e..1d22686 100644
--- a/tests/TextureStorageAllocator.cpp
+++ b/tests/TextureStorageAllocator.cpp
@@ -66,7 +66,7 @@
     grAllocator.fDeallocateTextureStorage= &TestStorageAllocator::deallocateTextureStorage;
     grAllocator.fCtx = &allocator;
 
-    SkAutoTUnref<SkSurface> surface(SkSurface_Gpu::NewRenderTarget(
+    auto surface(SkSurface_Gpu::MakeRenderTarget(
             context, SkBudgeted::kNo, SkImageInfo::MakeN32Premul(kWidth, kHeight), 0,
             NULL, grAllocator));
     REPORTER_ASSERT(reporter, surface);
@@ -100,7 +100,7 @@
     grAllocator.fAllocateTextureStorage = &TestStorageAllocator::allocateTextureStorage;
     grAllocator.fDeallocateTextureStorage= &TestStorageAllocator::deallocateTextureStorage;
     grAllocator.fCtx = &allocator;
-    SkAutoTUnref<SkSurface> surface(SkSurface_Gpu::NewRenderTarget(
+    auto surface(SkSurface_Gpu::MakeRenderTarget(
             context, SkBudgeted::kNo, SkImageInfo::MakeN32Premul(kWidth, kHeight), 0,
             NULL, grAllocator));
     REPORTER_ASSERT(reporter, !surface);
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 0141bf3..6dda6ff 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -294,7 +294,7 @@
 
 DEF_TEST(WritePixelsSurfaceGenID, reporter) {
     const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+    auto surface(SkSurface::MakeRaster(info));
     uint32_t genID1 = surface->generationID();
     call_writepixels(surface->getCanvas());
     uint32_t genID2 = surface->generationID();
@@ -400,8 +400,9 @@
         if (!tightRowBytes) {
             memset(pixels, DEV_PAD, size);
         }
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterDirectReleaseProc(info, pixels, rowBytes, free_pixels, nullptr));
-        test_write_pixels(reporter, surface);
+        auto surface(SkSurface::MakeRasterDirectReleaseProc(info, pixels, rowBytes,
+                                                            free_pixels, nullptr));
+        test_write_pixels(reporter, surface.get());
     }
 }
 #if SK_SUPPORT_GPU
@@ -415,8 +416,8 @@
         desc.fOrigin = origin;
         SkAutoTUnref<GrTexture> texture(context->textureProvider()->createTexture(desc,
                                                                                   SkBudgeted::kNo));
-        SkAutoTUnref<SkSurface> surface(SkSurface::NewRenderTargetDirect(texture->asRenderTarget()));
-        test_write_pixels(reporter, surface);
+        auto surface(SkSurface::MakeRenderTargetDirect(texture->asRenderTarget()));
+        test_write_pixels(reporter, surface.get());
     }
 }
 #endif
diff --git a/tools/VisualBench/VisualBench.cpp b/tools/VisualBench/VisualBench.cpp
index 69d47b6..cbd1abe 100644
--- a/tools/VisualBench/VisualBench.cpp
+++ b/tools/VisualBench/VisualBench.cpp
@@ -78,7 +78,7 @@
 SkSurface* VisualBench::createSurface() {
     if (!fSurface) {
         SkSurfaceProps props(INHERITED::getSurfaceProps());
-        fSurface.reset(SkSurface::NewRenderTargetDirect(fRenderTarget, &props));
+        fSurface.reset(SkSurface::MakeRenderTargetDirect(fRenderTarget, &props).release());
     }
 
     // The caller will wrap the SkSurface in an SkAutoTUnref
diff --git a/tools/VisualBench/WrappedBenchmark.h b/tools/VisualBench/WrappedBenchmark.h
index 35d64ee..bd88f13 100644
--- a/tools/VisualBench/WrappedBenchmark.h
+++ b/tools/VisualBench/WrappedBenchmark.h
@@ -36,20 +36,20 @@
         fBench->perCanvasPreDraw(fOffScreen->getCanvas());
     }
     void onPreDraw(SkCanvas* canvas) override {
-        SkASSERT(fOffScreen.get());
+        SkASSERT(fOffScreen);
         fBench->preDraw(fOffScreen->getCanvas());
     }
     void onPostDraw(SkCanvas* canvas) override {
-        SkASSERT(fOffScreen.get());
+        SkASSERT(fOffScreen);
         fBench->postDraw(fOffScreen->getCanvas());
     }
     void onPerCanvasPostDraw(SkCanvas* canvas) override {
-        SkASSERT(fOffScreen.get());
+        SkASSERT(fOffScreen);
         fBench->perCanvasPostDraw(fOffScreen->getCanvas());
     }
 
     void onDraw(int loops, SkCanvas* canvas) override {
-        SkASSERT(fOffScreen.get());
+        SkASSERT(fOffScreen);
         fBench->draw(loops, fOffScreen->getCanvas());
         this->blitToScreen(canvas);
     }
@@ -68,7 +68,7 @@
     virtual void onBlitToScreen(SkCanvas* canvas, int w, int h) = 0;
 
     SkSurfaceProps          fSurfaceProps;
-    SkAutoTUnref<SkSurface> fOffScreen;
+    sk_sp<SkSurface>        fOffScreen;
     SkAutoTUnref<Benchmark> fBench;
 };
 
@@ -80,7 +80,7 @@
 
 private:
     void setupOffScreen(SkCanvas* canvas) override {
-        fOffScreen.reset(SkSurface::NewRaster(canvas->imageInfo(), &this->surfaceProps()));
+        fOffScreen = SkSurface::MakeRaster(canvas->imageInfo(), &this->surfaceProps());
     }
 
     void onBlitToScreen(SkCanvas* canvas, int w, int h) override {
@@ -104,11 +104,11 @@
 
 private:
     void setupOffScreen(SkCanvas* canvas) override {
-        fOffScreen.reset(SkSurface::NewRenderTarget(canvas->getGrContext(),
+        fOffScreen = SkSurface::MakeRenderTarget(canvas->getGrContext(),
                                                     SkBudgeted::kNo,
                                                     canvas->imageInfo(),
                                                     fNumSamples,
-                                                    &this->surfaceProps()));
+                                                    &this->surfaceProps());
     }
 
     void onBlitToScreen(SkCanvas* canvas, int w, int h) override {
diff --git a/tools/android/SkAndroidSDKCanvas.cpp b/tools/android/SkAndroidSDKCanvas.cpp
index d7a76ca..d31f93b 100644
--- a/tools/android/SkAndroidSDKCanvas.cpp
+++ b/tools/android/SkAndroidSDKCanvas.cpp
@@ -12,6 +12,7 @@
 #include "SkPaint.h"
 #include "SkPathEffect.h"
 #include "SkShader.h"
+#include "SkSurface.h"
 #include "SkTLazy.h"
 
 namespace {
@@ -287,9 +288,9 @@
 bool SkAndroidSDKCanvas::isClipEmpty() const { return fProxyTarget->isClipEmpty(); }
 bool SkAndroidSDKCanvas::isClipRect() const { return fProxyTarget->isClipRect(); }
 
-SkSurface* SkAndroidSDKCanvas::onNewSurface(const SkImageInfo& info,
-                                                     const SkSurfaceProps& props) {
-    return fProxyTarget->newSurface(info, &props);
+sk_sp<SkSurface> SkAndroidSDKCanvas::onNewSurface(const SkImageInfo& info,
+                                                  const SkSurfaceProps& props) {
+    return fProxyTarget->makeSurface(info, &props);
 }
 
 bool SkAndroidSDKCanvas::onPeekPixels(SkPixmap* pmap) {
diff --git a/tools/android/SkAndroidSDKCanvas.h b/tools/android/SkAndroidSDKCanvas.h
index 68a5381..812775f 100644
--- a/tools/android/SkAndroidSDKCanvas.h
+++ b/tools/android/SkAndroidSDKCanvas.h
@@ -87,7 +87,7 @@
     bool getClipDeviceBounds(SkIRect*) const override;
     bool isClipEmpty() const override;
     bool isClipRect() const override;
-    SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
+    sk_sp<SkSurface> onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override;
     bool onPeekPixels(SkPixmap*) override;
     bool onAccessTopLayerPixels(SkPixmap*) override;
     void willSave() override;
diff --git a/tools/kilobench/kilobench.cpp b/tools/kilobench/kilobench.cpp
index 06cb33f..c0422d8 100644
--- a/tools/kilobench/kilobench.cpp
+++ b/tools/kilobench/kilobench.cpp
@@ -182,9 +182,9 @@
         uint32_t flags = useDfText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag :
                                                   0;
         SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
-        fSurface.reset(SkSurface::NewRenderTarget(context,
-                                                  SkBudgeted::kNo, info,
-                                                  numSamples, &props));
+        fSurface.reset(SkSurface::MakeRenderTarget(context,
+                                                   SkBudgeted::kNo, info,
+                                                   numSamples, &props).release());
         fGL = factory->getContextInfo(ctxType, ctxOptions).fGLContext;
         if (!fSurface.get()) {
             return false;
diff --git a/tools/skhello.cpp b/tools/skhello.cpp
index 61502a6..d033641 100644
--- a/tools/skhello.cpp
+++ b/tools/skhello.cpp
@@ -34,7 +34,7 @@
 static bool do_surface(int w, int h, const char path[], const char text[],
                        const SkPaint& paint) {
     SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
-    SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(w, h, &props));
+    sk_sp<SkSurface> surface(SkSurface::MakeRasterN32Premul(w, h, &props));
     doDraw(surface->getCanvas(), paint, text);
 
     sk_sp<SkImage> image(surface->makeImageSnapshot());
diff --git a/tools/skiaserve/Request.cpp b/tools/skiaserve/Request.cpp
index 110bd49..47b467c 100644
--- a/tools/skiaserve/Request.cpp
+++ b/tools/skiaserve/Request.cpp
@@ -140,7 +140,7 @@
     SkIRect bounds = this->getBounds();
     SkImageInfo info = SkImageInfo::Make(bounds.width(), bounds.height(), kN32_SkColorType,
                                          kPremul_SkAlphaType);
-    return SkSurface::NewRaster(info);
+    return SkSurface::MakeRaster(info).release();
 }
 
 SkSurface* Request::createGPUSurface() {
@@ -150,8 +150,8 @@
                                          kN32_SkColorType, kPremul_SkAlphaType);
     uint32_t flags = 0;
     SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType);
-    SkSurface* surface = SkSurface::NewRenderTarget(context, SkBudgeted::kNo, info, 0,
-                                                    &props);
+    SkSurface* surface = SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0,
+                                                     &props).release();
     return surface;
 }