Reland of "switch patheffects over to sk_sp (patchset #5 id:80001 of https://codereview.chromium.org/1813553005/ )"

This reverts commit f28ad894272018fd2855e3f77ea1236ea0cce1c0.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1813123003

TBR=

Review URL: https://codereview.chromium.org/1813123003
diff --git a/src/effects/Sk1DPathEffect.cpp b/src/effects/Sk1DPathEffect.cpp
index 4be6f97..1d147bd 100644
--- a/src/effects/Sk1DPathEffect.cpp
+++ b/src/effects/Sk1DPathEffect.cpp
@@ -153,7 +153,7 @@
         buffer.readPath(&path);
         SkScalar phase = buffer.readScalar();
         Style style = (Style)buffer.readUInt();
-        return SkPath1DPathEffect::Create(path, advance, phase, style);
+        return SkPath1DPathEffect::Make(path, advance, phase, style).release();
     }
     return nullptr;
 }
@@ -204,10 +204,10 @@
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
-SkPathEffect* SkPath1DPathEffect::Create(const SkPath& path, SkScalar advance, SkScalar phase,
-                                         Style style) {
+sk_sp<SkPathEffect> SkPath1DPathEffect::Make(const SkPath& path, SkScalar advance, SkScalar phase,
+                                             Style style) {
     if (advance <= 0 || path.isEmpty()) {
         return nullptr;
     }
-    return new SkPath1DPathEffect(path, advance, phase, style);
+    return sk_sp<SkPathEffect>(new SkPath1DPathEffect(path, advance, phase, style));
 }
diff --git a/src/effects/Sk2DPathEffect.cpp b/src/effects/Sk2DPathEffect.cpp
index 7144526..a54f453 100644
--- a/src/effects/Sk2DPathEffect.cpp
+++ b/src/effects/Sk2DPathEffect.cpp
@@ -111,7 +111,7 @@
     SkMatrix matrix;
     buffer.readMatrix(&matrix);
     SkScalar width = buffer.readScalar();
-    return SkLine2DPathEffect::Create(width, matrix);
+    return SkLine2DPathEffect::Make(width, matrix).release();
 }
 
 void SkLine2DPathEffect::flatten(SkWriteBuffer &buffer) const {
@@ -140,7 +140,7 @@
     buffer.readMatrix(&matrix);
     SkPath path;
     buffer.readPath(&path);
-    return SkPath2DPathEffect::Create(matrix, path);
+    return SkPath2DPathEffect::Make(matrix, path).release();
 }
 
 void SkPath2DPathEffect::flatten(SkWriteBuffer& buffer) const {
diff --git a/src/effects/SkArcToPathEffect.cpp b/src/effects/SkArcToPathEffect.cpp
index 06cba96..c660de9 100644
--- a/src/effects/SkArcToPathEffect.cpp
+++ b/src/effects/SkArcToPathEffect.cpp
@@ -62,7 +62,7 @@
 }
 
 SkFlattenable* SkArcToPathEffect::CreateProc(SkReadBuffer& buffer) {
-    return SkArcToPathEffect::Create(buffer.readScalar());
+    return SkArcToPathEffect::Make(buffer.readScalar()).release();
 }
 
 void SkArcToPathEffect::flatten(SkWriteBuffer& buffer) const {
diff --git a/src/effects/SkCornerPathEffect.cpp b/src/effects/SkCornerPathEffect.cpp
index 4b81f26..325e2ca 100644
--- a/src/effects/SkCornerPathEffect.cpp
+++ b/src/effects/SkCornerPathEffect.cpp
@@ -140,7 +140,7 @@
 }
 
 SkFlattenable* SkCornerPathEffect::CreateProc(SkReadBuffer& buffer) {
-    return SkCornerPathEffect::Create(buffer.readScalar());
+    return SkCornerPathEffect::Make(buffer.readScalar()).release();
 }
 
 void SkCornerPathEffect::flatten(SkWriteBuffer& buffer) const {
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 3816499..51bf548 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -365,7 +365,7 @@
     uint32_t count = buffer.getArrayCount();
     SkAutoSTArray<32, SkScalar> intervals(count);
     if (buffer.readScalarArray(intervals.get(), count)) {
-        return Create(intervals.get(), SkToInt(count), phase);
+        return Make(intervals.get(), SkToInt(count), phase).release();
     }
     return nullptr;
 }
@@ -386,9 +386,9 @@
 
 //////////////////////////////////////////////////////////////////////////////////////////////////
 
-SkPathEffect* SkDashPathEffect::Create(const SkScalar intervals[], int count, SkScalar phase) {
+sk_sp<SkPathEffect> SkDashPathEffect::Make(const SkScalar intervals[], int count, SkScalar phase) {
     if (!SkDashPath::ValidDashPath(phase, intervals, count)) {
         return nullptr;
     }
-    return new SkDashPathEffect(intervals, count, phase);
+    return sk_sp<SkPathEffect>(new SkDashPathEffect(intervals, count, phase));
 }
diff --git a/src/effects/SkDiscretePathEffect.cpp b/src/effects/SkDiscretePathEffect.cpp
index acde041..1989d9d 100644
--- a/src/effects/SkDiscretePathEffect.cpp
+++ b/src/effects/SkDiscretePathEffect.cpp
@@ -13,6 +13,11 @@
 #include "SkPathMeasure.h"
 #include "SkStrokeRec.h"
 
+sk_sp<SkPathEffect> SkDiscretePathEffect::Make(SkScalar segLength, SkScalar deviation,
+                                               uint32_t seedAssist) {
+    return sk_sp<SkPathEffect>(new SkDiscretePathEffect(segLength, deviation, seedAssist));
+}
+
 static void Perterb(SkPoint* p, const SkVector& tangent, SkScalar scale) {
     SkVector normal = tangent;
     normal.rotateCCW();
@@ -121,7 +126,7 @@
     SkScalar segLength = buffer.readScalar();
     SkScalar perterb = buffer.readScalar();
     uint32_t seed = buffer.readUInt();
-    return Create(segLength, perterb, seed);
+    return Make(segLength, perterb, seed).release();
 }
 
 void SkDiscretePathEffect::flatten(SkWriteBuffer& buffer) const {
diff --git a/src/effects/SkLayerDrawLooper.cpp b/src/effects/SkLayerDrawLooper.cpp
index bca65ef..83f21e5 100644
--- a/src/effects/SkLayerDrawLooper.cpp
+++ b/src/effects/SkLayerDrawLooper.cpp
@@ -93,7 +93,7 @@
     }
 
     if (bits & kPathEffect_Bit) {
-        dst->setPathEffect(src.getPathEffect());
+        dst->setPathEffect(sk_ref_sp(src.getPathEffect()));
     }
     if (bits & kMaskFilter_Bit) {
         dst->setMaskFilter(src.getMaskFilter());