Remove GrEffect::CreateEffectRef and GrEffect::AutoEffectRef.

R=robertphillips@google.com

Author: bsalomon@google.com

Review URL: https://codereview.chromium.org/371103003
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index 978ad3a..13a6c43 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -169,29 +169,7 @@
         , fWillUseInputColor(true)
         , fHasVertexCode(false) {}
 
-    /** This should be called by GrEffect subclass factories. See the comment on AutoEffectUnref for
-        an example factory function. */
-    static GrEffect* CreateEffectRef(GrEffect* effect) {
-        return SkRef(effect);
-    }
-
-    static const GrEffect* CreateEffectRef(const GrEffect* effect) {
-        return CreateEffectRef(const_cast<GrEffect*>(effect));
-    }
-
-    /** Helper used in subclass factory functions to unref the effect after it has been wrapped in a
-        GrEffectRef. E.g.:
-
-        class EffectSubclass : public GrEffect {
-        public:
-            GrEffectRef* Create(ParamType1 param1, ParamType2 param2, ...) {
-                AutoEffectUnref effect(SkNEW_ARGS(EffectSubclass, (param1, param2, ...)));
-                return CreateEffectRef(effect);
-            }
-     */
-    typedef SkAutoTUnref<GrEffect> AutoEffectUnref;
-
-    /** Helper for getting the GrEffect out of a GrEffectRef and down-casting to a GrEffect subclass
+    /** Helper for down-casting to a GrEffect subclass
       */
     template <typename T>
     static const T& CastEffect(const GrEffect& effectRef) {
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index b3e2ed1..cf4f19f 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -797,8 +797,7 @@
         if (!IsSupportedMode(mode)) {
             return NULL;
         } else {
-            AutoEffectUnref effect(SkNEW_ARGS(XferEffect, (mode, background)));
-            return CreateEffectRef(effect);
+            return SkNEW_ARGS(XferEffect, (mode, background));
         }
     }
 
@@ -1230,8 +1229,7 @@
                                     GrTexture*[]) {
     int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode);
 
-    AutoEffectUnref gEffect(SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL)));
-    return CreateEffectRef(gEffect);
+    return SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode>(mode), NULL));
 }
 
 #endif
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index 0bc906d..b375c88 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -60,11 +60,10 @@
                                GrTexture* maskTexture,
                                float innerThreshold,
                                float outerThreshold) {
-        AutoEffectUnref effect(SkNEW_ARGS(AlphaThresholdEffect, (texture,
-                                                                 maskTexture,
-                                                                 innerThreshold,
-                                                                 outerThreshold)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(AlphaThresholdEffect, (texture,
+                                                 maskTexture,
+                                                 innerThreshold,
+                                                 outerThreshold));
     }
 
     virtual ~AlphaThresholdEffect() {};
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index 41cc266..f04ccf2 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -264,9 +264,7 @@
 public:
     static GrEffectRef* Create(float k1, float k2, float k3, float k4, bool enforcePMColor,
                                GrTexture* background) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor,
-                                                               background)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, background));
     }
 
     virtual ~GrArithmeticEffect();
@@ -422,9 +420,7 @@
     float k4 = rand->nextF();
     bool enforcePMColor = rand->nextBool();
 
-    AutoEffectUnref gEffect(SkNEW_ARGS(GrArithmeticEffect,
-                                       (k1, k2, k3, k4, enforcePMColor, NULL)));
-    return CreateEffectRef(gEffect);
+    return SkNEW_ARGS(GrArithmeticEffect, (k1, k2, k3, k4, enforcePMColor, NULL));
 }
 
 GR_DEFINE_EFFECT_TEST(GrArithmeticEffect);
diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp
index fca38a1..86a4f5a 100644
--- a/src/effects/SkBlurMaskFilter.cpp
+++ b/src/effects/SkBlurMaskFilter.cpp
@@ -572,8 +572,7 @@
         if (!createdBlurProfileTexture) {
            return NULL;
         }
-        AutoEffectUnref effect(SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrRectBlurEffect, (rect, sigma, blurProfileTexture));
     }
 
     const SkRect& getRect() const { return fRect; }
@@ -914,8 +913,7 @@
         return NULL;
     }
 
-    return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrRRectBlurEffect,
-                                                      (sigma, rrect, blurNinePatchTexture))));
+    return SkNEW_ARGS(GrRRectBlurEffect, (sigma, rrect, blurNinePatchTexture));
 }
 
 void GrRRectBlurEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp
index bee3a50..18dbb95 100644
--- a/src/effects/SkColorFilters.cpp
+++ b/src/effects/SkColorFilters.cpp
@@ -195,8 +195,7 @@
             SkDebugf("Failing to create color filter for mode %d\n", mode);
             return NULL;
         }
-        AutoEffectUnref effect(SkNEW_ARGS(ModeColorFilterEffect, (c, mode)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(ModeColorFilterEffect, (c, mode));
     }
 
     virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const SK_OVERRIDE;
diff --git a/src/effects/SkColorMatrixFilter.cpp b/src/effects/SkColorMatrixFilter.cpp
index bd1df79..b3b9c29 100644
--- a/src/effects/SkColorMatrixFilter.cpp
+++ b/src/effects/SkColorMatrixFilter.cpp
@@ -331,8 +331,7 @@
 class ColorMatrixEffect : public GrEffect {
 public:
     static GrEffectRef* Create(const SkColorMatrix& matrix) {
-        AutoEffectUnref effect(SkNEW_ARGS(ColorMatrixEffect, (matrix)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(ColorMatrixEffect, (matrix));
     }
 
     static const char* Name() { return "Color Matrix"; }
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index a5519d1..44c3908 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -305,13 +305,12 @@
                                SkVector scale,
                                GrTexture* displacement, const SkMatrix& offsetMatrix,
                                GrTexture* color) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector,
-                                                                    yChannelSelector,
-                                                                    scale,
-                                                                    displacement,
-                                                                    offsetMatrix,
-                                                                    color)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector,
+                                                    yChannelSelector,
+                                                    scale,
+                                                    displacement,
+                                                    offsetMatrix,
+                                                    color));
     }
 
     virtual ~GrDisplacementMapEffect();
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index c0c605c..5fc3474 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -339,12 +339,11 @@
                                SkScalar surfaceScale,
                                const SkMatrix& matrix,
                                SkScalar kd) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrDiffuseLightingEffect, (texture,
-                                                                    light,
-                                                                    surfaceScale,
-                                                                    matrix,
-                                                                    kd)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrDiffuseLightingEffect, (texture,
+                                                    light,
+                                                    surfaceScale,
+                                                    matrix,
+                                                    kd));
     }
 
     static const char* Name() { return "DiffuseLighting"; }
@@ -376,13 +375,12 @@
                                const SkMatrix& matrix,
                                SkScalar ks,
                                SkScalar shininess) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrSpecularLightingEffect, (texture,
-                                                                     light,
-                                                                     surfaceScale,
-                                                                     matrix,
-                                                                     ks,
-                                                                     shininess)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrSpecularLightingEffect, (texture,
+                                                     light,
+                                                     surfaceScale,
+                                                     matrix,
+                                                     ks,
+                                                     shininess));
     }
     static const char* Name() { return "SpecularLighting"; }
 
diff --git a/src/effects/SkLumaColorFilter.cpp b/src/effects/SkLumaColorFilter.cpp
index 4c90f3d..54dfc08 100644
--- a/src/effects/SkLumaColorFilter.cpp
+++ b/src/effects/SkLumaColorFilter.cpp
@@ -61,8 +61,8 @@
 class LumaColorFilterEffect : public GrEffect {
 public:
     static GrEffectRef* Create() {
-        AutoEffectUnref effect(SkNEW(LumaColorFilterEffect));
-        return CreateEffectRef(effect);
+        GR_CREATE_STATIC_EFFECT(gLumaEffect, LumaColorFilterEffect, ());
+        return SkRef(gLumaEffect);
     }
 
     static const char* Name() { return "Luminance-to-Alpha"; }
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 99c0176..16f4066 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -32,14 +32,13 @@
                                float yInvZoom,
                                float xInvInset,
                                float yInvInset) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrMagnifierEffect, (texture,
-                                                              xOffset,
-                                                              yOffset,
-                                                              xInvZoom,
-                                                              yInvZoom,
-                                                              xInvInset,
-                                                              yInvInset)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrMagnifierEffect, (texture,
+                                              xOffset,
+                                              yOffset,
+                                              xInvZoom,
+                                              yInvZoom,
+                                              xInvInset,
+                                              yInvInset));
     }
 
     virtual ~GrMagnifierEffect() {};
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index ca2cfca..2740edc 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -339,16 +339,15 @@
                                const SkIPoint& kernelOffset,
                                TileMode tileMode,
                                bool convolveAlpha) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrMatrixConvolutionEffect, (texture,
-                                                                      bounds,
-                                                                      kernelSize,
-                                                                      kernel,
-                                                                      gain,
-                                                                      bias,
-                                                                      kernelOffset,
-                                                                      tileMode,
-                                                                      convolveAlpha)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrMatrixConvolutionEffect, (texture,
+                                                      bounds,
+                                                      kernelSize,
+                                                      kernel,
+                                                      gain,
+                                                      bias,
+                                                      kernelOffset,
+                                                      tileMode,
+                                                      convolveAlpha));
     }
     virtual ~GrMatrixConvolutionEffect();
 
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 19a9b68..8de8dda 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -279,8 +279,7 @@
     };
 
     static GrEffectRef* Create(GrTexture* tex, Direction dir, int radius, MorphologyType type) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type));
     }
 
     virtual ~GrMorphologyEffect();
diff --git a/src/effects/SkPerlinNoiseShader.cpp b/src/effects/SkPerlinNoiseShader.cpp
index 502cc07..894af42 100644
--- a/src/effects/SkPerlinNoiseShader.cpp
+++ b/src/effects/SkPerlinNoiseShader.cpp
@@ -530,9 +530,8 @@
                                SkPerlinNoiseShader::PaintingData* paintingData,
                                GrTexture* permutationsTexture, GrTexture* noiseTexture,
                                const SkMatrix& matrix, uint8_t alpha) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrPerlinNoiseEffect, (type, numOctaves,
-            stitchTiles, paintingData, permutationsTexture, noiseTexture, matrix, alpha)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrPerlinNoiseEffect, (type, numOctaves, stitchTiles, paintingData,
+                                                permutationsTexture, noiseTexture, matrix, alpha));
     }
 
     virtual ~GrPerlinNoiseEffect() {
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 771d2fa..d4a111e 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -237,8 +237,7 @@
 class ColorTableEffect : public GrEffect {
 public:
     static GrEffectRef* Create(GrTexture* texture, unsigned flags) {
-        AutoEffectUnref effect(SkNEW_ARGS(ColorTableEffect, (texture, flags)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(ColorTableEffect, (texture, flags));
     }
 
     virtual ~ColorTableEffect();
diff --git a/src/effects/gradients/SkLinearGradient.cpp b/src/effects/gradients/SkLinearGradient.cpp
index 768623a..d518cc7 100644
--- a/src/effects/gradients/SkLinearGradient.cpp
+++ b/src/effects/gradients/SkLinearGradient.cpp
@@ -484,8 +484,7 @@
                                const SkLinearGradient& shader,
                                const SkMatrix& matrix,
                                SkShader::TileMode tm) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrLinearGradient, (ctx, shader, matrix, tm));
     }
 
     virtual ~GrLinearGradient() { }
diff --git a/src/effects/gradients/SkRadialGradient.cpp b/src/effects/gradients/SkRadialGradient.cpp
index 38e6f33..bb60d0f 100644
--- a/src/effects/gradients/SkRadialGradient.cpp
+++ b/src/effects/gradients/SkRadialGradient.cpp
@@ -493,8 +493,7 @@
                                const SkRadialGradient& shader,
                                const SkMatrix& matrix,
                                SkShader::TileMode tm) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrRadialGradient, (ctx, shader, matrix, tm)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrRadialGradient, (ctx, shader, matrix, tm));
     }
 
     virtual ~GrRadialGradient() { }
diff --git a/src/effects/gradients/SkSweepGradient.cpp b/src/effects/gradients/SkSweepGradient.cpp
index 3b54ac8..b3474ec 100644
--- a/src/effects/gradients/SkSweepGradient.cpp
+++ b/src/effects/gradients/SkSweepGradient.cpp
@@ -208,8 +208,7 @@
     static GrEffectRef* Create(GrContext* ctx,
                                const SkSweepGradient& shader,
                                const SkMatrix& matrix) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrSweepGradient, (ctx, shader, matrix)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrSweepGradient, (ctx, shader, matrix));
     }
     virtual ~GrSweepGradient() { }
 
diff --git a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
index 4f9f758..b6959e3 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient_gpu.cpp
@@ -63,8 +63,7 @@
                                const SkTwoPointConicalGradient& shader,
                                const SkMatrix& matrix,
                                SkShader::TileMode tm) {
-        AutoEffectUnref effect(SkNEW_ARGS(Edge2PtConicalEffect, (ctx, shader, matrix, tm)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(Edge2PtConicalEffect, (ctx, shader, matrix, tm));
     }
 
     virtual ~Edge2PtConicalEffect() {}
@@ -371,8 +370,7 @@
                                const SkMatrix& matrix,
                                SkShader::TileMode tm,
                                SkScalar focalX) {
-        AutoEffectUnref effect(SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, shader, matrix, tm, focalX)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(FocalOutside2PtConicalEffect, (ctx, shader, matrix, tm, focalX));
     }
 
     virtual ~FocalOutside2PtConicalEffect() { }
@@ -586,8 +584,7 @@
                                const SkMatrix& matrix,
                                SkShader::TileMode tm,
                                SkScalar focalX) {
-        AutoEffectUnref effect(SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, shader, matrix, tm, focalX)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(FocalInside2PtConicalEffect, (ctx, shader, matrix, tm, focalX));
     }
 
     virtual ~FocalInside2PtConicalEffect() {}
@@ -820,8 +817,7 @@
                                const SkMatrix& matrix,
                                SkShader::TileMode tm,
                                const CircleConicalInfo& info) {
-        AutoEffectUnref effect(SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, shader, matrix, tm, info)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(CircleInside2PtConicalEffect, (ctx, shader, matrix, tm, info));
     }
 
     virtual ~CircleInside2PtConicalEffect() {}
@@ -1033,8 +1029,7 @@
                                const SkMatrix& matrix,
                                SkShader::TileMode tm,
                                const CircleConicalInfo& info) {
-        AutoEffectUnref effect(SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, shader, matrix, tm, info)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(CircleOutside2PtConicalEffect, (ctx, shader, matrix, tm, info));
     }
 
     virtual ~CircleOutside2PtConicalEffect() {}
diff --git a/src/effects/gradients/SkTwoPointRadialGradient.cpp b/src/effects/gradients/SkTwoPointRadialGradient.cpp
index 3507c89..22feb71 100644
--- a/src/effects/gradients/SkTwoPointRadialGradient.cpp
+++ b/src/effects/gradients/SkTwoPointRadialGradient.cpp
@@ -438,8 +438,7 @@
                                const SkTwoPointRadialGradient& shader,
                                const SkMatrix& matrix,
                                SkShader::TileMode tm) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrRadial2Gradient, (ctx, shader, matrix, tm)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrRadial2Gradient, (ctx, shader, matrix, tm));
     }
 
     virtual ~GrRadial2Gradient() { }
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index 1998e68..eea4d4e 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -44,10 +44,8 @@
                                                              SkShader::kClamp_TileMode };
             return Create(tex, coefficients, MakeDivByTextureWHMatrix(tex), kTileModes);
         } else {
-            AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients,
-                                                                MakeDivByTextureWHMatrix(tex),
-                                                                *domain)));
-            return CreateEffectRef(effect);
+            return SkNEW_ARGS(GrBicubicEffect, (tex, coefficients,
+                                                MakeDivByTextureWHMatrix(tex), *domain));
         }
     }
 
@@ -65,17 +63,14 @@
      */
     static GrEffectRef* Create(GrTexture* tex, const SkScalar coefficients[16],
                                const SkMatrix& matrix, const SkShader::TileMode tileModes[2]) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, tileModes)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrBicubicEffect, (tex, coefficients, matrix, tileModes));
     }
 
     /**
      * Create a Mitchell filter effect with a texture matrix and a domain.
      */
     static GrEffectRef* Create(GrTexture* tex, const SkMatrix& matrix, const SkRect& domain) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrBicubicEffect, (tex, gMitchellCoefficients, matrix,
-                                                            domain)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrBicubicEffect, (tex, gMitchellCoefficients, matrix, domain));
     }
 
     /**
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index f33ad23..260008c 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -129,12 +129,11 @@
     } else {
         swapRB = random->nextBool();
     }
-    AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect,
+    return SkNEW_ARGS(GrConfigConversionEffect,
                                       (textures[GrEffectUnitTest::kSkiaPMTextureIdx],
                                        swapRB,
                                        pmConv,
-                                       GrEffectUnitTest::TestMatrix(random))));
-    return CreateEffectRef(effect);
+                                       GrEffectUnitTest::TestMatrix(random)));
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -200,38 +199,34 @@
         // from readTex to tempTex followed by a PM->UPM draw to readTex and finally read the data.
         // We then verify that two reads produced the same values.
 
-        AutoEffectUnref pmToUPM1(SkNEW_ARGS(GrConfigConversionEffect, (dataTex,
-                                                                       false,
-                                                                       *pmToUPMRule,
-                                                                       SkMatrix::I())));
-        AutoEffectUnref upmToPM(SkNEW_ARGS(GrConfigConversionEffect, (readTex,
-                                                                      false,
-                                                                      *upmToPMRule,
-                                                                      SkMatrix::I())));
-        AutoEffectUnref pmToUPM2(SkNEW_ARGS(GrConfigConversionEffect, (tempTex,
-                                                                       false,
-                                                                       *pmToUPMRule,
-                                                                       SkMatrix::I())));
-
-        SkAutoTUnref<GrEffectRef> pmToUPMEffect1(CreateEffectRef(pmToUPM1));
-        SkAutoTUnref<GrEffectRef> upmToPMEffect(CreateEffectRef(upmToPM));
-        SkAutoTUnref<GrEffectRef> pmToUPMEffect2(CreateEffectRef(pmToUPM2));
+        SkAutoTUnref<GrEffect> pmToUPM1(SkNEW_ARGS(GrConfigConversionEffect, (dataTex,
+                                                                              false,
+                                                                              *pmToUPMRule,
+                                                                              SkMatrix::I())));
+        SkAutoTUnref<GrEffect> upmToPM(SkNEW_ARGS(GrConfigConversionEffect, (readTex,
+                                                                             false,
+                                                                             *upmToPMRule,
+                                                                             SkMatrix::I())));
+        SkAutoTUnref<GrEffect> pmToUPM2(SkNEW_ARGS(GrConfigConversionEffect, (tempTex,
+                                                                              false,
+                                                                              *pmToUPMRule,
+                                                                              SkMatrix::I())));
 
         context->setRenderTarget(readTex->asRenderTarget());
         GrPaint paint1;
-        paint1.addColorEffect(pmToUPMEffect1);
+        paint1.addColorEffect(pmToUPM1);
         context->drawRectToRect(paint1, kDstRect, kSrcRect);
 
         readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, firstRead);
 
         context->setRenderTarget(tempTex->asRenderTarget());
         GrPaint paint2;
-        paint2.addColorEffect(upmToPMEffect);
+        paint2.addColorEffect(upmToPM);
         context->drawRectToRect(paint2, kDstRect, kSrcRect);
         context->setRenderTarget(readTex->asRenderTarget());
 
         GrPaint paint3;
-        paint3.addColorEffect(pmToUPMEffect2);
+        paint3.addColorEffect(pmToUPM2);
         context->drawRectToRect(paint3, kDstRect, kSrcRect);
 
         readTex->readPixels(0, 0, 256, 256, kRGBA_8888_GrPixelConfig, secondRead);
@@ -268,10 +263,9 @@
             // The PM conversions assume colors are 0..255
             return NULL;
         }
-        AutoEffectUnref effect(SkNEW_ARGS(GrConfigConversionEffect, (texture,
-                                                                     swapRedAndBlue,
-                                                                     pmConversion,
-                                                                     matrix)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrConfigConversionEffect, (texture,
+                                                     swapRedAndBlue,
+                                                     pmConversion,
+                                                     matrix));
     }
 }
diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp
index d24b45e..aebd5b0 100644
--- a/src/gpu/effects/GrConvexPolyEffect.cpp
+++ b/src/gpu/effects/GrConvexPolyEffect.cpp
@@ -25,7 +25,7 @@
     static const char* Name() { return "AARect"; }
 
     static GrEffectRef* Create(GrEffectEdgeType edgeType, const SkRect& rect) {
-        return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(AARectEffect, (edgeType, rect))));
+        return SkNEW_ARGS(AARectEffect, (edgeType, rect));
     }
 
     virtual void getConstantColorComponents(GrColor* color,
diff --git a/src/gpu/effects/GrConvexPolyEffect.h b/src/gpu/effects/GrConvexPolyEffect.h
index 0e508c7..1a00f12 100644
--- a/src/gpu/effects/GrConvexPolyEffect.h
+++ b/src/gpu/effects/GrConvexPolyEffect.h
@@ -41,8 +41,7 @@
         if (n <= 0 || n > kMaxEdges || kHairlineAA_GrEffectEdgeType == edgeType) {
             return NULL;
         }
-        return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(GrConvexPolyEffect,
-                                                          (edgeType, n, edges))));
+        return SkNEW_ARGS(GrConvexPolyEffect, (edgeType, n, edges));
     }
 
     /**
diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h
index 56a54b4..77c2d34 100644
--- a/src/gpu/effects/GrConvolutionEffect.h
+++ b/src/gpu/effects/GrConvolutionEffect.h
@@ -28,13 +28,12 @@
                                const float* kernel,
                                bool useBounds,
                                float bounds[2]) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrConvolutionEffect, (tex,
-                                                                dir,
-                                                                halfWidth,
-                                                                kernel,
-                                                                useBounds,
-                                                                bounds)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrConvolutionEffect, (tex,
+                                                dir,
+                                                halfWidth,
+                                                kernel,
+                                                useBounds,
+                                                bounds));
     }
 
     /// Convolve with a Gaussian kernel
@@ -44,13 +43,12 @@
                                        float gaussianSigma,
                                        bool useBounds,
                                        float bounds[2]) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrConvolutionEffect, (tex,
-                                                                dir,
-                                                                halfWidth,
-                                                                gaussianSigma,
-                                                                useBounds,
-                                                                bounds)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrConvolutionEffect, (tex,
+                                                dir,
+                                                halfWidth,
+                                                gaussianSigma,
+                                                useBounds,
+                                                bounds));
     }
 
     virtual ~GrConvolutionEffect();
diff --git a/src/gpu/effects/GrCustomCoordsTextureEffect.h b/src/gpu/effects/GrCustomCoordsTextureEffect.h
index 1caecf2..5dc830a 100644
--- a/src/gpu/effects/GrCustomCoordsTextureEffect.h
+++ b/src/gpu/effects/GrCustomCoordsTextureEffect.h
@@ -21,8 +21,7 @@
 class GrCustomCoordsTextureEffect : public GrVertexEffect {
 public:
     static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& p) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrCustomCoordsTextureEffect, (tex, p));
     }
 
     virtual ~GrCustomCoordsTextureEffect() {}
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index e46cc04..fb58b84 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -563,8 +563,7 @@
         return NULL;
     }
 
-    return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(DashingCircleEffect,
-                                                      (edgeType, info, radius))));
+    return SkNEW_ARGS(DashingCircleEffect, (edgeType, info, radius));
 }
 
 DashingCircleEffect::~DashingCircleEffect() {}
@@ -782,8 +781,7 @@
         return NULL;
     }
 
-    return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(DashingLineEffect,
-                                                      (edgeType, info, strokeWidth))));
+    return SkNEW_ARGS(DashingLineEffect, (edgeType, info, strokeWidth));
 }
 
 DashingLineEffect::~DashingLineEffect() {}
diff --git a/src/gpu/effects/GrDistanceFieldTextureEffect.h b/src/gpu/effects/GrDistanceFieldTextureEffect.h
index 692290c..b2e21b2 100644
--- a/src/gpu/effects/GrDistanceFieldTextureEffect.h
+++ b/src/gpu/effects/GrDistanceFieldTextureEffect.h
@@ -26,17 +26,15 @@
     static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& params,
                                GrTexture* gamma, const GrTextureParams& gammaParams, float lum,
                                bool similarity) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params,
-                                                                         gamma, gammaParams, lum,
-                                                                         similarity)));
+       return SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, gamma, gammaParams, lum,
+                                                        similarity));
+    }
 #else
     static GrEffectRef* Create(GrTexture* tex, const GrTextureParams& params,
                                bool similarity) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params,
-                                                                         similarity)));
-#endif
-        return CreateEffectRef(effect);
+        return  SkNEW_ARGS(GrDistanceFieldTextureEffect, (tex, params, similarity));
     }
+#endif
 
     virtual ~GrDistanceFieldTextureEffect() {}
 
@@ -85,10 +83,8 @@
                                GrTexture* gamma, const GrTextureParams& gammaParams, 
                                SkColor textColor,
                                bool uniformScale, bool useBGR) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrDistanceFieldLCDTextureEffect,
-                                          (tex, params, gamma, gammaParams, textColor, uniformScale,
-                                           useBGR)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrDistanceFieldLCDTextureEffect,
+                          (tex, params, gamma, gammaParams, textColor, uniformScale, useBGR));
     }
 
     virtual ~GrDistanceFieldLCDTextureEffect() {}
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index 7409e5f..1db61ba 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -20,7 +20,8 @@
 class DitherEffect : public GrEffect {
 public:
     static GrEffectRef* Create() {
-        return CreateEffectRef(AutoEffectUnref(SkNEW(DitherEffect)));
+        GR_CREATE_STATIC_EFFECT(gDitherEffect, DitherEffect, ())
+        return SkRef(gDitherEffect);
     }
 
     virtual ~DitherEffect() {};
diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp
index f2ee278..678abd0 100644
--- a/src/gpu/effects/GrOvalEffect.cpp
+++ b/src/gpu/effects/GrOvalEffect.cpp
@@ -53,8 +53,7 @@
                                   const SkPoint& center,
                                   SkScalar radius) {
     SkASSERT(radius >= 0);
-    return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(CircleEffect,
-                                                      (edgeType, center, radius))));
+    return SkNEW_ARGS(CircleEffect, (edgeType, center, radius));
 }
 
 void CircleEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {
@@ -225,8 +224,7 @@
                                    SkScalar rx,
                                    SkScalar ry) {
     SkASSERT(rx >= 0 && ry >= 0);
-    return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(EllipseEffect,
-                                                      (edgeType, center, rx, ry))));
+    return SkNEW_ARGS(EllipseEffect, (edgeType, center, rx, ry));
 }
 
 void EllipseEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {
diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp
index 11d8a18..33291ed 100644
--- a/src/gpu/effects/GrRRectEffect.cpp
+++ b/src/gpu/effects/GrRRectEffect.cpp
@@ -81,8 +81,7 @@
     if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) {
         return NULL;
     }
-    return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(CircularRRectEffect,
-                                                      (edgeType, circularCornerFlags, rrect))));
+    return SkNEW_ARGS(CircularRRectEffect, (edgeType, circularCornerFlags, rrect));
 }
 
 void CircularRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {
@@ -416,7 +415,7 @@
     if (kFillAA_GrEffectEdgeType != edgeType && kInverseFillAA_GrEffectEdgeType != edgeType) {
         return NULL;
     }
-    return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect))));
+    return SkNEW_ARGS(EllipticalRRectEffect, (edgeType, rrect));
 }
 
 void EllipticalRRectEffect::getConstantColorComponents(GrColor* color, uint32_t* validFlags) const {
diff --git a/src/gpu/effects/GrSimpleTextureEffect.h b/src/gpu/effects/GrSimpleTextureEffect.h
index c326ccf..fea18e5 100644
--- a/src/gpu/effects/GrSimpleTextureEffect.h
+++ b/src/gpu/effects/GrSimpleTextureEffect.h
@@ -26,8 +26,8 @@
     static GrEffectRef* Create(GrTexture* tex,
                                const SkMatrix& matrix,
                                GrCoordSet coordSet = kLocal_GrCoordSet) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode, coordSet)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, GrTextureParams::kNone_FilterMode,
+                                                  coordSet));
     }
 
     /* clamp mode */
@@ -35,17 +35,14 @@
                                const SkMatrix& matrix,
                                GrTextureParams::FilterMode filterMode,
                                GrCoordSet coordSet = kLocal_GrCoordSet) {
-        AutoEffectUnref effect(
-            SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordSet)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, filterMode, coordSet));
     }
 
     static GrEffectRef* Create(GrTexture* tex,
                                const SkMatrix& matrix,
                                const GrTextureParams& p,
                                GrCoordSet coordSet = kLocal_GrCoordSet) {
-        AutoEffectUnref effect(SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(GrSimpleTextureEffect, (tex, matrix, p, coordSet));
     }
 
     virtual ~GrSimpleTextureEffect() {}
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 656000b..cb2ad5f 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -208,14 +208,12 @@
         return GrSimpleTextureEffect::Create(texture, matrix, filterMode);
     } else {
 
-        AutoEffectUnref effect(SkNEW_ARGS(GrTextureDomainEffect, (texture,
-                                                                  matrix,
-                                                                  domain,
-                                                                  mode,
-                                                                  filterMode,
-                                                                  coordSet)));
-        return CreateEffectRef(effect);
-
+        return SkNEW_ARGS(GrTextureDomainEffect, (texture,
+                                                  matrix,
+                                                  domain,
+                                                  mode,
+                                                  filterMode,
+                                                  coordSet));
     }
 }
 
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index 866f4a6..539b4ac 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -17,8 +17,7 @@
 class YUVtoRGBEffect : public GrEffect {
 public:
     static GrEffect* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture) {
-        AutoEffectUnref effect(SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture)));
-        return CreateEffectRef(effect);
+        return SkNEW_ARGS(YUVtoRGBEffect, (yTexture, uTexture, vTexture));
     }
 
     static const char* Name() { return "YUV to RGB"; }