Version 2 of the Instance Counting system. This one simplifies the print out of information.

http://codereview.appspot.com/6296069/



git-svn-id: http://skia.googlecode.com/svn/trunk@4255 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkPathHeap.cpp b/src/core/SkPathHeap.cpp
index a9183c3..8713e76 100644
--- a/src/core/SkPathHeap.cpp
+++ b/src/core/SkPathHeap.cpp
@@ -11,6 +11,8 @@
 #include "SkFlattenable.h"
 #include <new>
 
+SK_DEFINE_INST_COUNT(SkPathHeap)
+
 #define kPathCount  64
 
 SkPathHeap::SkPathHeap() : fHeap(kPathCount * sizeof(SkPath)) {
diff --git a/src/core/SkPathHeap.h b/src/core/SkPathHeap.h
index 99c2626..32adbc0 100644
--- a/src/core/SkPathHeap.h
+++ b/src/core/SkPathHeap.h
@@ -18,8 +18,10 @@
 
 class SkPathHeap : public SkRefCnt {
 public:
-            SkPathHeap();
-            SkPathHeap(SkFlattenableReadBuffer&);
+    SK_DECLARE_INST_COUNT(SkPathHeap)
+
+    SkPathHeap();
+    SkPathHeap(SkFlattenableReadBuffer&);
     virtual ~SkPathHeap();
 
     /** Copy the path into the heap, and return the new total number of paths.
@@ -41,6 +43,8 @@
     SkChunkAlloc        fHeap;
     // we just store ptrs into fHeap here
     SkTDArray<SkPath*>  fPaths;
+
+    typedef SkRefCnt INHERITED;
 };
 
 #endif
diff --git a/src/core/SkRefCnt.cpp b/src/core/SkRefCnt.cpp
index 111ecd8..599e7f2 100644
--- a/src/core/SkRefCnt.cpp
+++ b/src/core/SkRefCnt.cpp
@@ -1,12 +1,12 @@
-/*

- * Copyright 2012 Google Inc.

- *

- * Use of this source code is governed by a BSD-style license that can be

- * found in the LICENSE file.

+/*
+ * Copyright 2012 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
  */
 
 
 #include "SkRefCnt.h"
 
-DEFINE_INST_COUNT(SkRefCnt)
+SK_DEFINE_INST_COUNT(SkRefCnt)
 
diff --git a/src/gpu/GrAARectRenderer.cpp b/src/gpu/GrAARectRenderer.cpp
index 3eca362..a771532 100644
--- a/src/gpu/GrAARectRenderer.cpp
+++ b/src/gpu/GrAARectRenderer.cpp
@@ -9,7 +9,7 @@
 #include "GrRefCnt.h"
 #include "GrGpu.h"
 
-DEFINE_INST_COUNT(GrAARectRenderer)
+SK_DEFINE_INST_COUNT(GrAARectRenderer)
 
 namespace {
 
diff --git a/src/gpu/GrPathRendererChain.cpp b/src/gpu/GrPathRendererChain.cpp
index 00f0b81..648225e 100644
--- a/src/gpu/GrPathRendererChain.cpp
+++ b/src/gpu/GrPathRendererChain.cpp
@@ -13,6 +13,8 @@
 #include "GrDefaultPathRenderer.h"
 #include "GrGpu.h"
 
+SK_DEFINE_INST_COUNT(GrPathRendererChain)
+
 GrPathRendererChain::GrPathRendererChain(GrContext* context, UsageFlags flags)
     : fInit(false)
     , fOwner(context)
diff --git a/src/gpu/GrPathRendererChain.h b/src/gpu/GrPathRendererChain.h
index 529b4cb..e5ccabb 100644
--- a/src/gpu/GrPathRendererChain.h
+++ b/src/gpu/GrPathRendererChain.h
@@ -27,6 +27,7 @@
  */
 class GrPathRendererChain : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(GrPathRendererChain)
 
     enum UsageFlags {
         kNone_UsageFlag      = 0,
@@ -58,6 +59,8 @@
     GrContext*                                          fOwner;
     UsageFlags                                          fFlags;
     SkSTArray<kPreAllocCount, GrPathRenderer*, true>    fChain;
+
+    typedef SkRefCnt INHERITED;
 };
 
 GR_MAKE_BITFIELD_OPS(GrPathRendererChain::UsageFlags)
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index be08444..071c885 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -13,6 +13,8 @@
 #include "GrGpu.h"
 #include "GrStencilBuffer.h"
 
+SK_DEFINE_INST_COUNT(GrRenderTarget)
+
 bool GrRenderTarget::readPixels(int left, int top, int width, int height,
                                 GrPixelConfig config, void* buffer,
                                 size_t rowBytes) {
diff --git a/src/gpu/GrResource.cpp b/src/gpu/GrResource.cpp
index a5168c8..7e2d4a8 100644
--- a/src/gpu/GrResource.cpp
+++ b/src/gpu/GrResource.cpp
@@ -10,7 +10,7 @@
 #include "GrResource.h"
 #include "GrGpu.h"
 
-DEFINE_INST_COUNT(GrResource)
+SK_DEFINE_INST_COUNT(GrResource)
 
 GrResource::GrResource(GrGpu* gpu) {
     fGpu        = gpu;
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 4f4c5f5..67ce629 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -14,6 +14,8 @@
 #include "GrRenderTarget.h"
 #include "GrResourceCache.h"
 
+SK_DEFINE_INST_COUNT(GrTexture)
+
 bool GrTexture::readPixels(int left, int top, int width, int height,
                            GrPixelConfig config, void* buffer,
                            size_t rowBytes) {
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index 5a0ede8..b367318 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -17,6 +17,8 @@
     #define SNPRINTF    snprintf
 #endif
 
+SK_DEFINE_INST_COUNT(SkPDFObject)
+
 SkPDFObject::SkPDFObject() {}
 SkPDFObject::~SkPDFObject() {}
 
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index 6334938..d5fe4ae 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -27,6 +27,8 @@
 */
 class SkPDFObject : public SkRefCnt {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFObject)
+
     /** Create a PDF object.
      */
     SkPDFObject();
@@ -91,6 +93,8 @@
      */
     virtual void emitObject(SkWStream* stream, SkPDFCatalog* catalog,
                             bool indirect) = 0;
+
+        typedef SkRefCnt INHERITED;
 };
 
 /** \class SkPDFObjRef