Remove GrRefCnt.h in favor of SkRefCnt.h

This removes GrRefCnt.h with all its tyepdefs and #defines and just switch them
to the Sk* equivalents.

GrSafeSetNull was promoted to SkSafeSetNull in SkRefCnt.h.

BUG=None
TEST=none, no functional changes.
R=bsalomon@google.com, robertphillips@google.com

Author: tfarina@chromium.org

Review URL: https://chromiumcodereview.appspot.com/23904003

git-svn-id: http://skia.googlecode.com/svn/trunk@11151 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gm/texdata.cpp b/gm/texdata.cpp
index 0e2d7fd..b2c7139 100644
--- a/gm/texdata.cpp
+++ b/gm/texdata.cpp
@@ -93,7 +93,7 @@
                 if (!texture) {
                     return;
                 }
-                GrAutoUnref au(texture);
+                SkAutoUnref au(texture);
 
                 GrContext::AutoClip acs(ctx, SkRect::MakeWH(2*S, 2*S));
 
diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi
index 810a367..1714759 100644
--- a/gyp/gpu.gypi
+++ b/gyp/gpu.gypi
@@ -25,7 +25,6 @@
       '<(skia_include_path)/gpu/GrPathRendererChain.h',
       '<(skia_include_path)/gpu/GrPoint.h',
       '<(skia_include_path)/gpu/GrRect.h',
-      '<(skia_include_path)/gpu/GrRefCnt.h',
       '<(skia_include_path)/gpu/GrRenderTarget.h',
       '<(skia_include_path)/gpu/GrResource.h',
       '<(skia_include_path)/gpu/GrSurface.h',
diff --git a/gyp/public_headers.gypi b/gyp/public_headers.gypi
index d770349..022f679 100644
--- a/gyp/public_headers.gypi
+++ b/gyp/public_headers.gypi
@@ -34,7 +34,6 @@
       'gpu/GrTypes.h',
       'gpu/GrFontScaler.h',
       'gpu/GrResource.h',
-      'gpu/GrRefCnt.h',
       'gpu/GrKey.h',
       'gpu/GrOvalRenderer.h',
       'gpu/GrEffectUnitTest.h',
diff --git a/include/core/SkRefCnt.h b/include/core/SkRefCnt.h
index 87ff7db..35f7349 100644
--- a/include/core/SkRefCnt.h
+++ b/include/core/SkRefCnt.h
@@ -160,6 +160,13 @@
     }
 }
 
+template<typename T> static inline void SkSafeSetNull(T*& obj) {
+    if (NULL != obj) {
+        obj->unref();
+        obj = NULL;
+    }
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 
 /**
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index ae549b6..42413fb 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -15,7 +15,6 @@
 #include "GrPathRendererChain.h"
 #include "GrPoint.h"
 #include "GrRenderTarget.h"
-#include "GrRefCnt.h"
 #include "GrTexture.h"
 
 class GrAARectRenderer;
@@ -40,7 +39,7 @@
 class GrSoftwarePathRenderer;
 class SkStrokeRec;
 
-class SK_API GrContext : public GrRefCnt {
+class SK_API GrContext : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrContext)
 
@@ -635,20 +634,20 @@
     public:
         AutoRenderTarget(GrContext* context, GrRenderTarget* target) {
             fPrevTarget = context->getRenderTarget();
-            GrSafeRef(fPrevTarget);
+            SkSafeRef(fPrevTarget);
             context->setRenderTarget(target);
             fContext = context;
         }
         AutoRenderTarget(GrContext* context) {
             fPrevTarget = context->getRenderTarget();
-            GrSafeRef(fPrevTarget);
+            SkSafeRef(fPrevTarget);
             fContext = context;
         }
         ~AutoRenderTarget() {
             if (NULL != fContext) {
                 fContext->setRenderTarget(fPrevTarget);
             }
-            GrSafeUnref(fPrevTarget);
+            SkSafeUnref(fPrevTarget);
         }
     private:
         GrContext*      fContext;
@@ -934,7 +933,7 @@
      */
     static bool OverbudgetCB(void* data);
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 /**
diff --git a/include/gpu/GrEffect.h b/include/gpu/GrEffect.h
index a84810c..b0d336b 100644
--- a/include/gpu/GrEffect.h
+++ b/include/gpu/GrEffect.h
@@ -11,7 +11,6 @@
 #include "GrColor.h"
 #include "GrEffectUnitTest.h"
 #include "GrNoncopyable.h"
-#include "GrRefCnt.h"
 #include "GrTexture.h"
 #include "GrTextureAccess.h"
 #include "GrTypesPriv.h"
@@ -74,13 +73,13 @@
     member function of a GrEffect subclass.
 
     Because almost no code should ever handle a GrEffect directly outside of a GrEffectRef, we
-    privately inherit from GrRefCnt to help prevent accidental direct ref'ing/unref'ing of effects.
+    privately inherit from SkRefCnt to help prevent accidental direct ref'ing/unref'ing of effects.
 
     Dynamically allocated GrEffects and their corresponding GrEffectRefs are managed by a per-thread
     memory pool. The ref count of an effect must reach 0 before the thread terminates and the pool
     is destroyed. To create a static effect use the macro GR_CREATE_STATIC_EFFECT declared below.
   */
-class GrEffect : private GrRefCnt {
+class GrEffect : private SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrEffect)
 
@@ -317,7 +316,7 @@
     bool                                         fWillReadFragmentPosition;
     GrEffectRef*                                 fEffectRef;
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 inline GrEffectRef::GrEffectRef(GrEffect* effect) {
diff --git a/include/gpu/GrFontScaler.h b/include/gpu/GrFontScaler.h
index f5dcf53..e51c4ac 100644
--- a/include/gpu/GrFontScaler.h
+++ b/include/gpu/GrFontScaler.h
@@ -20,7 +20,7 @@
  *  The client is responsible for subclassing, and instantiating this. The
  *  instance is create for a specific font+size+matrix.
  */
-class GrFontScaler : public GrRefCnt {
+class GrFontScaler : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrFontScaler)
 
@@ -32,7 +32,7 @@
     virtual bool getGlyphPath(uint16_t glyphID, SkPath*) = 0;
 
 private:
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/include/gpu/GrKey.h b/include/gpu/GrKey.h
index 80eb537..e9d6feb 100644
--- a/include/gpu/GrKey.h
+++ b/include/gpu/GrKey.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2010 Google Inc.
  *
@@ -6,14 +5,10 @@
  * found in the LICENSE file.
  */
 
-
-
 #ifndef GrKey_DEFINED
 #define GrKey_DEFINED
 
-#include "GrRefCnt.h"
-
-class GrKey : public GrRefCnt {
+class GrKey : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrKey)
 
@@ -37,7 +32,7 @@
 private:
     const Hash fHash;
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/include/gpu/GrPathRendererChain.h b/include/gpu/GrPathRendererChain.h
index d51a4bb..ca8c35b 100644
--- a/include/gpu/GrPathRendererChain.h
+++ b/include/gpu/GrPathRendererChain.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2011 Google Inc.
  *
@@ -6,11 +5,10 @@
  * found in the LICENSE file.
  */
 
-
 #ifndef GrPathRendererChain_DEFINED
 #define GrPathRendererChain_DEFINED
 
-#include "GrRefCnt.h"
+#include "SkRefCnt.h"
 #include "SkTArray.h"
 
 class GrContext;
@@ -64,7 +62,6 @@
                                     StencilSupport* stencilSupport);
 
 private:
-
     GrPathRendererChain();
 
     void init();
@@ -79,5 +76,4 @@
     typedef SkRefCnt INHERITED;
 };
 
-
 #endif
diff --git a/include/gpu/GrRefCnt.h b/include/gpu/GrRefCnt.h
deleted file mode 100644
index 31aa80d..0000000
--- a/include/gpu/GrRefCnt.h
+++ /dev/null
@@ -1,33 +0,0 @@
-
-/*
- * Copyright 2010 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-
-#ifndef GrRefCnt_DEFINED
-#define GrRefCnt_DEFINED
-
-#include "GrTypes.h"
-#include "SkRefCnt.h"
-
-typedef SkRefCnt GrRefCnt;
-typedef SkAutoRef GrAutoRef;
-typedef SkAutoUnref GrAutoUnref;
-
-#define GrSafeRef SkSafeRef
-#define GrSafeUnref SkSafeUnref
-#define GrSafeAssign(a, b)  SkRefCnt_SafeAssign(a, b)
-
-template<typename T>
-static inline void GrSafeSetNull(T*& obj) {
-    if (NULL != obj) {
-        obj->unref();
-        obj = NULL;
-    }
-}
-
-#endif
diff --git a/include/gpu/GrResource.h b/include/gpu/GrResource.h
index c52fa04..836c215 100644
--- a/include/gpu/GrResource.h
+++ b/include/gpu/GrResource.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2011 Google Inc.
  *
@@ -6,12 +5,10 @@
  * found in the LICENSE file.
  */
 
-
 #ifndef GrResource_DEFINED
 #define GrResource_DEFINED
 
-#include "GrRefCnt.h"
-
+#include "SkRefCnt.h"
 #include "SkTInternalLList.h"
 
 class GrGpu;
@@ -21,7 +18,7 @@
 /**
  * Base class for the GPU resources created by a GrContext.
  */
-class GrResource : public GrRefCnt {
+class GrResource : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrResource)
 
@@ -111,7 +108,7 @@
     };
     uint32_t         fFlags;
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/include/gpu/gl/GrGLInterface.h b/include/gpu/gl/GrGLInterface.h
index b4d3f79..44a9c7c 100644
--- a/include/gpu/gl/GrGLInterface.h
+++ b/include/gpu/gl/GrGLInterface.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2011 Google Inc.
  *
@@ -6,12 +5,11 @@
  * found in the LICENSE file.
  */
 
-
 #ifndef GrGLInterface_DEFINED
 #define GrGLInterface_DEFINED
 
 #include "GrGLFunctions.h"
-#include "GrRefCnt.h"
+#include "SkRefCnt.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -110,7 +108,7 @@
  * non-NULL or GrContext creation will fail. This can be tested with the
  * validate() method when the OpenGL context has been made current.
  */
-struct SK_API GrGLInterface : public GrRefCnt {
+struct SK_API GrGLInterface : public SkRefCnt {
 private:
     // simple wrapper class that exists only to initialize a pointer to NULL
     template <typename FNPTR_TYPE> class GLPtr {
@@ -122,7 +120,7 @@
         FNPTR_TYPE fPtr;
     };
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 
 public:
     SK_DECLARE_INST_COUNT(GrGLInterface)
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index b104df5..8d5851f 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -6,7 +6,6 @@
  */
 
 #include "GrAARectRenderer.h"
-#include "GrRefCnt.h"
 #include "GrGpu.h"
 #include "gl/GrGLEffect.h"
 #include "GrTBackendEffectFactory.h"
@@ -295,8 +294,8 @@
 };
 
 void GrAARectRenderer::reset() {
-    GrSafeSetNull(fAAFillRectIndexBuffer);
-    GrSafeSetNull(fAAStrokeRectIndexBuffer);
+    SkSafeSetNull(fAAFillRectIndexBuffer);
+    SkSafeSetNull(fAAStrokeRectIndexBuffer);
 }
 
 static const uint16_t gFillAARectIdx[] = {
diff --git a/src/gpu/GrAARectRenderer.h b/src/gpu/GrAARectRenderer.h
index 607329a..2e705ca 100644
--- a/src/gpu/GrAARectRenderer.h
+++ b/src/gpu/GrAARectRenderer.h
@@ -5,13 +5,12 @@
  * found in the LICENSE file.
  */
 
-
 #ifndef GrAARectRenderer_DEFINED
 #define GrAARectRenderer_DEFINED
 
-#include "GrRefCnt.h"
 #include "SkMatrix.h"
 #include "SkRect.h"
+#include "SkRefCnt.h"
 
 class GrGpu;
 class GrDrawTarget;
@@ -20,7 +19,7 @@
 /*
  * This class wraps helper functions that draw AA rects (filled & stroked)
  */
-class GrAARectRenderer : public GrRefCnt {
+class GrAARectRenderer : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrAARectRenderer)
 
@@ -108,7 +107,7 @@
                               const SkRect& devInside,
                               bool useVertexCoverage);
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 #endif // GrAARectRenderer_DEFINED
diff --git a/src/gpu/GrAtlas.cpp b/src/gpu/GrAtlas.cpp
index 865478b..ca46e8a 100644
--- a/src/gpu/GrAtlas.cpp
+++ b/src/gpu/GrAtlas.cpp
@@ -170,7 +170,7 @@
 
 GrAtlasMgr::~GrAtlasMgr() {
     for (size_t i = 0; i < GR_ARRAY_COUNT(fTexture); i++) {
-        GrSafeUnref(fTexture[i]);
+        SkSafeUnref(fTexture[i]);
     }
     delete fPlotMgr;
 
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5145b29..d931de5 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -167,8 +167,8 @@
     fOvalRenderer->unref();
 
     fGpu->unref();
-    GrSafeUnref(fPathRendererChain);
-    GrSafeUnref(fSoftwarePathRenderer);
+    SkSafeUnref(fPathRendererChain);
+    SkSafeUnref(fSoftwarePathRenderer);
     fDrawState->unref();
 
     --THREAD_INSTANCE_COUNT;
@@ -186,8 +186,8 @@
 
     // a path renderer may be holding onto resources that
     // are now unusable
-    GrSafeSetNull(fPathRendererChain);
-    GrSafeSetNull(fSoftwarePathRenderer);
+    SkSafeSetNull(fPathRendererChain);
+    SkSafeSetNull(fSoftwarePathRenderer);
 
     delete fDrawBuffer;
     fDrawBuffer = NULL;
@@ -221,8 +221,8 @@
     fTextureCache->purgeAllUnlocked();
     fFontCache->freeAll();
     // a path renderer may be holding onto resources
-    GrSafeSetNull(fPathRendererChain);
-    GrSafeSetNull(fSoftwarePathRenderer);
+    SkSafeSetNull(fPathRendererChain);
+    SkSafeSetNull(fSoftwarePathRenderer);
 }
 
 size_t GrContext::getGpuTextureCacheBytes() const {
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index ef6cc46..bfc15b0 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -14,7 +14,6 @@
 #include "GrEffectStage.h"
 #include "GrPaint.h"
 #include "GrPoint.h"
-#include "GrRefCnt.h"
 #include "GrRenderTarget.h"
 #include "GrStencil.h"
 #include "GrTemplates.h"
@@ -25,7 +24,7 @@
 #include "SkMatrix.h"
 #include "SkXfermode.h"
 
-class GrDrawState : public GrRefCnt {
+class GrDrawState : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrDrawState)
 
@@ -675,7 +674,7 @@
                 fDrawState->setRenderTarget(fSavedTarget);
                 fDrawState = NULL;
             }
-            GrSafeSetNull(fSavedTarget);
+            SkSafeSetNull(fSavedTarget);
         }
 
         void set(GrDrawState* ds, GrRenderTarget* newTarget) {
@@ -1077,7 +1076,7 @@
      */
     void setVertexAttribs(const GrVertexAttrib attribs[], int count);
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index d242797..5b19546 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -1,4 +1,3 @@
-
 /*
  * Copyright 2010 Google Inc.
  *
@@ -6,20 +5,18 @@
  * found in the LICENSE file.
  */
 
-
 #ifndef GrDrawTarget_DEFINED
 #define GrDrawTarget_DEFINED
 
 #include "GrClipData.h"
 #include "GrDrawState.h"
 #include "GrIndexBuffer.h"
-#include "SkMatrix.h"
-#include "GrRefCnt.h"
 
 #include "SkClipStack.h"
+#include "SkMatrix.h"
 #include "SkPath.h"
-#include "SkTLazy.h"
 #include "SkTArray.h"
+#include "SkTLazy.h"
 #include "SkXfermode.h"
 
 class GrClipData;
@@ -28,7 +25,7 @@
 class GrVertexBuffer;
 class SkStrokeRec;
 
-class GrDrawTarget : public GrRefCnt {
+class GrDrawTarget : public SkRefCnt {
 protected:
     class DrawInfo;
 
@@ -869,7 +866,7 @@
     // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTarget.
     GrContext*                                                      fContext;
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp
index adcc3a3..a4aa00e 100644
--- a/src/gpu/GrGpu.cpp
+++ b/src/gpu/GrGpu.cpp
@@ -66,7 +66,7 @@
     }
 
     SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid());
-    GrSafeSetNull(fQuadIndexBuffer);
+    SkSafeSetNull(fQuadIndexBuffer);
     delete fVertexPool;
     fVertexPool = NULL;
     delete fIndexPool;
@@ -82,7 +82,7 @@
     }
 
     SkASSERT(NULL == fQuadIndexBuffer || !fQuadIndexBuffer->isValid());
-    GrSafeSetNull(fQuadIndexBuffer);
+    SkSafeSetNull(fQuadIndexBuffer);
     delete fVertexPool;
     fVertexPool = NULL;
     delete fIndexPool;
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index 2b3608d..239ae6b 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -9,7 +9,6 @@
 #define GrGpu_DEFINED
 
 #include "GrDrawTarget.h"
-#include "GrRefCnt.h"
 #include "GrClipMaskManager.h"
 #include "SkPath.h"
 
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index d04538d..1cd04d9 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -431,7 +431,7 @@
         // we always have a VB, but not always an IB
         SkASSERT(NULL != fDraws[d].fVertexBuffer);
         fDraws[d].fVertexBuffer->unref();
-        GrSafeUnref(fDraws[d].fIndexBuffer);
+        SkSafeUnref(fDraws[d].fIndexBuffer);
     }
     fCmds.reset();
     fDraws.reset();
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index 507be82..dcc5ab7 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -108,7 +108,7 @@
 
     struct Clear  : GrNoncopyable {
         Clear() : fRenderTarget(NULL) {}
-        ~Clear() { GrSafeUnref(fRenderTarget); }
+        ~Clear() { SkSafeUnref(fRenderTarget); }
 
         SkIRect         fRect;
         GrColor         fColor;
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 79c8e83..4f41ae9 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -464,7 +464,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 void GrOvalRenderer::reset() {
-    GrSafeSetNull(fRRectIndexBuffer);
+    SkSafeSetNull(fRRectIndexBuffer);
 }
 
 bool GrOvalRenderer::drawOval(GrDrawTarget* target, const GrContext* context, bool useAA,
diff --git a/src/gpu/GrOvalRenderer.h b/src/gpu/GrOvalRenderer.h
index 8c47e9a..b58abb7 100644
--- a/src/gpu/GrOvalRenderer.h
+++ b/src/gpu/GrOvalRenderer.h
@@ -10,7 +10,6 @@
 
 #include "GrContext.h"
 #include "GrPaint.h"
-#include "GrRefCnt.h"
 
 class GrContext;
 class GrDrawTarget;
@@ -21,7 +20,7 @@
 /*
  * This class wraps helper functions that draw ovals and roundrects (filled & stroked)
  */
-class GrOvalRenderer : public GrRefCnt {
+class GrOvalRenderer : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrOvalRenderer)
 
@@ -52,7 +51,7 @@
 
     GrIndexBuffer* fRRectIndexBuffer;
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 #endif // GrOvalRenderer_DEFINED
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index c49dd48..f86eb9f 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -27,7 +27,7 @@
  *  stages before GrPaint::kTotalStages are reserved for setting up the draw (i.e., textures and
  *  filter masks).
  */
-class SK_API GrPathRenderer : public GrRefCnt {
+class SK_API GrPathRenderer : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrPathRenderer)
 
@@ -192,7 +192,7 @@
 
 private:
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/src/gpu/GrTextContext.cpp b/src/gpu/GrTextContext.cpp
index 646ad02..e4303c1 100644
--- a/src/gpu/GrTextContext.cpp
+++ b/src/gpu/GrTextContext.cpp
@@ -67,7 +67,7 @@
         fVertices = NULL;
         fMaxVertices = 0;
         fCurrVertex = 0;
-        GrSafeSetNull(fCurrTexture);
+        SkSafeSetNull(fCurrTexture);
     }
 }
 
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index 9ef9a54..d3214a7 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -231,7 +231,7 @@
         return true;
     }
 
-    GrAutoRef ar(scaler);
+    SkAutoRef ar(scaler);
 
     int bytesPerPixel = GrMaskFormatBytesPerPixel(fMaskFormat);
     size_t size = glyph->fBounds.area() * bytesPerPixel;
diff --git a/src/gpu/SkGrFontScaler.cpp b/src/gpu/SkGrFontScaler.cpp
index c48e633..3c42af8 100644
--- a/src/gpu/SkGrFontScaler.cpp
+++ b/src/gpu/SkGrFontScaler.cpp
@@ -73,7 +73,7 @@
 }
 
 SkGrFontScaler::~SkGrFontScaler() {
-    GrSafeUnref(fKey);
+    SkSafeUnref(fKey);
 }
 
 GrMaskFormat SkGrFontScaler::getMaskFormat() {
diff --git a/src/gpu/SkGrPixelRef.cpp b/src/gpu/SkGrPixelRef.cpp
index 98819bf..dc5d755 100644
--- a/src/gpu/SkGrPixelRef.cpp
+++ b/src/gpu/SkGrPixelRef.cpp
@@ -94,7 +94,7 @@
 #endif
 
     SkGrPixelRef* pixelRef = SkNEW_ARGS(SkGrPixelRef, (dst));
-    GrSafeUnref(dst);
+    SkSafeUnref(dst);
     return pixelRef;
 }
 
@@ -114,7 +114,7 @@
         fSurface = surface;
     }
     fUnlock = transferCacheLock;
-    GrSafeRef(surface);
+    SkSafeRef(surface);
 }
 
 SkGrPixelRef::~SkGrPixelRef() {
@@ -125,7 +125,7 @@
             context->unlockScratchTexture(texture);
         }
     }
-    GrSafeUnref(fSurface);
+    SkSafeUnref(fSurface);
 }
 
 GrTexture* SkGrPixelRef::getTexture() {
diff --git a/src/gpu/gl/GrGLContext.cpp b/src/gpu/gl/GrGLContext.cpp
index 1d0a01f..93f3691 100644
--- a/src/gpu/gl/GrGLContext.cpp
+++ b/src/gpu/gl/GrGLContext.cpp
@@ -73,13 +73,13 @@
 }
 
 GrGLContext& GrGLContext::operator = (const GrGLContext& ctx) {
-    GrSafeAssign(fInterface, ctx.fInterface);
+    SkRefCnt_SafeAssign(fInterface, ctx.fInterface);
     fInfo = ctx.fInfo;
     return *this;
 }
 
 void GrGLContext::reset() {
-    GrSafeSetNull(fInterface);
+    SkSafeSetNull(fInterface);
     fInfo.reset();
 }
 
diff --git a/src/gpu/gl/GrGLContext.h b/src/gpu/gl/GrGLContext.h
index 34f2190..ac9e9ed 100644
--- a/src/gpu/gl/GrGLContext.h
+++ b/src/gpu/gl/GrGLContext.h
@@ -101,7 +101,7 @@
      */
     GrGLContext(const GrGLContext& ctx);
 
-    ~GrGLContext() { GrSafeUnref(fInterface); }
+    ~GrGLContext() { SkSafeUnref(fInterface); }
 
     /**
      * Copies a GrGLContext
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index bef2ecf..b18b8ae 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -33,7 +33,7 @@
  * Uniforms are program-local so we can't rely on fHWState to hold the
  * previous uniform state after a program change.
  */
-class GrGLProgram : public GrRefCnt {
+class GrGLProgram : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrGLProgram)
 
@@ -235,7 +235,7 @@
     GrGLUniformManager          fUniformManager;
     UniformHandles              fUniformHandles;
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index e41ebc8..62052fd 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -15,7 +15,7 @@
 /**
  * A ref counted tex id that deletes the texture in its destructor.
  */
-class GrGLTexID : public GrRefCnt {
+class GrGLTexID : public SkRefCnt {
 public:
     SK_DECLARE_INST_COUNT(GrGLTexID)
 
@@ -39,7 +39,7 @@
     GrGLuint             fTexID;
     bool                 fIsWrapped;
 
-    typedef GrRefCnt INHERITED;
+    typedef SkRefCnt INHERITED;
 };
 
 ////////////////////////////////////////////////////////////////////////////////
diff --git a/tests/ClipCacheTest.cpp b/tests/ClipCacheTest.cpp
index c3801d7..9407688 100644
--- a/tests/ClipCacheTest.cpp
+++ b/tests/ClipCacheTest.cpp
@@ -58,7 +58,7 @@
         return;
     }
 
-    GrAutoUnref au(texture);
+    SkAutoUnref au(texture);
 
     SkIRect intScreen = SkIRect::MakeWH(kXSize, kYSize);
     SkRect screen;
diff --git a/tests/ReadWriteAlphaTest.cpp b/tests/ReadWriteAlphaTest.cpp
index 8ae936e..fb177df 100644
--- a/tests/ReadWriteAlphaTest.cpp
+++ b/tests/ReadWriteAlphaTest.cpp
@@ -46,7 +46,7 @@
             return;
         }
 
-        GrAutoUnref au(texture);
+        SkAutoUnref au(texture);
 
         // create a distinctive texture
         for (int y = 0; y < Y_SIZE; ++y) {