Remove SkAutoTDelete.

Replace with std::unique_ptr.

Change-Id: I5806cfbb30515fcb20e5e66ce13fb5f3b8728176
Reviewed-on: https://skia-review.googlesource.com/4381
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
diff --git a/src/android/SkBitmapRegionCodec.h b/src/android/SkBitmapRegionCodec.h
index 7977417..5c59d52 100644
--- a/src/android/SkBitmapRegionCodec.h
+++ b/src/android/SkBitmapRegionCodec.h
@@ -30,7 +30,7 @@
 
 private:
 
-    SkAutoTDelete<SkAndroidCodec> fCodec;
+    std::unique_ptr<SkAndroidCodec> fCodec;
 
     typedef SkBitmapRegionDecoder INHERITED;
 
diff --git a/src/android/SkBitmapRegionDecoder.cpp b/src/android/SkBitmapRegionDecoder.cpp
index 6dd48c5..15a530e 100644
--- a/src/android/SkBitmapRegionDecoder.cpp
+++ b/src/android/SkBitmapRegionDecoder.cpp
@@ -19,11 +19,11 @@
 
 SkBitmapRegionDecoder* SkBitmapRegionDecoder::Create(
         SkStreamRewindable* stream, Strategy strategy) {
-    SkAutoTDelete<SkStreamRewindable> streamDeleter(stream);
+    std::unique_ptr<SkStreamRewindable> streamDeleter(stream);
     switch (strategy) {
         case kAndroidCodec_Strategy: {
-            SkAutoTDelete<SkAndroidCodec> codec =
-                    SkAndroidCodec::NewFromStream(streamDeleter.release());
+            std::unique_ptr<SkAndroidCodec> codec(
+                    SkAndroidCodec::NewFromStream(streamDeleter.release()));
             if (nullptr == codec) {
                 SkCodecPrintf("Error: Failed to create codec.\n");
                 return NULL;
diff --git a/src/animator/SkDisplayApply.cpp b/src/animator/SkDisplayApply.cpp
index 0d5f09d..776d08f 100644
--- a/src/animator/SkDisplayApply.cpp
+++ b/src/animator/SkDisplayApply.cpp
@@ -463,7 +463,7 @@
     int count = (int) (size / sizeof(SkScalar));
     int activeIndex = fActive->fDrawIndex + index;
     SkOperand* last = new SkOperand[count];
-    SkAutoTDelete<SkOperand> autoLast(last);
+    std::unique_ptr<SkOperand> autoLast(last);
     if (type != SkType_MemberProperty) {
         info->getValue(target, last, count);
         SkOperand* saveOperand = fActive->fSaveRestore[activeIndex];
diff --git a/src/animator/SkSnapshot.cpp b/src/animator/SkSnapshot.cpp
index 4d35432..fbaedff 100644
--- a/src/animator/SkSnapshot.cpp
+++ b/src/animator/SkSnapshot.cpp
@@ -42,7 +42,7 @@
     if (!encoder) {
         return false;
     }
-    SkAutoTDelete<SkImageEncoder> ad(encoder);
+    std::unique_ptr<SkImageEncoder> ad(encoder);
 
     SkString name(filename);
     if (sequence) {
diff --git a/src/codec/SkAndroidCodec.cpp b/src/codec/SkAndroidCodec.cpp
index 0a4172f..01605b2 100644
--- a/src/codec/SkAndroidCodec.cpp
+++ b/src/codec/SkAndroidCodec.cpp
@@ -23,7 +23,7 @@
 {}
 
 SkAndroidCodec* SkAndroidCodec::NewFromStream(SkStream* stream, SkPngChunkReader* chunkReader) {
-    SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream, chunkReader));
+    std::unique_ptr<SkCodec> codec(SkCodec::NewFromStream(stream, chunkReader));
     if (nullptr == codec) {
         return nullptr;
     }
diff --git a/src/codec/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index b0ef8ad..b3a8010 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -503,7 +503,7 @@
 
             if (codecOut) {
                 // Check that input bit masks are valid and create the masks object
-                SkAutoTDelete<SkMasks> masks(SkMasks::CreateMasks(inputMasks, bitsPerPixel));
+                std::unique_ptr<SkMasks> masks(SkMasks::CreateMasks(inputMasks, bitsPerPixel));
                 if (nullptr == masks) {
                     SkCodecPrintf("Error: invalid input masks.\n");
                     return false;
@@ -569,7 +569,7 @@
  * Reads enough of the stream to determine the image format
  */
 SkCodec* SkBmpCodec::NewFromStream(SkStream* stream, bool inIco) {
-    SkAutoTDelete<SkStream> streamDeleter(stream);
+    std::unique_ptr<SkStream> streamDeleter(stream);
     SkCodec* codec = nullptr;
     if (ReadHeader(stream, inIco, &codec)) {
         // codec has taken ownership of stream, so we do not need to
diff --git a/src/codec/SkBmpMaskCodec.cpp b/src/codec/SkBmpMaskCodec.cpp
index 5b28252..a5705ee 100644
--- a/src/codec/SkBmpMaskCodec.cpp
+++ b/src/codec/SkBmpMaskCodec.cpp
@@ -60,7 +60,7 @@
 SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo,
         const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputColorCount) {
     // Initialize the mask swizzler
-    fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(dstInfo, this->getInfo(), fMasks,
+    fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(dstInfo, this->getInfo(), fMasks.get(),
             this->bitsPerPixel(), options));
     SkASSERT(fMaskSwizzler);
 
diff --git a/src/codec/SkBmpMaskCodec.h b/src/codec/SkBmpMaskCodec.h
index 4cfd4d2..a1927f8 100644
--- a/src/codec/SkBmpMaskCodec.h
+++ b/src/codec/SkBmpMaskCodec.h
@@ -46,15 +46,15 @@
 
     SkSampler* getSampler(bool createIfNecessary) override {
         SkASSERT(fMaskSwizzler);
-        return fMaskSwizzler;
+        return fMaskSwizzler.get();
     }
 
     int decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes,
             const Options& opts) override;
 
-    SkAutoTDelete<SkMasks>              fMasks;        // owned
-    SkAutoTDelete<SkMaskSwizzler>       fMaskSwizzler;
-    std::unique_ptr<uint8_t[]>          fSrcBuffer;
+    std::unique_ptr<SkMasks>        fMasks;
+    std::unique_ptr<SkMaskSwizzler> fMaskSwizzler;
+    std::unique_ptr<uint8_t[]>      fSrcBuffer;
 
     typedef SkBmpCodec INHERITED;
 };
diff --git a/src/codec/SkBmpRLECodec.cpp b/src/codec/SkBmpRLECodec.cpp
index 33ba851..6e7bac9 100644
--- a/src/codec/SkBmpRLECodec.cpp
+++ b/src/codec/SkBmpRLECodec.cpp
@@ -548,7 +548,7 @@
         fSampler.reset(new SkBmpRLESampler(this));
     }
 
-    return fSampler;
+    return fSampler.get();
 }
 
 int SkBmpRLECodec::setSampleX(int sampleX){
diff --git a/src/codec/SkBmpRLECodec.h b/src/codec/SkBmpRLECodec.h
index 1291e9f..ff1a274 100644
--- a/src/codec/SkBmpRLECodec.h
+++ b/src/codec/SkBmpRLECodec.h
@@ -104,7 +104,7 @@
     const size_t                        fOrigRLEBytes;
     uint32_t                            fCurrRLEByte;
     int                                 fSampleX;
-    SkAutoTDelete<SkSampler>            fSampler;
+    std::unique_ptr<SkSampler>          fSampler;
 
     // Scanline decodes allow the client to ask for a single scanline at a time.
     // This can be tricky when the RLE encoding instructs the decoder to jump down
diff --git a/src/codec/SkBmpStandardCodec.h b/src/codec/SkBmpStandardCodec.h
index edb88ac..20665db 100644
--- a/src/codec/SkBmpStandardCodec.h
+++ b/src/codec/SkBmpStandardCodec.h
@@ -61,7 +61,7 @@
 
     SkSampler* getSampler(bool createIfNecessary) override {
         SkASSERT(fSwizzler);
-        return fSwizzler;
+        return fSwizzler.get();
     }
 
 private:
@@ -89,7 +89,7 @@
     const uint32_t                      fNumColors;
     const uint32_t                      fBytesPerColor;
     const uint32_t                      fOffset;
-    SkAutoTDelete<SkSwizzler>           fSwizzler;
+    std::unique_ptr<SkSwizzler>         fSwizzler;
     std::unique_ptr<uint8_t[]>          fSrcBuffer;
     const bool                          fIsOpaque;
     const bool                          fInIco;
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index 31323f0..2673d2e 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -53,7 +53,7 @@
         return nullptr;
     }
 
-    SkAutoTDelete<SkStream> streamDeleter(stream);
+    std::unique_ptr<SkStream> streamDeleter(stream);
 
     // 14 is enough to read all of the supported types.
     const size_t bytesToRead = 14;
diff --git a/src/codec/SkCodecImageGenerator.h b/src/codec/SkCodecImageGenerator.h
index 22a39aa..3abc908 100644
--- a/src/codec/SkCodecImageGenerator.h
+++ b/src/codec/SkCodecImageGenerator.h
@@ -36,7 +36,7 @@
      */
     SkCodecImageGenerator(SkCodec* codec, sk_sp<SkData>);
 
-    SkAutoTDelete<SkCodec> fCodec;
+    std::unique_ptr<SkCodec> fCodec;
     sk_sp<SkData> fData;
 
     typedef SkImageGenerator INHERITED;
diff --git a/src/codec/SkIcoCodec.cpp b/src/codec/SkIcoCodec.cpp
index e4fce4c..b5e399d 100644
--- a/src/codec/SkIcoCodec.cpp
+++ b/src/codec/SkIcoCodec.cpp
@@ -33,7 +33,7 @@
  */
 SkCodec* SkIcoCodec::NewFromStream(SkStream* stream) {
     // Ensure that we do not leak the input stream
-    SkAutoTDelete<SkStream> inputStream(stream);
+    std::unique_ptr<SkStream> inputStream(stream);
 
     // Header size constants
     static const uint32_t kIcoDirectoryBytes = 6;
@@ -107,8 +107,8 @@
 
     // Now will construct a candidate codec for each of the embedded images
     uint32_t bytesRead = kIcoDirectoryBytes + numImages * kIcoDirEntryBytes;
-    SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> codecs(
-            new (SkTArray<SkAutoTDelete<SkCodec>, true>)(numImages));
+    std::unique_ptr<SkTArray<std::unique_ptr<SkCodec>, true>> codecs(
+            new (SkTArray<std::unique_ptr<SkCodec>, true>)(numImages));
     for (uint32_t i = 0; i < numImages; i++) {
         uint32_t offset = directoryEntries.get()[i].offset;
         uint32_t size = directoryEntries.get()[i].size;
@@ -133,7 +133,7 @@
             SkCodecPrintf("Warning: could not create embedded stream.\n");
             break;
         }
-        SkAutoTDelete<SkMemoryStream> embeddedStream(new SkMemoryStream(data));
+        std::unique_ptr<SkMemoryStream> embeddedStream(new SkMemoryStream(data));
         bytesRead += size;
 
         // Check if the embedded codec is bmp or png and create the codec
@@ -183,7 +183,7 @@
  * Called only by NewFromStream
  */
 SkIcoCodec::SkIcoCodec(int width, int height, const SkEncodedInfo& info,
-                       SkTArray<SkAutoTDelete<SkCodec>, true>* codecs,
+                       SkTArray<std::unique_ptr<SkCodec>, true>* codecs,
                        sk_sp<SkColorSpace> colorSpace)
     : INHERITED(width, height, info, nullptr, std::move(colorSpace))
     , fEmbeddedCodecs(codecs)
@@ -255,10 +255,8 @@
             break;
         }
 
-        SkCodec* embeddedCodec = fEmbeddedCodecs->operator[](index);
-        result = embeddedCodec->getPixels(dstInfo, dst, dstRowBytes, &opts, colorTable,
-                colorCount);
-
+        SkCodec* embeddedCodec = fEmbeddedCodecs->operator[](index).get();
+        result = embeddedCodec->getPixels(dstInfo, dst, dstRowBytes, &opts, colorTable, colorCount);
         switch (result) {
             case kSuccess:
             case kIncompleteInput:
@@ -288,7 +286,7 @@
             break;
         }
 
-        SkCodec* embeddedCodec = fEmbeddedCodecs->operator[](index);
+        SkCodec* embeddedCodec = fEmbeddedCodecs->operator[](index).get();
         result = embeddedCodec->startScanlineDecode(dstInfo, &options, colorTable, colorCount);
         if (kSuccess == result) {
             fCurrScanlineCodec = embeddedCodec;
@@ -323,7 +321,7 @@
             break;
         }
 
-        SkCodec* embeddedCodec = fEmbeddedCodecs->operator[](index);
+        SkCodec* embeddedCodec = fEmbeddedCodecs->operator[](index).get();
         switch (embeddedCodec->startIncrementalDecode(dstInfo,
                 pixels, rowBytes, &options, colorTable, colorCount)) {
             case kSuccess:
diff --git a/src/codec/SkIcoCodec.h b/src/codec/SkIcoCodec.h
index b9ed823..0c4e504 100644
--- a/src/codec/SkIcoCodec.h
+++ b/src/codec/SkIcoCodec.h
@@ -77,16 +77,16 @@
      * @param embeddedCodecs codecs for the embedded images, takes ownership
      */
     SkIcoCodec(int width, int height, const SkEncodedInfo& info,
-            SkTArray<SkAutoTDelete<SkCodec>, true>* embeddedCodecs, sk_sp<SkColorSpace> colorSpace);
+            SkTArray<std::unique_ptr<SkCodec>, true>* embeddedCodecs, sk_sp<SkColorSpace> colorSpace);
 
-    SkAutoTDelete<SkTArray<SkAutoTDelete<SkCodec>, true>> fEmbeddedCodecs; // owned
+    std::unique_ptr<SkTArray<std::unique_ptr<SkCodec>, true>> fEmbeddedCodecs;
 
     // Only used by the scanline decoder.  onStartScanlineDecode() will set
     // fCurrScanlineCodec to one of the fEmbeddedCodecs, if it can find a
     // codec of the appropriate size.  We will use fCurrScanlineCodec for
     // subsequent calls to onGetScanlines() or onSkipScanlines().
     // fCurrScanlineCodec is owned by this class, but should not be an
-    // SkAutoTDelete.  It will be deleted by the destructor of fEmbeddedCodecs.
+    // std::unique_ptr.  It will be deleted by the destructor of fEmbeddedCodecs.
     SkCodec* fCurrScanlineCodec;
 
     // Only used by incremental decoder.  onStartIncrementalDecode() will set
@@ -94,7 +94,7 @@
     // codec of the appropriate size.  We will use fCurrIncrementalCodec for
     // subsequent calls to incrementalDecode().
     // fCurrIncrementalCodec is owned by this class, but should not be an
-    // SkAutoTDelete.  It will be deleted by the destructor of fEmbeddedCodecs.
+    // std::unique_ptr.  It will be deleted by the destructor of fEmbeddedCodecs.
     SkCodec* fCurrIncrementalCodec;
 
     typedef SkCodec INHERITED;
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 1c8ace5..e762483 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -192,7 +192,7 @@
         JpegDecoderMgr** decoderMgrOut) {
 
     // Create a JpegDecoderMgr to own all of the decompress information
-    SkAutoTDelete<JpegDecoderMgr> decoderMgr(new JpegDecoderMgr(stream));
+    std::unique_ptr<JpegDecoderMgr> decoderMgr(new JpegDecoderMgr(stream));
 
     // libjpeg errors will be caught and reported here
     if (setjmp(decoderMgr->getJmpBuf())) {
@@ -251,7 +251,7 @@
 }
 
 SkCodec* SkJpegCodec::NewFromStream(SkStream* stream) {
-    SkAutoTDelete<SkStream> streamDeleter(stream);
+    std::unique_ptr<SkStream> streamDeleter(stream);
     SkCodec* codec = nullptr;
     if (ReadHeader(stream,  &codec, nullptr)) {
         // Codec has taken ownership of the stream, we do not need to delete it
@@ -635,12 +635,12 @@
 SkSampler* SkJpegCodec::getSampler(bool createIfNecessary) {
     if (!createIfNecessary || fSwizzler) {
         SkASSERT(!fSwizzler || (fSwizzleSrcRow && fStorage.get() == fSwizzleSrcRow));
-        return fSwizzler;
+        return fSwizzler.get();
     }
 
     this->initializeSwizzler(this->dstInfo(), this->options());
     this->allocateStorage(this->dstInfo());
-    return fSwizzler;
+    return fSwizzler.get();
 }
 
 SkCodec::Result SkJpegCodec::onStartScanlineDecode(const SkImageInfo& dstInfo,
diff --git a/src/codec/SkJpegCodec.h b/src/codec/SkJpegCodec.h
index a889a4a..9e08c86 100644
--- a/src/codec/SkJpegCodec.h
+++ b/src/codec/SkJpegCodec.h
@@ -116,7 +116,7 @@
     int onGetScanlines(void* dst, int count, size_t rowBytes) override;
     bool onSkipScanlines(int count) override;
 
-    SkAutoTDelete<JpegDecoderMgr>      fDecoderMgr;
+    std::unique_ptr<JpegDecoderMgr>    fDecoderMgr;
 
     // We will save the state of the decompress struct after reading the header.
     // This allows us to safely call onGetScaledDimensions() at any time.
@@ -132,7 +132,7 @@
     // to further subset the output from libjpeg-turbo.
     SkIRect                            fSwizzlerSubset;
 
-    SkAutoTDelete<SkSwizzler>          fSwizzler;
+    std::unique_ptr<SkSwizzler>        fSwizzler;
 
     typedef SkCodec INHERITED;
 };
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index ae11048..da6e062 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -1144,11 +1144,11 @@
 
 SkSampler* SkPngCodec::getSampler(bool createIfNecessary) {
     if (fSwizzler || !createIfNecessary) {
-        return fSwizzler;
+        return fSwizzler.get();
     }
 
     this->initializeSwizzler(this->dstInfo(), this->options());
-    return fSwizzler;
+    return fSwizzler.get();
 }
 
 bool SkPngCodec::onRewind() {
@@ -1249,7 +1249,7 @@
 }
 
 SkCodec* SkPngCodec::NewFromStream(SkStream* stream, SkPngChunkReader* chunkReader) {
-    SkAutoTDelete<SkStream> streamDeleter(stream);
+    std::unique_ptr<SkStream> streamDeleter(stream);
 
     SkCodec* outCodec = nullptr;
     if (read_header(streamDeleter.get(), chunkReader, &outCodec, nullptr, nullptr)) {
diff --git a/src/codec/SkPngCodec.h b/src/codec/SkPngCodec.h
index c10f174..2c427ca 100644
--- a/src/codec/SkPngCodec.h
+++ b/src/codec/SkPngCodec.h
@@ -61,7 +61,7 @@
     voidp png_ptr() { return fPng_ptr; }
     voidp info_ptr() { return fInfo_ptr; }
 
-    SkSwizzler* swizzler() { return fSwizzler; }
+    SkSwizzler* swizzler() { return fSwizzler.get(); }
 
     // Initialize variables used by applyXformRow.
     void initializeXformParams();
@@ -97,7 +97,7 @@
 
     // These are stored here so they can be used both by normal decoding and scanline decoding.
     SkAutoTUnref<SkColorTable>         fColorTable;    // May be unpremul.
-    SkAutoTDelete<SkSwizzler>          fSwizzler;
+    std::unique_ptr<SkSwizzler>        fSwizzler;
     SkAutoTMalloc<uint8_t>             fStorage;
     uint32_t*                          fColorXformSrcRow;
     const int                          fBitDepth;
diff --git a/src/codec/SkRawCodec.cpp b/src/codec/SkRawCodec.cpp
index 5ae44d1..26519e6 100644
--- a/src/codec/SkRawCodec.cpp
+++ b/src/codec/SkRawCodec.cpp
@@ -322,7 +322,7 @@
         return fStreamBuffer.write(tempBuffer.get(), bytesRead);
     }
 
-    SkAutoTDelete<SkStream> fStream;
+    std::unique_ptr<SkStream> fStream;
     bool fWholeStreamRead;
 
     // Use a size-limited stream to avoid holding too huge buffer.
@@ -396,7 +396,7 @@
         }
     }
 private:
-    SkAutoTDelete<SkStream> fStream;
+    std::unique_ptr<SkStream> fStream;
 };
 
 class SkPiexStream : public ::piex::StreamInterface {
@@ -446,7 +446,7 @@
      * Note: this will take the ownership of the stream.
      */
     static SkDngImage* NewFromStream(SkRawStream* stream) {
-        SkAutoTDelete<SkDngImage> dngImage(new SkDngImage(stream));
+        std::unique_ptr<SkDngImage> dngImage(new SkDngImage(stream));
         if (!dngImage->isTiffHeaderValid()) {
             return nullptr;
         }
@@ -479,10 +479,10 @@
         const int preferredSize = SkTMax(width, height);
         try {
             // render() takes ownership of fHost, fInfo, fNegative and fDngStream when available.
-            SkAutoTDelete<dng_host> host(fHost.release());
-            SkAutoTDelete<dng_info> info(fInfo.release());
-            SkAutoTDelete<dng_negative> negative(fNegative.release());
-            SkAutoTDelete<dng_stream> dngStream(fDngStream.release());
+            std::unique_ptr<dng_host> host(fHost.release());
+            std::unique_ptr<dng_info> info(fInfo.release());
+            std::unique_ptr<dng_negative> negative(fNegative.release());
+            std::unique_ptr<dng_stream> dngStream(fDngStream.release());
 
             host->SetPreferredSize(preferredSize);
             host->ValidateSizes();
@@ -588,7 +588,7 @@
             // Due to the limit of DNG SDK, we need to reset host and info.
             fHost.reset(new SkDngHost(&fAllocator));
             fInfo.reset(new dng_info);
-            fDngStream.reset(new SkDngStream(fStream));
+            fDngStream.reset(new SkDngStream(fStream.get()));
 
             fHost->ValidateSizes();
             fInfo->Parse(*fHost, *fDngStream);
@@ -622,11 +622,11 @@
     {}
 
     SkDngMemoryAllocator fAllocator;
-    SkAutoTDelete<SkRawStream> fStream;
-    SkAutoTDelete<dng_host> fHost;
-    SkAutoTDelete<dng_info> fInfo;
-    SkAutoTDelete<dng_negative> fNegative;
-    SkAutoTDelete<dng_stream> fDngStream;
+    std::unique_ptr<SkRawStream> fStream;
+    std::unique_ptr<dng_host> fHost;
+    std::unique_ptr<dng_info> fInfo;
+    std::unique_ptr<dng_negative> fNegative;
+    std::unique_ptr<dng_stream> fDngStream;
 
     int fWidth;
     int fHeight;
@@ -641,7 +641,7 @@
  * fallback to create SkRawCodec for DNG images.
  */
 SkCodec* SkRawCodec::NewFromStream(SkStream* stream) {
-    SkAutoTDelete<SkRawStream> rawStream;
+    std::unique_ptr<SkRawStream> rawStream;
     if (is_asset_stream(*stream)) {
         rawStream.reset(new SkRawAssetStream(stream));
     } else {
@@ -671,7 +671,7 @@
     }
 
     // Takes the ownership of the rawStream.
-    SkAutoTDelete<SkDngImage> dngImage(SkDngImage::NewFromStream(rawStream.release()));
+    std::unique_ptr<SkDngImage> dngImage(SkDngImage::NewFromStream(rawStream.release()));
     if (!dngImage) {
         return nullptr;
     }
@@ -688,13 +688,13 @@
         return kInvalidConversion;
     }
 
-    SkAutoTDelete<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler(
+    std::unique_ptr<SkSwizzler> swizzler(SkSwizzler::CreateSwizzler(
             this->getEncodedInfo(), nullptr, requestedInfo, options));
     SkASSERT(swizzler);
 
     const int width = requestedInfo.width();
     const int height = requestedInfo.height();
-    SkAutoTDelete<dng_image> image(fDngImage->render(width, height));
+    std::unique_ptr<dng_image> image(fDngImage->render(width, height));
     if (!image) {
         return kInvalidInput;
     }
diff --git a/src/codec/SkRawCodec.h b/src/codec/SkRawCodec.h
index 3ca7b9c..75654c7 100644
--- a/src/codec/SkRawCodec.h
+++ b/src/codec/SkRawCodec.h
@@ -53,7 +53,7 @@
      */
     SkRawCodec(SkDngImage* dngImage);
 
-    SkAutoTDelete<SkDngImage> fDngImage;
+    std::unique_ptr<SkDngImage> fDngImage;
 
     typedef SkCodec INHERITED;
 };
diff --git a/src/codec/SkWbmpCodec.cpp b/src/codec/SkWbmpCodec.cpp
index 45296d8..4102bf2 100644
--- a/src/codec/SkWbmpCodec.cpp
+++ b/src/codec/SkWbmpCodec.cpp
@@ -136,7 +136,7 @@
     setup_color_table(info.colorType(), ctable, ctableCount);
 
     // Initialize the swizzler
-    SkAutoTDelete<SkSwizzler> swizzler(this->initializeSwizzler(info, ctable, options));
+    std::unique_ptr<SkSwizzler> swizzler(this->initializeSwizzler(info, ctable, options));
     SkASSERT(swizzler);
 
     // Perform the decode
@@ -160,7 +160,7 @@
 }
 
 SkCodec* SkWbmpCodec::NewFromStream(SkStream* stream) {
-    SkAutoTDelete<SkStream> streamDeleter(stream);
+    std::unique_ptr<SkStream> streamDeleter(stream);
     SkISize size;
     if (!read_header(stream, &size)) {
         return nullptr;
diff --git a/src/codec/SkWbmpCodec.h b/src/codec/SkWbmpCodec.h
index 9f29237..3c8df02 100644
--- a/src/codec/SkWbmpCodec.h
+++ b/src/codec/SkWbmpCodec.h
@@ -36,7 +36,7 @@
                                    const Options& opts);
     SkSampler* getSampler(bool createIfNecessary) override {
         SkASSERT(fSwizzler || !createIfNecessary);
-        return fSwizzler;
+        return fSwizzler.get();
     }
 
     /*
@@ -49,7 +49,7 @@
     const size_t                 fSrcRowBytes;
 
     // Used for scanline decodes:
-    SkAutoTDelete<SkSwizzler>    fSwizzler;
+    std::unique_ptr<SkSwizzler>  fSwizzler;
     SkAutoTUnref<SkColorTable>   fColorTable;
     SkAutoTMalloc<uint8_t>       fSrcBuffer;
 
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index ca42093..09913c7 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -36,7 +36,7 @@
 // bytes again.
 // Returns an SkWebpCodec on success;
 SkCodec* SkWebpCodec::NewFromStream(SkStream* stream) {
-    SkAutoTDelete<SkStream> streamDeleter(stream);
+    std::unique_ptr<SkStream> streamDeleter(stream);
 
     // Webp demux needs a contiguous data buffer.
     sk_sp<SkData> data = nullptr;
diff --git a/src/core/SkBigPicture.h b/src/core/SkBigPicture.h
index c5dfda9..3dde147 100644
--- a/src/core/SkBigPicture.h
+++ b/src/core/SkBigPicture.h
@@ -77,7 +77,7 @@
     mutable SkOnce                        fAnalysisOnce;
     mutable Analysis                      fAnalysis;
     SkAutoTUnref<const SkRecord>          fRecord;
-    SkAutoTDelete<const SnapshotArray>    fDrawablePicts;
+    std::unique_ptr<const SnapshotArray>  fDrawablePicts;
     SkAutoTUnref<const SkBBoxHierarchy>   fBBH;
 };
 
diff --git a/src/core/SkColorTable.cpp b/src/core/SkColorTable.cpp
index 296b31c..9710346 100644
--- a/src/core/SkColorTable.cpp
+++ b/src/core/SkColorTable.cpp
@@ -101,8 +101,8 @@
     }
 
     const size_t allocSize = count * sizeof(SkPMColor);
-    SkAutoTDelete<SkPMColor> colors((SkPMColor*)sk_malloc_throw(allocSize));
-    if (!buffer.readColorArray(colors, count)) {
+    std::unique_ptr<SkPMColor> colors((SkPMColor*)sk_malloc_throw(allocSize));
+    if (!buffer.readColorArray(colors.get(), count)) {
         return nullptr;
     }
 
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 04f1251..a72309a 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -2047,10 +2047,10 @@
     if (typeface) {
         SkDynamicMemoryWStream ostream;
         typeface->serialize(&ostream);
-        SkAutoTDelete<SkStreamAsset> istream(ostream.detachAsStream());
+        std::unique_ptr<SkStreamAsset> istream(ostream.detachAsStream());
 
         SkFontDescriptor descriptor;
-        if (!SkFontDescriptor::Deserialize(istream, &descriptor)) {
+        if (!SkFontDescriptor::Deserialize(istream.get(), &descriptor)) {
             str->append("<dt>FontDescriptor deserialization failed</dt>");
         } else {
             str->append("<dt>Font Family Name:</dt><dd>");
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index ae3b704..039efc8 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -171,9 +171,9 @@
     if (!InternalOnly_StreamIsSKP(stream, &info) || !stream->readBool()) {
         return nullptr;
     }
-    SkAutoTDelete<SkPictureData> data(
+    std::unique_ptr<SkPictureData> data(
             SkPictureData::CreateFromStream(stream, info, factory, typefaces));
-    return Forwardport(info, data, nullptr);
+    return Forwardport(info, data.get(), nullptr);
 }
 
 sk_sp<SkPicture> SkPicture::MakeFromBuffer(SkReadBuffer& buffer) {
@@ -181,8 +181,8 @@
     if (!InternalOnly_BufferIsSKP(&buffer, &info) || !buffer.readBool()) {
         return nullptr;
     }
-    SkAutoTDelete<SkPictureData> data(SkPictureData::CreateFromBuffer(buffer, info));
-    return Forwardport(info, data, &buffer);
+    std::unique_ptr<SkPictureData> data(SkPictureData::CreateFromBuffer(buffer, info));
+    return Forwardport(info, data.get(), &buffer);
 }
 
 SkPictureData* SkPicture::backport() const {
@@ -208,7 +208,7 @@
                           SkPixelSerializer* pixelSerializer,
                           SkRefCntSet* typefaceSet) const {
     SkPictInfo info = this->createHeader();
-    SkAutoTDelete<SkPictureData> data(this->backport());
+    std::unique_ptr<SkPictureData> data(this->backport());
 
     stream->write(&info, sizeof(info));
     if (data) {
@@ -221,7 +221,7 @@
 
 void SkPicture::flatten(SkWriteBuffer& buffer) const {
     SkPictInfo info = this->createHeader();
-    SkAutoTDelete<SkPictureData> data(this->backport());
+    std::unique_ptr<SkPictureData> data(this->backport());
 
     buffer.writeByteArray(&info.fMagic, sizeof(info.fMagic));
     buffer.writeUInt(info.getVersion());
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index cc529e3..5f9cb71 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -577,7 +577,7 @@
                                                const SkPictInfo& info,
                                                SkImageDeserializer* factory,
                                                SkTypefacePlayback* topLevelTFPlayback) {
-    SkAutoTDelete<SkPictureData> data(new SkPictureData(info));
+    std::unique_ptr<SkPictureData> data(new SkPictureData(info));
     if (!topLevelTFPlayback) {
         topLevelTFPlayback = &data->fTFPlayback;
     }
@@ -590,7 +590,7 @@
 
 SkPictureData* SkPictureData::CreateFromBuffer(SkReadBuffer& buffer,
                                                const SkPictInfo& info) {
-    SkAutoTDelete<SkPictureData> data(new SkPictureData(info));
+    std::unique_ptr<SkPictureData> data(new SkPictureData(info));
     buffer.setVersion(info.getVersion());
 
     if (!data->parseBuffer(buffer)) {
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 51e1c98..0b3dd0e 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -86,7 +86,7 @@
     AutoResetOpID aroi(this);
     SkASSERT(0 == fCurOffset);
 
-    SkAutoTDelete<SkReadBuffer> reader;
+    std::unique_ptr<SkReadBuffer> reader;
     if (buffer) {
         reader.reset(buffer->clone(fPictureData->opData()->bytes(),
                                    fPictureData->opData()->size()));
@@ -107,12 +107,12 @@
 
         fCurOffset = reader->offset();
         uint32_t size;
-        DrawType op = ReadOpAndSize(reader, &size);
+        DrawType op = ReadOpAndSize(reader.get(), &size);
         if (!reader->validate(op > UNUSED && op <= LAST_DRAWTYPE_ENUM)) {
             return;
         }
 
-        this->handleOp(reader, op, size, canvas, initialMatrix);
+        this->handleOp(reader.get(), op, size, canvas, initialMatrix);
     }
 
     // need to propagate invalid state to the parent reader
diff --git a/src/core/SkRecordedDrawable.cpp b/src/core/SkRecordedDrawable.cpp
index 62a9339..3e31166 100644
--- a/src/core/SkRecordedDrawable.cpp
+++ b/src/core/SkRecordedDrawable.cpp
@@ -81,13 +81,13 @@
     info.setVersion(buffer.getVersion());
     info.fCullRect = bounds;
     info.fFlags = 0;    // ???
-    SkAutoTDelete<SkPictureData> pictureData(SkPictureData::CreateFromBuffer(buffer, info));
+    std::unique_ptr<SkPictureData> pictureData(SkPictureData::CreateFromBuffer(buffer, info));
     if (!pictureData) {
         return nullptr;
     }
 
     // Create a drawable.
-    SkPicturePlayback playback(pictureData);
+    SkPicturePlayback playback(pictureData.get());
     SkPictureRecorder recorder;
     playback.draw(recorder.beginRecording(bounds), nullptr, &buffer);
     return recorder.finishRecordingAsDrawable();
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index fc2ba12..41d1a86 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -233,7 +233,7 @@
     }
 
     if (!fName.isEmpty()) {
-        SkAutoTDelete<SkFILEStream> that(new SkFILEStream(fName.c_str()));
+        std::unique_ptr<SkFILEStream> that(new SkFILEStream(fName.c_str()));
         if (sk_fidentical(that->fFILE, this->fFILE)) {
             return that.release();
         }
@@ -259,7 +259,7 @@
 }
 
 SkStreamAsset* SkFILEStream::fork() const {
-    SkAutoTDelete<SkStreamAsset> that(this->duplicate());
+    std::unique_ptr<SkStreamAsset> that(this->duplicate());
     that->seek(this->getPosition());
     return that.release();
 }
@@ -381,7 +381,7 @@
 }
 
 SkMemoryStream* SkMemoryStream::fork() const {
-    SkAutoTDelete<SkMemoryStream> that(this->duplicate());
+    std::unique_ptr<SkMemoryStream> that(this->duplicate());
     that->seek(fOffset);
     return that.release();
 }
@@ -767,7 +767,7 @@
     }
 
     SkBlockMemoryStream* fork() const override {
-        SkAutoTDelete<SkBlockMemoryStream> that(this->duplicate());
+        std::unique_ptr<SkBlockMemoryStream> that(this->duplicate());
         that->fCurrent = this->fCurrent;
         that->fOffset = this->fOffset;
         that->fCurrentOffset = this->fCurrentOffset;
diff --git a/src/fonts/SkFontMgr_indirect.cpp b/src/fonts/SkFontMgr_indirect.cpp
index 070c0aa..41447ac 100644
--- a/src/fonts/SkFontMgr_indirect.cpp
+++ b/src/fonts/SkFontMgr_indirect.cpp
@@ -123,14 +123,14 @@
 
     // No exact match, but did find a data match.
     if (dataTypeface.get() != nullptr) {
-        SkAutoTDelete<SkStreamAsset> stream(dataTypeface->openStream(nullptr));
+        std::unique_ptr<SkStreamAsset> stream(dataTypeface->openStream(nullptr));
         if (stream.get() != nullptr) {
             return fImpl->createFromStream(stream.release(), dataTypefaceIndex);
         }
     }
 
     // No data match, request data and add entry.
-    SkAutoTDelete<SkStreamAsset> stream(fProxy->getData(id.fDataId));
+    std::unique_ptr<SkStreamAsset> stream(fProxy->getData(id.fDataId));
     if (stream.get() == nullptr) {
         return nullptr;
     }
diff --git a/src/gpu/GrDrawingManager.h b/src/gpu/GrDrawingManager.h
index 3945fe5..fa275d2 100644
--- a/src/gpu/GrDrawingManager.h
+++ b/src/gpu/GrDrawingManager.h
@@ -103,7 +103,7 @@
     bool                              fAbandoned;
     SkTDArray<GrOpList*>              fOpLists;
 
-    SkAutoTDelete<GrAtlasTextContext> fAtlasTextContext;
+    std::unique_ptr<GrAtlasTextContext> fAtlasTextContext;
 
     GrPathRendererChain*              fPathRendererChain;
     GrSoftwarePathRenderer*           fSoftwarePathRenderer;
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 475950a..9a74560 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -513,10 +513,10 @@
     // Handles cases where a surface will be updated without a call to flushRenderTarget
     void didWriteToSurface(GrSurface* surface, const SkIRect* bounds, uint32_t mipLevels = 1) const;
 
-    Stats                                   fStats;
-    SkAutoTDelete<GrPathRendering>          fPathRendering;
+    Stats                            fStats;
+    std::unique_ptr<GrPathRendering> fPathRendering;
     // Subclass must initialize this in its constructor.
-    SkAutoTUnref<const GrCaps>    fCaps;
+    SkAutoTUnref<const GrCaps>       fCaps;
 
     typedef SkTArray<SkPoint, true> SamplePattern;
 
diff --git a/src/gpu/GrPathRenderingRenderTargetContext.h b/src/gpu/GrPathRenderingRenderTargetContext.h
index a4353e1..1ad3a0b 100644
--- a/src/gpu/GrPathRenderingRenderTargetContext.h
+++ b/src/gpu/GrPathRenderingRenderTargetContext.h
@@ -34,7 +34,7 @@
         : INHERITED(ctx, mgr, std::move(rtp), std::move(colorSpace), surfaceProps, at, so) {}
 
 private:
-    SkAutoTDelete<GrStencilAndCoverTextContext> fStencilAndCoverTextContext;
+    std::unique_ptr<GrStencilAndCoverTextContext> fStencilAndCoverTextContext;
 
     friend class GrDrawingManager; // for ctor
 
diff --git a/src/gpu/GrRenderTargetOpList.cpp b/src/gpu/GrRenderTargetOpList.cpp
index 37c469a..b4e6870 100644
--- a/src/gpu/GrRenderTargetOpList.cpp
+++ b/src/gpu/GrRenderTargetOpList.cpp
@@ -185,7 +185,7 @@
     // Draw all the generated geometry.
     SkRandom random;
     GrRenderTarget* currentRT = nullptr;
-    SkAutoTDelete<GrGpuCommandBuffer> commandBuffer;
+    std::unique_ptr<GrGpuCommandBuffer> commandBuffer;
     for (int i = 0; i < fRecordedBatches.count(); ++i) {
         if (!fRecordedBatches[i].fBatch) {
             continue;
@@ -205,7 +205,7 @@
                                                               kBasicLoadStoreInfo,   // Color
                                                               kBasicLoadStoreInfo)); // Stencil
             }
-            flushState->setCommandBuffer(commandBuffer);
+            flushState->setCommandBuffer(commandBuffer.get());
         }
         if (fDrawBatchBounds) {
             const SkRect& bounds = fRecordedBatches[i].fClippedBounds;
diff --git a/src/gpu/GrRenderTargetOpList.h b/src/gpu/GrRenderTargetOpList.h
index e4b2bf6..62f86d1 100644
--- a/src/gpu/GrRenderTargetOpList.h
+++ b/src/gpu/GrRenderTargetOpList.h
@@ -125,7 +125,7 @@
 
     gr_instanced::InstancedRendering* instancedRendering() const {
         SkASSERT(fInstancedRendering);
-        return fInstancedRendering;
+        return fInstancedRendering.get();
     }
 
     SkDEBUGCODE(void dump() const override;)
@@ -167,7 +167,7 @@
     int                                             fMaxBatchLookback;
     int                                             fMaxBatchLookahead;
 
-    SkAutoTDelete<gr_instanced::InstancedRendering> fInstancedRendering;
+    std::unique_ptr<gr_instanced::InstancedRendering> fInstancedRendering;
 
     int32_t                                         fLastClipStackGenID;
     SkIRect                                         fLastClipStackRect;
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index d0a35b5..679ba8c 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -378,7 +378,7 @@
         sk_throw();
     }
 
-    SkAutoTDelete<SkMipMap> mipmaps(SkMipMap::Build(pixmap, gammaTreatment, nullptr));
+    std::unique_ptr<SkMipMap> mipmaps(SkMipMap::Build(pixmap, gammaTreatment, nullptr));
     if (!mipmaps) {
         return nullptr;
     }
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index 34037a2..157f404 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -136,8 +136,8 @@
     GrGLuint fProgramID;
 
     // the installed effects
-    SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor;
-    SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor;
+    std::unique_ptr<GrGLSLPrimitiveProcessor> fGeometryProcessor;
+    std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
     GrGLSLFragProcs fFragmentProcessors;
 
     GrProgramDesc fDesc;
diff --git a/src/gpu/instanced/InstanceProcessor.cpp b/src/gpu/instanced/InstanceProcessor.cpp
index 475b020..bcf4864 100644
--- a/src/gpu/instanced/InstanceProcessor.cpp
+++ b/src/gpu/instanced/InstanceProcessor.cpp
@@ -242,7 +242,7 @@
                        inputs.attr(Attrib::kInstanceInfo));
     }
 
-    SkAutoTDelete<Backend> backend(Backend::Create(pipeline, ip.batchInfo(), inputs));
+    std::unique_ptr<Backend> backend(Backend::Create(pipeline, ip.batchInfo(), inputs));
     backend->init(varyingHandler, v);
 
     int usedShapeDefinitions = 0;
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index 5aaf210..c8e2008 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -490,7 +490,7 @@
         // though the distance field text and the coloremoji may share the same run, they
         // will have different descriptors.  If fOverrideDescriptor is non-nullptr, then it
         // will be used in place of the run's descriptor to regen texture coords
-        SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties
+        std::unique_ptr<SkAutoDescriptor> fOverrideDescriptor; // df properties
         bool fInitialized;
         bool fDrawAsPaths;
     };
diff --git a/src/gpu/text/GrStencilAndCoverTextContext.cpp b/src/gpu/text/GrStencilAndCoverTextContext.cpp
index 1d46fc6..b3a7eef 100644
--- a/src/gpu/text/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/text/GrStencilAndCoverTextContext.cpp
@@ -351,7 +351,7 @@
 
     void flush();
 
-    SkAutoTDelete<SkTextBlobBuilder>   fBuilder;
+    std::unique_ptr<SkTextBlobBuilder> fBuilder;
     SkPaint                            fFont;
     int                                fBuffIdx;
     int                                fCount;
diff --git a/src/gpu/vk/GrVkExtensions.h b/src/gpu/vk/GrVkExtensions.h
index 6c395fd..2decd15 100644
--- a/src/gpu/vk/GrVkExtensions.h
+++ b/src/gpu/vk/GrVkExtensions.h
@@ -37,10 +37,10 @@
     void print(const char* sep = "\n") const;
 
 private:
-    SkAutoTDelete<SkTArray<SkString> >  fInstanceExtensionStrings;
-    SkAutoTDelete<SkTArray<SkString> >  fDeviceExtensionStrings;
-    SkAutoTDelete<SkTArray<SkString> >  fInstanceLayerStrings;
-    SkAutoTDelete<SkTArray<SkString> >  fDeviceLayerStrings;
+    std::unique_ptr<SkTArray<SkString>>  fInstanceExtensionStrings;
+    std::unique_ptr<SkTArray<SkString>>  fDeviceExtensionStrings;
+    std::unique_ptr<SkTArray<SkString>>  fInstanceLayerStrings;
+    std::unique_ptr<SkTArray<SkString>>  fDeviceLayerStrings;
 };
 
 #endif
diff --git a/src/gpu/vk/GrVkGpu.h b/src/gpu/vk/GrVkGpu.h
index 6f03803..50f7471 100644
--- a/src/gpu/vk/GrVkGpu.h
+++ b/src/gpu/vk/GrVkGpu.h
@@ -168,7 +168,7 @@
     };
     static const int kHeapCount = kLastHeap + 1;
 
-    GrVkHeap* getHeap(Heap heap) const { return fHeaps[heap]; }
+    GrVkHeap* getHeap(Heap heap) const { return fHeaps[heap].get(); }
 
 private:
     GrVkGpu(GrContext* context, const GrContextOptions& options,
@@ -269,7 +269,7 @@
     GrVkPrimaryCommandBuffer*              fCurrentCmdBuffer;
     VkPhysicalDeviceMemoryProperties       fPhysDevMemProps;
 
-    SkAutoTDelete<GrVkHeap>                fHeaps[kHeapCount];
+    std::unique_ptr<GrVkHeap>              fHeaps[kHeapCount];
 
     GrVkCopyManager                        fCopyManager;
 
diff --git a/src/gpu/vk/GrVkMemory.cpp b/src/gpu/vk/GrVkMemory.cpp
index 2853c89..2764102 100644
--- a/src/gpu/vk/GrVkMemory.cpp
+++ b/src/gpu/vk/GrVkMemory.cpp
@@ -561,7 +561,7 @@
     }
 
     // need to allocate a new subheap
-    SkAutoTDelete<GrVkSubHeap>& subHeap = fSubHeaps.push_back();
+    std::unique_ptr<GrVkSubHeap>& subHeap = fSubHeaps.push_back();
     subHeap.reset(new GrVkSubHeap(fGpu, memoryTypeIndex, heapIndex, fSubHeapSize, alignment));
     // try to recover from failed allocation by only allocating what we need
     if (subHeap->size() == 0) {
@@ -609,7 +609,7 @@
     }
 
     // need to allocate a new subheap
-    SkAutoTDelete<GrVkSubHeap>& subHeap = fSubHeaps.push_back();
+    std::unique_ptr<GrVkSubHeap>& subHeap = fSubHeaps.push_back();
     subHeap.reset(new GrVkSubHeap(fGpu, memoryTypeIndex, heapIndex, alignedSize, alignment));
     fAllocSize += alignedSize;
     if (subHeap->alloc(size, alloc)) {
diff --git a/src/gpu/vk/GrVkMemory.h b/src/gpu/vk/GrVkMemory.h
index a1d4392..77267ab 100644
--- a/src/gpu/vk/GrVkMemory.h
+++ b/src/gpu/vk/GrVkMemory.h
@@ -162,6 +162,6 @@
     VkDeviceSize           fAllocSize;
     VkDeviceSize           fUsedSize;
     AllocFunc              fAllocFunc;
-    SkTArray<SkAutoTDelete<GrVkSubHeap>> fSubHeaps;
+    SkTArray<std::unique_ptr<GrVkSubHeap>> fSubHeaps;
 };
 #endif
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index abb95f6..ba4f95f 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -226,8 +226,11 @@
     }
 
     if (fVertexUniformBuffer.get() || fFragmentUniformBuffer.get()) {
-        if (fDataManager.uploadUniformBuffers(gpu, fVertexUniformBuffer, fFragmentUniformBuffer) ||
-            !fUniformDescriptorSet) {
+        if (fDataManager.uploadUniformBuffers(gpu,
+                                              fVertexUniformBuffer.get(),
+                                              fFragmentUniformBuffer.get())
+            || !fUniformDescriptorSet)
+        {
             if (fUniformDescriptorSet) {
                 fUniformDescriptorSet->recycle(gpu);
             }
diff --git a/src/gpu/vk/GrVkPipelineState.h b/src/gpu/vk/GrVkPipelineState.h
index ba8a21f..63277c0 100644
--- a/src/gpu/vk/GrVkPipelineState.h
+++ b/src/gpu/vk/GrVkPipelineState.h
@@ -208,8 +208,8 @@
     int fStartDS;
     int fDSCount;
 
-    SkAutoTDelete<GrVkUniformBuffer> fVertexUniformBuffer;
-    SkAutoTDelete<GrVkUniformBuffer> fFragmentUniformBuffer;
+    std::unique_ptr<GrVkUniformBuffer> fVertexUniformBuffer;
+    std::unique_ptr<GrVkUniformBuffer> fFragmentUniformBuffer;
 
     // GrVkResources used for sampling textures
     SkTDArray<GrVkSampler*> fSamplers;
@@ -221,8 +221,8 @@
     BuiltinUniformHandles fBuiltinUniformHandles;
 
     // Processors in the GrVkPipelineState
-    SkAutoTDelete<GrGLSLPrimitiveProcessor> fGeometryProcessor;
-    SkAutoTDelete<GrGLSLXferProcessor> fXferProcessor;
+    std::unique_ptr<GrGLSLPrimitiveProcessor> fGeometryProcessor;
+    std::unique_ptr<GrGLSLXferProcessor> fXferProcessor;
     GrGLSLFragProcs fFragmentProcessors;
 
     Desc fDesc;
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index d80b187..e993002 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -616,7 +616,7 @@
         static_assert(std::is_standard_layout<MipMapLevelData>::value,
                       "offsetof, which we use below, requires the type have a standard layout");
 
-        SkAutoTDelete<SkMipMap> mipmaps(SkMipMap::Build(pixmap, gammaTreatment, nullptr));
+        std::unique_ptr<SkMipMap> mipmaps(SkMipMap::Build(pixmap, gammaTreatment, nullptr));
         // SkMipMap holds only the mipmap levels it generates.
         // A programmer can use the data they provided to SkMipMap::Build as level 0.
         // So the SkMipMap provides levels 1-x but it stores them in its own
diff --git a/src/images/SkImageEncoder.cpp b/src/images/SkImageEncoder.cpp
index 023885f..787ff8e 100644
--- a/src/images/SkImageEncoder.cpp
+++ b/src/images/SkImageEncoder.cpp
@@ -38,18 +38,18 @@
 
 bool SkImageEncoder::EncodeFile(const char file[], const SkBitmap& bm, Type t,
                                 int quality) {
-    SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
+    std::unique_ptr<SkImageEncoder> enc(SkImageEncoder::Create(t));
     return enc.get() && enc.get()->encodeFile(file, bm, quality);
 }
 
 bool SkImageEncoder::EncodeStream(SkWStream* stream, const SkBitmap& bm, Type t,
                                   int quality) {
-    SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
+    std::unique_ptr<SkImageEncoder> enc(SkImageEncoder::Create(t));
     return enc.get() && enc.get()->encodeStream(stream, bm, quality);
 }
 
 SkData* SkImageEncoder::EncodeData(const SkBitmap& bm, Type t, int quality) {
-    SkAutoTDelete<SkImageEncoder> enc(SkImageEncoder::Create(t));
+    std::unique_ptr<SkImageEncoder> enc(SkImageEncoder::Create(t));
     return enc.get() ? enc.get()->encodeData(bm, quality) : nullptr;
 }
 
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 19eff6f..83fbd1d 100644
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -2454,8 +2454,8 @@
     }
 
     SkTypeface* onCreateFromStream(SkStreamAsset* bareStream, int ttcIndex) const override {
-        SkAutoTDelete<SkStreamAsset> stream(bareStream);
-        return create_from_stream(stream);
+        std::unique_ptr<SkStreamAsset> stream(bareStream);
+        return create_from_stream(stream.get());
     }
 
     SkTypeface* onCreateFromData(SkData* data, int ttcIndex) const override {
diff --git a/src/ports/SkFontMgr_FontConfigInterface.cpp b/src/ports/SkFontMgr_FontConfigInterface.cpp
index d4c7569..404ae98 100644
--- a/src/ports/SkFontMgr_FontConfigInterface.cpp
+++ b/src/ports/SkFontMgr_FontConfigInterface.cpp
@@ -113,7 +113,7 @@
         const char* getCategory() const override { return "request_cache"; }
         SkDiscardableMemory* diagnostic_only_getDiscardable() const override { return nullptr; }
 
-        SkAutoTDelete<Request> fRequest;
+        std::unique_ptr<Request> fRequest;
         SkAutoTUnref<SkTypeface> fFace;
     };
 
@@ -267,8 +267,8 @@
 
         // Check if this request is already in the request cache.
         using Request = SkFontRequestCache::Request;
-        SkAutoTDelete<Request> request(Request::Create(requestedFamilyName, requestedStyle));
-        SkTypeface* face = fCache.findAndRef(request);
+        std::unique_ptr<Request> request(Request::Create(requestedFamilyName, requestedStyle));
+        SkTypeface* face = fCache.findAndRef(request.get());
         if (face) {
             return face;
         }
diff --git a/src/ports/SkFontMgr_android_parser.cpp b/src/ports/SkFontMgr_android_parser.cpp
index 306c6ff..e5fdcd0 100644
--- a/src/ports/SkFontMgr_android_parser.cpp
+++ b/src/ports/SkFontMgr_android_parser.cpp
@@ -100,18 +100,18 @@
         , fHandler(&topLevelHandler, 1)
     { }
 
-    XML_Parser fParser;                       // The expat parser doing the work, owned by caller
-    SkTDArray<FontFamily*>& fFamilies;        // The array to append families, owned by caller
-    SkAutoTDelete<FontFamily> fCurrentFamily; // The family being created, owned by this
-    FontFileInfo* fCurrentFontInfo;           // The fontInfo being created, owned by fCurrentFamily
-    int fVersion;                             // The version of the file parsed.
-    const SkString& fBasePath;                // The current base path.
-    const bool fIsFallback;                   // Indicates the file being parsed is a fallback file
-    const char* fFilename;                    // The name of the file currently being parsed.
+    XML_Parser fParser;                         // The expat parser doing the work, owned by caller
+    SkTDArray<FontFamily*>& fFamilies;          // The array to append families, owned by caller
+    std::unique_ptr<FontFamily> fCurrentFamily; // The family being created, owned by this
+    FontFileInfo* fCurrentFontInfo;             // The info being created, owned by fCurrentFamily
+    int fVersion;                               // The version of the file parsed.
+    const SkString& fBasePath;                  // The current base path.
+    const bool fIsFallback;                     // The file being parsed is a fallback file
+    const char* fFilename;                      // The name of the file currently being parsed.
 
-    int fDepth;                               // The current element depth of the parse.
-    int fSkip;                                // The depth to stop skipping, 0 if not skipping.
-    SkTDArray<const TagHandler*> fHandler;    // The stack of current tag handlers.
+    int fDepth;                                 // The current element depth of the parse.
+    int fSkip;                                  // The depth to stop skipping, 0 if not skipping.
+    SkTDArray<const TagHandler*> fHandler;      // The stack of current tag handlers.
 };
 
 static bool memeq(const char* s1, const char* s2, size_t n1, size_t n2) {
diff --git a/src/ports/SkFontMgr_win_dw.cpp b/src/ports/SkFontMgr_win_dw.cpp
index 33ae767..cd0b665 100644
--- a/src/ports/SkFontMgr_win_dw.cpp
+++ b/src/ports/SkFontMgr_win_dw.cpp
@@ -51,7 +51,7 @@
         return S_OK;
     }
 
-    SkAutoTDelete<SkStreamAsset> fStream;
+    std::unique_ptr<SkStreamAsset> fStream;
 
 private:
     StreamFontFileLoader(SkStreamAsset* stream) : fStream(stream), fRefCount(1) { }
diff --git a/src/ports/SkTypeface_win_dw.cpp b/src/ports/SkTypeface_win_dw.cpp
index dc87218..e955665 100644
--- a/src/ports/SkTypeface_win_dw.cpp
+++ b/src/ports/SkTypeface_win_dw.cpp
@@ -193,8 +193,8 @@
     }
 
     int ttcIndex;
-    SkAutoTDelete<SkStream> stream(this->openStream(&ttcIndex));
-    return stream.get() ? SkFontStream::GetTableTags(stream, ttcIndex, tags) : 0;
+    std::unique_ptr<SkStream> stream(this->openStream(&ttcIndex));
+    return stream.get() ? SkFontStream::GetTableTags(stream.get(), ttcIndex, tags) : 0;
 }
 
 size_t DWriteFontTypeface::onGetTableData(SkFontTableTag tag, size_t offset,
diff --git a/src/svg/SkSVGDevice.cpp b/src/svg/SkSVGDevice.cpp
index b07e0aa..4496c0a 100644
--- a/src/svg/SkSVGDevice.cpp
+++ b/src/svg/SkSVGDevice.cpp
@@ -342,7 +342,7 @@
 
     SkXMLWriter*               fWriter;
     ResourceBucket*            fResourceBucket;
-    SkAutoTDelete<AutoElement> fClipGroup;
+    std::unique_ptr<AutoElement> fClipGroup;
 };
 
 void SkSVGDevice::AutoElement::addPaint(const SkPaint& paint, const Resources& resources) {
@@ -592,7 +592,7 @@
 }
 
 void SkSVGDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
-    AutoElement rect("rect", fWriter, fResourceBucket, draw, paint);
+    AutoElement rect("rect", fWriter, fResourceBucket.get(), draw, paint);
     rect.addRectAttributes(SkRect::MakeWH(SkIntToScalar(this->width()),
                                           SkIntToScalar(this->height())));
 }
@@ -612,7 +612,7 @@
                 path.rewind();
                 path.moveTo(pts[i]);
                 path.lineTo(pts[i+1]);
-                AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
+                AutoElement elem("path", fWriter, fResourceBucket.get(), draw, paint);
                 elem.addPathAttributes(path);
             }
             break;
@@ -620,7 +620,7 @@
             if (count > 1) {
                 path.addPoly(pts, SkToInt(count), false);
                 path.moveTo(pts[0]);
-                AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
+                AutoElement elem("path", fWriter, fResourceBucket.get(), draw, paint);
                 elem.addPathAttributes(path);
             }
             break;
@@ -628,12 +628,12 @@
 }
 
 void SkSVGDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& paint) {
-    AutoElement rect("rect", fWriter, fResourceBucket, draw, paint);
+    AutoElement rect("rect", fWriter, fResourceBucket.get(), draw, paint);
     rect.addRectAttributes(r);
 }
 
 void SkSVGDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) {
-    AutoElement ellipse("ellipse", fWriter, fResourceBucket, draw, paint);
+    AutoElement ellipse("ellipse", fWriter, fResourceBucket.get(), draw, paint);
     ellipse.addAttribute("cx", oval.centerX());
     ellipse.addAttribute("cy", oval.centerY());
     ellipse.addAttribute("rx", oval.width() / 2);
@@ -644,13 +644,13 @@
     SkPath path;
     path.addRRect(rr);
 
-    AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
+    AutoElement elem("path", fWriter, fResourceBucket.get(), draw, paint);
     elem.addPathAttributes(path);
 }
 
 void SkSVGDevice::drawPath(const SkDraw& draw, const SkPath& path, const SkPaint& paint,
                            const SkMatrix* prePathMatrix, bool pathIsMutable) {
-    AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
+    AutoElement elem("path", fWriter, fResourceBucket.get(), draw, paint);
     elem.addPathAttributes(path);
 
     // TODO: inverse fill types?
@@ -687,7 +687,7 @@
     }
 
     {
-        AutoElement imageUse("use", fWriter, fResourceBucket, draw, paint);
+        AutoElement imageUse("use", fWriter, fResourceBucket.get(), draw, paint);
         imageUse.addAttribute("xlink:href", SkStringPrintf("#%s", imageID.c_str()));
     }
 }
@@ -737,7 +737,7 @@
 
 void SkSVGDevice::drawText(const SkDraw& draw, const void* text, size_t len,
                            SkScalar x, SkScalar y, const SkPaint& paint) {
-    AutoElement elem("text", fWriter, fResourceBucket, draw, paint);
+    AutoElement elem("text", fWriter, fResourceBucket.get(), draw, paint);
     elem.addTextAttributes(paint);
 
     SVGTextBuilder builder(text, len, paint, SkPoint::Make(x, y), 0);
@@ -751,7 +751,7 @@
                               const SkPaint& paint) {
     SkASSERT(scalarsPerPos == 1 || scalarsPerPos == 2);
 
-    AutoElement elem("text", fWriter, fResourceBucket, draw, paint);
+    AutoElement elem("text", fWriter, fResourceBucket.get(), draw, paint);
     elem.addTextAttributes(paint);
 
     SVGTextBuilder builder(text, len, paint, offset, scalarsPerPos, pos);
diff --git a/src/svg/SkSVGDevice.h b/src/svg/SkSVGDevice.h
index d0b9a24..ccd18c4 100644
--- a/src/svg/SkSVGDevice.h
+++ b/src/svg/SkSVGDevice.h
@@ -63,9 +63,9 @@
     class AutoElement;
     class ResourceBucket;
 
-    SkXMLWriter*                  fWriter;
-    SkAutoTDelete<AutoElement>    fRootElement;
-    SkAutoTDelete<ResourceBucket> fResourceBucket;
+    SkXMLWriter*                    fWriter;
+    std::unique_ptr<AutoElement>    fRootElement;
+    std::unique_ptr<ResourceBucket> fResourceBucket;
 
     typedef SkBaseDevice INHERITED;
 };
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp
index 60484a4..3426126 100644
--- a/src/utils/SkCanvasStateUtils.cpp
+++ b/src/utils/SkCanvasStateUtils.cpp
@@ -204,7 +204,7 @@
         return nullptr;
     }
 
-    SkAutoTDelete<SkCanvasState_v1> canvasState(new SkCanvasState_v1(canvas));
+    std::unique_ptr<SkCanvasState_v1> canvasState(new SkCanvasState_v1(canvas));
 
     // decompose the total matrix and clip
     setup_MC_state(&canvasState->mcState, canvas->getTotalMatrix(),
diff --git a/src/utils/SkFrontBufferedStream.cpp b/src/utils/SkFrontBufferedStream.cpp
index 2dfb8ab..42b86f0 100644
--- a/src/utils/SkFrontBufferedStream.cpp
+++ b/src/utils/SkFrontBufferedStream.cpp
@@ -29,19 +29,19 @@
     SkStreamRewindable* duplicate() const override { return nullptr; }
 
 private:
-    SkAutoTDelete<SkStream> fStream;
-    const bool              fHasLength;
-    const size_t            fLength;
+    std::unique_ptr<SkStream> fStream;
+    const bool                fHasLength;
+    const size_t              fLength;
     // Current offset into the stream. Always >= 0.
-    size_t                  fOffset;
+    size_t                    fOffset;
     // Amount that has been buffered by calls to read. Will always be less than
     // fBufferSize.
-    size_t                  fBufferedSoFar;
+    size_t                    fBufferedSoFar;
     // Total size of the buffer.
-    const size_t            fBufferSize;
+    const size_t              fBufferSize;
     // FIXME: SkAutoTMalloc throws on failure. Instead, Create should return a
     // nullptr stream.
-    SkAutoTMalloc<char>     fBuffer;
+    SkAutoTMalloc<char>       fBuffer;
 
     // Read up to size bytes from already buffered data, and copy to
     // dst, if non-nullptr. Updates fOffset. Assumes that fOffset is less
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index 6c73441..2bb7d0f 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -105,7 +105,7 @@
 }
 
 SkDWriteFontFileStream* SkDWriteFontFileStream::fork() const {
-    SkAutoTDelete<SkDWriteFontFileStream> that(this->duplicate());
+    std::unique_ptr<SkDWriteFontFileStream> that(this->duplicate());
     that->seek(fPos);
     return that.release();
 }
diff --git a/src/utils/win/SkDWriteFontFileStream.h b/src/utils/win/SkDWriteFontFileStream.h
index e78b621..25322c5 100644
--- a/src/utils/win/SkDWriteFontFileStream.h
+++ b/src/utils/win/SkDWriteFontFileStream.h
@@ -73,7 +73,7 @@
     virtual ~SkDWriteFontFileStreamWrapper() { }
 
     ULONG fRefCount;
-    SkAutoTDelete<SkStreamAsset> fStream;
+    std::unique_ptr<SkStreamAsset> fStream;
     SkMutex fStreamMutex;
 };
 #endif
diff --git a/src/views/SkEvent.cpp b/src/views/SkEvent.cpp
index 7b658c8..57e165f 100644
--- a/src/views/SkEvent.cpp
+++ b/src/views/SkEvent.cpp
@@ -415,9 +415,8 @@
 #include "SkEventSink.h"
 
 bool SkEvent::ProcessEvent() {
-    SkEvent*                evt = SkEvent::Dequeue();
-    SkAutoTDelete<SkEvent>  autoDelete(evt);
-    bool                    again = false;
+    std::unique_ptr<SkEvent> evt(SkEvent::Dequeue());
+    bool                     again = false;
 
     EVENT_LOGN("ProcessEvent", (int32_t)evt);
 
diff --git a/src/xps/SkDocument_XPS.cpp b/src/xps/SkDocument_XPS.cpp
index 4a977ae..cb4938b 100644
--- a/src/xps/SkDocument_XPS.cpp
+++ b/src/xps/SkDocument_XPS.cpp
@@ -72,7 +72,7 @@
 static void delete_wstream(SkWStream* stream, bool aborted) { delete stream; }
 
 sk_sp<SkDocument> SkDocument::MakeXPS(const char path[], SkScalar dpi) {
-    SkAutoTDelete<SkFILEWStream> stream(new SkFILEWStream(path));
+    std::unique_ptr<SkFILEWStream> stream(new SkFILEWStream(path));
     if (!stream->isValid()) {
         return nullptr;
     }
diff --git a/src/xps/SkXPSDevice.cpp b/src/xps/SkXPSDevice.cpp
index 7eb1587..07dcd45 100644
--- a/src/xps/SkXPSDevice.cpp
+++ b/src/xps/SkXPSDevice.cpp
@@ -428,7 +428,7 @@
         fontPackageBuffer.realloc(bytesWritten);
     }
 
-    SkAutoTDelete<SkMemoryStream> newStream(new SkMemoryStream());
+    std::unique_ptr<SkMemoryStream> newStream(new SkMemoryStream());
     newStream->setMemoryOwned(fontPackageBuffer.release(), bytesWritten + extra);
 
     SkTScopedComPtr<IStream> newIStream;