std::move(SkTDArray)

Since we don't support MSVC2013 anymore, we can be more
succinct when defining move constructors of compound types.

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

Review-Url: https://codereview.chromium.org/2227673002
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h
index 8af54bb..d6ef3a3 100644
--- a/include/private/SkTDArray.h
+++ b/include/private/SkTDArray.h
@@ -14,10 +14,7 @@
 
 template <typename T> class SkTDArray {
 public:
-    SkTDArray() {
-        fReserve = fCount = 0;
-        fArray = NULL;
-    }
+    SkTDArray() : fArray(nullptr), fReserve(0), fCount(0) {}
     SkTDArray(const T src[], int count) {
         SkASSERT(src || count == 0);
 
@@ -29,12 +26,13 @@
             fReserve = fCount = count;
         }
     }
-    SkTDArray(const SkTDArray<T>& src) {
-        fReserve = fCount = 0;
-        fArray = NULL;
+    SkTDArray(const SkTDArray<T>& src) : fArray(nullptr), fReserve(0), fCount(0) {
         SkTDArray<T> tmp(src.fArray, src.fCount);
         this->swap(tmp);
     }
+    SkTDArray(SkTDArray<T>&& src) : fArray(nullptr), fReserve(0), fCount(0) {
+        this->swap(src);
+    }
     ~SkTDArray() {
         sk_free(fArray);
     }
@@ -51,6 +49,13 @@
         }
         return *this;
     }
+    SkTDArray<T>& operator=(SkTDArray<T>&& src) {
+        if (this != &src) {
+            this->swap(src);
+            src.reset();
+        }
+        return *this;
+    }
 
     friend bool operator==(const SkTDArray<T>& a, const SkTDArray<T>& b) {
         return  a.fCount == b.fCount &&
diff --git a/src/core/SkAdvancedTypefaceMetrics.h b/src/core/SkAdvancedTypefaceMetrics.h
index 026aec2..6dc1162 100644
--- a/src/core/SkAdvancedTypefaceMetrics.h
+++ b/src/core/SkAdvancedTypefaceMetrics.h
@@ -120,19 +120,8 @@
         uint16_t fEndId;
         SkTDArray<Data> fAdvance;
         AdvanceMetric(uint16_t startId) : fStartId(startId) {}
-        AdvanceMetric(AdvanceMetric&& other)
-            : fType(other.fType)
-            , fStartId(other.fStartId)
-            , fEndId(other.fEndId) {
-            fAdvance.swap(other.fAdvance);
-        }
-        AdvanceMetric& operator=(AdvanceMetric&& other) {
-            fType = other.fType;
-            fStartId = other.fStartId;
-            fEndId = other.fEndId;
-            fAdvance.swap(other.fAdvance);
-            return *this;
-        }
+        AdvanceMetric(AdvanceMetric&& other) = default;
+        AdvanceMetric& operator=(AdvanceMetric&& other) = default;
         AdvanceMetric(const AdvanceMetric&) = delete;
         AdvanceMetric& operator=(const AdvanceMetric&) = delete;
     };
diff --git a/src/pdf/SkPDFDevice.h b/src/pdf/SkPDFDevice.h
index 5fedd0e..7404752 100644
--- a/src/pdf/SkPDFDevice.h
+++ b/src/pdf/SkPDFDevice.h
@@ -206,13 +206,8 @@
         sk_sp<SkData> data;
         RectWithData(const SkRect& rect, SkData* data)
             : rect(rect), data(SkRef(data)) {}
-        RectWithData(RectWithData&& other)
-            : rect(other.rect), data(std::move(other.data)) {}
-        RectWithData& operator=(RectWithData&& other) {
-            rect = other.rect;
-            data = std::move(other.data);
-            return *this;
-        }
+        RectWithData(RectWithData&&) = default;
+        RectWithData& operator=(RectWithData&& other) = default;
     };
 
     struct NamedDestination {
@@ -220,13 +215,8 @@
         SkPoint point;
         NamedDestination(SkData* nameData, const SkPoint& point)
             : nameData(SkRef(nameData)), point(point) {}
-        NamedDestination(NamedDestination&& other)
-            : nameData(std::move(other.nameData)), point(other.point) {}
-        NamedDestination& operator=(NamedDestination&& other) {
-            nameData = std::move(other.nameData);
-            point = other.point;
-            return *this;
-        }
+        NamedDestination(NamedDestination&&) = default;
+        NamedDestination& operator=(NamedDestination&&) = default;
     };
 
     // TODO(vandebo): push most of SkPDFDevice's state into a core object in
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index f16e56f..afb9b72 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -397,15 +397,6 @@
 SkPDFDict::Record::Record(SkPDFUnion&& k, SkPDFUnion&& v)
     : fKey(std::move(k)), fValue(std::move(v)) {}
 
-SkPDFDict::Record::Record(SkPDFDict::Record&& o)
-    : fKey(std::move(o.fKey)), fValue(std::move(o.fValue)) {}
-
-SkPDFDict::Record& SkPDFDict::Record::operator=(SkPDFDict::Record&& o) {
-    fKey = std::move(o.fKey);
-    fValue = std::move(o.fValue);
-    return *this;
-}
-
 int SkPDFDict::size() const { return fRecords.count(); }
 
 void SkPDFDict::insertObjRef(const char key[], sk_sp<SkPDFObject> objSp) {
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 52ce221..cdfef6c 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -290,8 +290,8 @@
         SkPDFUnion fKey;
         SkPDFUnion fValue;
         Record(SkPDFUnion&&, SkPDFUnion&&);
-        Record(Record&&);
-        Record& operator=(Record&&);
+        Record(Record&&) = default;
+        Record& operator=(Record&&) = default;
         Record(const Record&) = delete;
         Record& operator=(const Record&) = delete;
     };
diff --git a/src/utils/SkMultiPictureDocument.cpp b/src/utils/SkMultiPictureDocument.cpp
index e4105fa..214e6ad 100644
--- a/src/utils/SkMultiPictureDocument.cpp
+++ b/src/utils/SkMultiPictureDocument.cpp
@@ -60,14 +60,10 @@
 
 struct Page {
   Page(SkSize s, sk_sp<SkPicture> c) : fSize(s), fContent(std::move(c)) {}
-  Page(Page&& that) : fSize(that.fSize), fContent(std::move(that.fContent)) {}
+  Page(Page&&) = default;
   Page(const Page&) = default;
   Page& operator=(const Page&) = default;
-  Page& operator=(Page&& that) {
-    fSize = that.fSize;
-    fContent = std::move(that.fContent);
-    return *this;
-  }
+  Page& operator=(Page&&) = default;
   SkSize fSize;
   sk_sp<SkPicture> fContent;
 };