stick SkInstCnt in more classes, to help track down leaks



git-svn-id: http://skia.googlecode.com/svn/trunk@4341 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 58f5443..5a7dd96 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -19,7 +19,6 @@
 public:
     SK_DECLARE_INST_COUNT(SkStream)
 
-    virtual ~SkStream();
     /** Called to rewind to the beginning of the stream. If this cannot be
         done, return false.
     */
@@ -72,6 +71,8 @@
 
 class SK_API SkWStream : SkNoncopyable {
 public:
+    SK_DECLARE_INST_COUNT_ROOT(SkWStream)
+
     virtual ~SkWStream();
 
     /** Called to write bytes to a SkWStream. Returns true on success
@@ -115,6 +116,8 @@
  */
 class SkFILEStream : public SkStream {
 public:
+    SK_DECLARE_INST_COUNT(SkFILEStream)
+
     /** Initialize the stream by calling fopen on the specified path. Will be
         closed in the destructor.
      */
@@ -136,12 +139,16 @@
 private:
     SkFILE*     fFILE;
     SkString    fName;
+
+    typedef SkStream INHERITED;
 };
 
 /** A stream that reads from a file descriptor
  */
 class SkFDStream : public SkStream {
 public:
+    SK_DECLARE_INST_COUNT(SkFDStream)
+
     /** Initialize the stream with a dup() of the specified file descriptor.
         If closeWhenDone is true, then the descriptor will be closed in the
         destructor.
@@ -160,10 +167,14 @@
 private:
     int     fFD;
     bool    fCloseWhenDone;
+
+    typedef SkStream INHERITED;
 };
 
 class SkMemoryStream : public SkStream {
 public:
+    SK_DECLARE_INST_COUNT(SkMemoryStream)
+
     SkMemoryStream();
     /** We allocate (and free) the memory. Write to it via getMemoryBase()
     */
@@ -209,6 +220,8 @@
 private:
     SkData* fData;
     size_t  fOffset;
+
+    typedef SkStream INHERITED;
 };
 
 /** \class SkBufferStream
@@ -218,6 +231,8 @@
 */
 class SkBufferStream : public SkStream {
 public:
+    SK_DECLARE_INST_COUNT(SkBufferStream)
+
     /** Provide the stream to be buffered (proxy), and the size of the buffer that
         should be used. This will be allocated and freed automatically. If bufferSize is 0,
         a default buffer size will be used.
@@ -254,13 +269,17 @@
     bool        fWeOwnTheBuffer;
 
     void    init(void*, size_t);
+
+    typedef SkStream INHERITED;
 };
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 
 class SkFILEWStream : public SkWStream {
 public:
-            SkFILEWStream(const char path[]);
+    SK_DECLARE_INST_COUNT(SkFILEWStream)
+
+    SkFILEWStream(const char path[]);
     virtual ~SkFILEWStream();
 
     /** Returns true if the current path could be opened.
@@ -269,12 +288,17 @@
 
     virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
     virtual void flush() SK_OVERRIDE;
+
 private:
     SkFILE* fFILE;
+
+    typedef SkWStream INHERITED;
 };
 
 class SkMemoryWStream : public SkWStream {
 public:
+    SK_DECLARE_INST_COUNT(SkMemoryWStream)
+
     SkMemoryWStream(void* buffer, size_t size);
     virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
     size_t bytesWritten() const { return fBytesWritten; }
@@ -283,10 +307,14 @@
     char*   fBuffer;
     size_t  fMaxLength;
     size_t  fBytesWritten;
+
+    typedef SkWStream INHERITED;
 };
 
 class SK_API SkDynamicMemoryWStream : public SkWStream {
 public:
+    SK_DECLARE_INST_COUNT(SkDynamicMemoryWStream)
+
     SkDynamicMemoryWStream();
     virtual ~SkDynamicMemoryWStream();
 
@@ -318,14 +346,21 @@
     mutable SkData* fCopy;  // is invalidated if we write after it is created
 
     void invalidateCopy();
+
+    typedef SkWStream INHERITED;
 };
 
 
 class SkDebugWStream : public SkWStream {
 public:
+    SK_DECLARE_INST_COUNT(SkDebugWStream)
+
     // overrides
     virtual bool write(const void* buffer, size_t size) SK_OVERRIDE;
     virtual void newline() SK_OVERRIDE;
+
+private:
+    typedef SkWStream INHERITED;
 };
 
 // for now
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp
index 45eb183..c137167 100644
--- a/src/core/SkStream.cpp
+++ b/src/core/SkStream.cpp
@@ -14,8 +14,17 @@
 #include "SkOSFile.h"
 
 SK_DEFINE_INST_COUNT(SkStream)
+SK_DEFINE_INST_COUNT(SkWStream)
+SK_DEFINE_INST_COUNT(SkFILEStream)
+SK_DEFINE_INST_COUNT(SkFDStream)
+SK_DEFINE_INST_COUNT(SkMemoryStream)
+SK_DEFINE_INST_COUNT(SkBufferStream)
+SK_DEFINE_INST_COUNT(SkFILEWStream)
+SK_DEFINE_INST_COUNT(SkMemoryWStream)
+SK_DEFINE_INST_COUNT(SkDynamicMemoryWStream)
+SK_DEFINE_INST_COUNT(SkDebugWStream)
 
-SkStream::~SkStream() {}
+///////////////////////////////////////////////////////////////////////////////
 
 const char* SkStream::getFileName()
 {
diff --git a/src/pdf/SkPDFTypes.cpp b/src/pdf/SkPDFTypes.cpp
index b367318..210e15e 100644
--- a/src/pdf/SkPDFTypes.cpp
+++ b/src/pdf/SkPDFTypes.cpp
@@ -17,10 +17,17 @@
     #define SNPRINTF    snprintf
 #endif
 
+SK_DEFINE_INST_COUNT(SkPDFArray)
+SK_DEFINE_INST_COUNT(SkPDFBool)
+SK_DEFINE_INST_COUNT(SkPDFDict)
+SK_DEFINE_INST_COUNT(SkPDFInt)
+SK_DEFINE_INST_COUNT(SkPDFName)
 SK_DEFINE_INST_COUNT(SkPDFObject)
+SK_DEFINE_INST_COUNT(SkPDFObjRef)
+SK_DEFINE_INST_COUNT(SkPDFScalar)
+SK_DEFINE_INST_COUNT(SkPDFString)
 
-SkPDFObject::SkPDFObject() {}
-SkPDFObject::~SkPDFObject() {}
+///////////////////////////////////////////////////////////////////////////////
 
 void SkPDFObject::emit(SkWStream* stream, SkPDFCatalog* catalog,
                        bool indirect) {
diff --git a/src/pdf/SkPDFTypes.h b/src/pdf/SkPDFTypes.h
index d5fe4ae..7d24940 100644
--- a/src/pdf/SkPDFTypes.h
+++ b/src/pdf/SkPDFTypes.h
@@ -29,11 +29,6 @@
 public:
     SK_DECLARE_INST_COUNT(SkPDFObject)
 
-    /** Create a PDF object.
-     */
-    SkPDFObject();
-    virtual ~SkPDFObject();
-
     /** Return the size (number of bytes) of this object in the final output
      *  file. Compound objects or objects that are computationally intensive
      *  to output should override this method.
@@ -103,6 +98,8 @@
 */
 class SkPDFObjRef : public SkPDFObject {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFObjRef)
+
     /** Create a reference to an existing SkPDFObject.
      *  @param obj The object to reference.
      */
@@ -116,6 +113,8 @@
 
 private:
     SkRefPtr<SkPDFObject> fObj;
+    
+    typedef SkPDFObject INHERITED;
 };
 
 /** \class SkPDFInt
@@ -124,6 +123,8 @@
 */
 class SkPDFInt : public SkPDFObject {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFInt)
+
     /** Create a PDF integer (usually for indirect reference purposes).
      *  @param value An integer value between 2^31 - 1 and -2^31.
      */
@@ -136,6 +137,8 @@
 
 private:
     int32_t fValue;
+    
+    typedef SkPDFObject INHERITED;
 };
 
 /** \class SkPDFBool
@@ -144,6 +147,8 @@
 */
 class SkPDFBool : public SkPDFObject {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFBool)
+
     /** Create a PDF boolean.
      *  @param value true or false.
      */
@@ -157,6 +162,8 @@
 
 private:
     bool fValue;
+    
+    typedef SkPDFObject INHERITED;
 };
 
 /** \class SkPDFScalar
@@ -165,6 +172,8 @@
 */
 class SkPDFScalar : public SkPDFObject {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFScalar)
+
     /** Create a PDF real number.
      *  @param value A real value.
      */
@@ -179,6 +188,8 @@
 
 private:
     SkScalar fValue;
+    
+    typedef SkPDFObject INHERITED;
 };
 
 /** \class SkPDFString
@@ -187,6 +198,8 @@
 */
 class SkPDFString : public SkPDFObject {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFString)
+
     /** Create a PDF string. Maximum length (in bytes) is 65,535.
      *  @param value A string value.
      */
@@ -217,6 +230,8 @@
 
     static SkString DoFormatString(const void* input, size_t len,
                                  bool wideInput, bool wideOutput);
+
+    typedef SkPDFObject INHERITED;
 };
 
 /** \class SkPDFName
@@ -225,6 +240,8 @@
 */
 class SkPDFName : public SkPDFObject {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFName)
+
     /** Create a PDF name object. Maximum length is 127 bytes.
      *  @param value The name.
      */
@@ -245,6 +262,8 @@
     const SkString fValue;
 
     static SkString FormatName(const SkString& input);
+    
+    typedef SkPDFObject INHERITED;
 };
 
 /** \class SkPDFArray
@@ -253,6 +272,8 @@
 */
 class SkPDFArray : public SkPDFObject {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFArray)
+
     /** Create a PDF array. Maximum length is 8191.
      */
     SkPDFArray();
@@ -308,6 +329,8 @@
 private:
     static const int kMaxLen = 8191;
     SkTDArray<SkPDFObject*> fValue;
+    
+    typedef SkPDFObject INHERITED;
 };
 
 /** \class SkPDFDict
@@ -316,6 +339,8 @@
 */
 class SkPDFDict : public SkPDFObject {
 public:
+    SK_DECLARE_INST_COUNT(SkPDFDict)
+
     /** Create a PDF dictionary. Maximum number of entries is 4095.
      */
     SkPDFDict();
@@ -402,6 +427,8 @@
     static const int kMaxLen = 4095;
 
     SkTDArray<struct Rec> fValue;
+    
+    typedef SkPDFObject INHERITED;
 };
 
 #endif