plumb SkInstCnt to all subclasses of GrRefCnt



git-svn-id: http://skia.googlecode.com/svn/trunk@4353 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 6a6b084..f5b44bf 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -36,6 +36,8 @@
 
 class GR_API GrContext : public GrRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(GrContext)
+
     /**
      * Creates a GrContext from within a 3D context.
      */
@@ -787,6 +789,8 @@
     // Add an existing texture to the texture cache. This is intended solely
     // for use with textures released from an GrAutoScratchTexture.
     void addExistingTextureToCache(GrTexture* texture);
+
+    typedef GrRefCnt INHERITED;
 };
 
 /**
diff --git a/include/gpu/GrFontScaler.h b/include/gpu/GrFontScaler.h
index 657647d..a69e912 100644
--- a/include/gpu/GrFontScaler.h
+++ b/include/gpu/GrFontScaler.h
@@ -25,12 +25,17 @@
  */
 class GrFontScaler : public GrRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(GrFontScaler)
+
     virtual const GrKey* getKey() = 0;
     virtual GrMaskFormat getMaskFormat() = 0;
     virtual bool getPackedGlyphBounds(GrGlyph::PackedID, GrIRect* bounds) = 0;
     virtual bool getPackedGlyphImage(GrGlyph::PackedID, int width, int height,
                                      int rowBytes, void* image) = 0;
     virtual bool getGlyphPath(uint16_t glyphID, SkPath*) = 0;
+
+private:
+    typedef GrRefCnt INHERITED;
 };
 
 #endif
diff --git a/include/gpu/GrKey.h b/include/gpu/GrKey.h
index 813d82d..17d00de 100644
--- a/include/gpu/GrKey.h
+++ b/include/gpu/GrKey.h
@@ -15,6 +15,8 @@
 
 class GrKey : public GrRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(GrKey)
+
     typedef intptr_t Hash;
 
     explicit GrKey(Hash hash) : fHash(hash) {}
@@ -34,6 +36,8 @@
 
 private:
     const Hash fHash;
+
+    typedef GrRefCnt INHERITED;
 };
 
 #endif
diff --git a/include/gpu/GrTextContext.h b/include/gpu/GrTextContext.h
index ab1a344..f48b823 100644
--- a/include/gpu/GrTextContext.h
+++ b/include/gpu/GrTextContext.h
@@ -32,6 +32,8 @@
     GrContext*      fContext;
 
 public:
+    SK_DECLARE_INST_COUNT(GrTextContext)
+
     /**
      * To use a text context it must be wrapped in an AutoFinish. AutoFinish's
      * destructor ensures all drawing is flushed to the GrContext.
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index a7d9b67..0760799 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -27,6 +27,9 @@
 #include "SkTLS.h"
 #include "SkTrace.h"
 
+SK_DEFINE_INST_COUNT(GrContext)
+SK_DEFINE_INST_COUNT(GrDrawState)
+
 #define DEFER_TEXT_RENDERING 1
 
 #define DEFER_PATHS 1
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 61925cd..e4a748f 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -21,8 +21,9 @@
 
 
 class GrDrawState : public GrRefCnt {
-
 public:
+    SK_DECLARE_INST_COUNT(GrDrawState)
+    
     /**
      * Number of texture stages. Each stage takes as input a color and
      * 2D texture coordinates. The color input to the first enabled stage is the
@@ -879,6 +880,7 @@
     // only compared if the color matrix enable flag is set
     float               fColorMatrix[20];       // 5 x 4 matrix
 
+    typedef GrRefCnt INHERITED;
 };
 
 #endif
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 39ea5bf..64dc815 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -15,6 +15,8 @@
 #include "GrTexture.h"
 #include "GrVertexBuffer.h"
 
+SK_DEFINE_INST_COUNT(GrDrawTarget)
+
 namespace {
 
 /**
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index f619469..d42a1f9 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -27,6 +27,8 @@
 
 class GrDrawTarget : public GrRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(GrDrawTarget)
+
     /**
      * Represents the draw target capabilities.
      */
@@ -1065,7 +1067,8 @@
     };
     SkSTArray<kPreallocGeoSrcStateStackCnt, 
               GeometrySrcState, true>           fGeoSrcStateStack;
-    
+
+    typedef GrRefCnt INHERITED;
 };
 
 GR_MAKE_BITFIELD_OPS(GrDrawTarget::BlendOptFlags);
diff --git a/src/gpu/GrPathRenderer.cpp b/src/gpu/GrPathRenderer.cpp
index 31e06a6..1daa6c9 100644
--- a/src/gpu/GrPathRenderer.cpp
+++ b/src/gpu/GrPathRenderer.cpp
@@ -8,6 +8,8 @@
 
 #include "GrPathRenderer.h"
 
+SK_DEFINE_INST_COUNT(GrPathRenderer)
+
 GrPathRenderer::GrPathRenderer() {
 }
 
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index 4439f6c..32985be 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -28,6 +28,7 @@
  */
 class GR_API GrPathRenderer : public GrRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(GrPathRenderer)
 
     /**
      * This is called to install custom path renderers in every GrContext at
diff --git a/src/gpu/GrTextStrike.cpp b/src/gpu/GrTextStrike.cpp
index b8762ad..e61c46e 100644
--- a/src/gpu/GrTextStrike.cpp
+++ b/src/gpu/GrTextStrike.cpp
@@ -15,6 +15,11 @@
 #include "GrTextStrike_impl.h"
 #include "GrRect.h"
 
+SK_DEFINE_INST_COUNT(GrFontScaler)
+SK_DEFINE_INST_COUNT(GrKey)
+
+///////////////////////////////////////////////////////////////////////////////
+
 GrFontCache::GrFontCache(GrGpu* gpu) : fGpu(gpu) {
     gpu->ref();
     fAtlasMgr = NULL;
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index d3ca0b5..c033f01 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -23,6 +23,8 @@
 #include "SkTLazy.h"
 #include "SkUtils.h"
 
+SK_DEFINE_INST_COUNT(GrTextContext)
+
 #define CACHE_COMPATIBLE_DEVICE_TEXTURES 1
 
 #if 0
diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp
index 476d3e7..9c6743a 100644
--- a/src/gpu/gl/GrGLTexture.cpp
+++ b/src/gpu/gl/GrGLTexture.cpp
@@ -5,11 +5,11 @@
  * found in the LICENSE file.
  */
 
-
 #include "GrGLTexture.h"
-
 #include "GrGpuGL.h"
 
+SK_DEFINE_INST_COUNT(GrGLTexID)
+
 #define GPUGL static_cast<GrGpuGL*>(getGpu())
 
 #define GL_CALL(X) GR_GL_CALL(GPUGL->glInterface(), X)
diff --git a/src/gpu/gl/GrGLTexture.h b/src/gpu/gl/GrGLTexture.h
index e408e5d..8e8c8c5 100644
--- a/src/gpu/gl/GrGLTexture.h
+++ b/src/gpu/gl/GrGLTexture.h
@@ -16,8 +16,9 @@
  * A ref counted tex id that deletes the texture in its destructor.
  */
 class GrGLTexID : public GrRefCnt {
-
 public:
+    SK_DECLARE_INST_COUNT(GrGLTexID)
+
     GrGLTexID(const GrGLInterface* gl, GrGLuint texID, bool ownsID)
         : fGL(gl)
         , fTexID(texID)
@@ -37,6 +38,8 @@
     const GrGLInterface* fGL;
     GrGLuint             fTexID;
     bool                 fOwnsID;
+
+    typedef GrRefCnt INHERITED;
 };
 
 ////////////////////////////////////////////////////////////////////////////////