aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-21 20:25:03 +0000
committerGravatar robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-06-21 20:25:03 +0000
commit15e9d3e66e161ce23df30bc13f8a0c87d196b463 (patch)
tree2cc4661f85d92a98de30e7bca582163321fc018d /include/core
parentc82a8b7aa4ec19fba508c394920a9e88d3e5bd12 (diff)
Expanded distribution of instance counting
Diffstat (limited to 'include/core')
-rwxr-xr-xinclude/core/SkAdvancedTypefaceMetrics.h5
-rw-r--r--include/core/SkBitmap.h4
-rw-r--r--include/core/SkBounder.h2
-rw-r--r--include/core/SkCanvas.h4
-rw-r--r--include/core/SkData.h4
-rw-r--r--include/core/SkDevice.h4
-rw-r--r--include/core/SkDeviceProfile.h4
-rw-r--r--include/core/SkDrawFilter.h3
-rw-r--r--include/core/SkFlattenable.h4
-rw-r--r--include/core/SkInstCnt.h11
-rw-r--r--include/core/SkPicture.h4
-rw-r--r--include/core/SkPtrRecorder.h2
-rw-r--r--include/core/SkStream.h5
-rw-r--r--include/core/SkWeakRefCnt.h2
14 files changed, 53 insertions, 5 deletions
diff --git a/include/core/SkAdvancedTypefaceMetrics.h b/include/core/SkAdvancedTypefaceMetrics.h
index 5ffdb459a8..d326379a50 100755
--- a/include/core/SkAdvancedTypefaceMetrics.h
+++ b/include/core/SkAdvancedTypefaceMetrics.h
@@ -26,6 +26,8 @@
class SkAdvancedTypefaceMetrics : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkAdvancedTypefaceMetrics)
+
SkString fFontName;
enum FontType {
@@ -112,6 +114,9 @@ public:
// The mapping from glyph to Unicode, only populated if
// kToUnicode_PerGlyphInfo is passed to GetAdvancedTypefaceMetrics.
SkTDArray<SkUnichar> fGlyphToUnicode;
+
+private:
+ typedef SkRefCnt INHERITED;
};
namespace skia_advanced_typeface_metrics_utils {
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h
index 514357f6cc..8515b4601e 100644
--- a/include/core/SkBitmap.h
+++ b/include/core/SkBitmap.h
@@ -558,6 +558,8 @@ public:
class Allocator : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(Allocator)
+
/** Allocate the pixel memory for the bitmap, given its dimensions and
config. Return true on success, where success means either setPixels
or setPixelRef was called. The pixels need not be locked when this
@@ -566,6 +568,8 @@ public:
colortable should be left unchanged.
*/
virtual bool allocPixelRef(SkBitmap*, SkColorTable*) = 0;
+ private:
+ typedef SkRefCnt INHERITED;
};
/** Subclass of Allocator that returns a pixelref that allocates its pixel
diff --git a/include/core/SkBounder.h b/include/core/SkBounder.h
index 5bac358bfe..08cef2d59f 100644
--- a/include/core/SkBounder.h
+++ b/include/core/SkBounder.h
@@ -84,6 +84,8 @@ private:
friend class SkDrawIter;
friend struct Draw1Glyph;
friend class SkMaskFilter;
+
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index d942783a7f..fc95f9ae6c 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -44,6 +44,8 @@ class SkPicture;
*/
class SK_API SkCanvas : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkCanvas)
+
SkCanvas();
/** Construct a canvas with the specified device to draw into.
@@ -1058,6 +1060,8 @@ private:
#else
void validateClip() const {}
#endif
+
+ typedef SkRefCnt INHERITED;
};
/** Stack helper class to automatically call restoreToCount() on the canvas
diff --git a/include/core/SkData.h b/include/core/SkData.h
index 76b4457373..8bbe3c89a9 100644
--- a/include/core/SkData.h
+++ b/include/core/SkData.h
@@ -20,6 +20,8 @@
*/
class SkData : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkData)
+
/**
* Returns the number of bytes stored.
*/
@@ -91,6 +93,8 @@ private:
SkData(const void* ptr, size_t size, ReleaseProc, void* context);
~SkData();
+
+ typedef SkRefCnt INHERITED;
};
/**
diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h
index b4d44bf7b6..688ce8ef40 100644
--- a/include/core/SkDevice.h
+++ b/include/core/SkDevice.h
@@ -27,6 +27,8 @@ class SkGpuRenderTarget;
class SK_API SkDevice : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkDevice)
+
/**
* Construct a new device with the specified bitmap as its backend. It is
* valid for the bitmap to have no pixels associated with it. In that case,
@@ -387,6 +389,8 @@ private:
SkBitmap fBitmap;
SkIPoint fOrigin;
SkMetaData* fMetaData;
+
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/include/core/SkDeviceProfile.h b/include/core/SkDeviceProfile.h
index 46b9781f93..49214c59ac 100644
--- a/include/core/SkDeviceProfile.h
+++ b/include/core/SkDeviceProfile.h
@@ -12,6 +12,8 @@
class SkDeviceProfile : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkDeviceProfile)
+
enum LCDConfig {
kNone_LCDConfig, // disables LCD text rendering, uses A8 instead
kRGB_Horizontal_LCDConfig,
@@ -89,6 +91,8 @@ private:
float fContrastScale;
LCDConfig fLCDConfig;
FontHintLevel fFontHintLevel;
+
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/include/core/SkDrawFilter.h b/include/core/SkDrawFilter.h
index 303b80ed80..39b1717617 100644
--- a/include/core/SkDrawFilter.h
+++ b/include/core/SkDrawFilter.h
@@ -38,6 +38,9 @@ public:
* The implementation may modify the paint as they wish.
*/
virtual void filter(SkPaint*, Type) = 0;
+
+private:
+ typedef SkRefCnt INHERITED;
};
#endif
diff --git a/include/core/SkFlattenable.h b/include/core/SkFlattenable.h
index 57019670fe..e6c56a330e 100644
--- a/include/core/SkFlattenable.h
+++ b/include/core/SkFlattenable.h
@@ -68,6 +68,8 @@ class SkString;
*/
class SK_API SkFlattenable : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkFlattenable)
+
typedef SkFlattenable* (*Factory)(SkFlattenableReadBuffer&);
SkFlattenable() {}
@@ -104,6 +106,8 @@ private:
friend class SkGraphics;
friend class SkFlattenableWriteBuffer;
+
+ typedef SkRefCnt INHERITED;
};
// helpers for matrix and region
diff --git a/include/core/SkInstCnt.h b/include/core/SkInstCnt.h
index e5c44db11c..087d5a7431 100644
--- a/include/core/SkInstCnt.h
+++ b/include/core/SkInstCnt.h
@@ -31,7 +31,7 @@
#define SK_DECLARE_INST_COUNT_INTERNAL(className, initStep) \
class SkInstanceCountHelper { \
public: \
- typedef void (*PFCheckInstCnt)(); \
+ typedef void (*PFCheckInstCnt)(int level); \
SkInstanceCountHelper() { \
if (!gInited) { \
initStep \
@@ -57,13 +57,14 @@
return SkInstanceCountHelper::gInstanceCount; \
} \
\
- static void CheckInstanceCount() { \
+ static void CheckInstanceCount(int level = 0) { \
if (0 != SkInstanceCountHelper::gInstanceCount) { \
- SkDebugf("Leaked %s objects: %d\n", #className, \
+ SkDebugf("%*c Leaked %s objects: %d\n", \
+ 4*level, ' ', #className, \
SkInstanceCountHelper::gInstanceCount); \
} \
- for (int i = 0; i < SkInstanceCountHelper::gChildren.count(); ++i) { \
- (*SkInstanceCountHelper::gChildren[i])(); \
+ for (int i = 0; i < SkInstanceCountHelper::gChildren.count(); ++i) {\
+ (*SkInstanceCountHelper::gChildren[i])(level+1); \
} \
} \
\
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 21a4fcc492..51ed0d71ac 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -26,6 +26,8 @@ class SkWStream;
*/
class SK_API SkPicture : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkPicture)
+
/** The constructor prepares the picture to record.
@param width the width of the virtual device the picture records.
@param height the height of the virtual device the picture records.
@@ -130,6 +132,8 @@ private:
friend class SkFlatPicture;
friend class SkPicturePlayback;
+
+ typedef SkRefCnt INHERITED;
};
class SkAutoPictureRecord : SkNoncopyable {
diff --git a/include/core/SkPtrRecorder.h b/include/core/SkPtrRecorder.h
index 2df84b245a..360471fc0c 100644
--- a/include/core/SkPtrRecorder.h
+++ b/include/core/SkPtrRecorder.h
@@ -21,6 +21,8 @@
*/
class SkPtrSet : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkPtrSet)
+
/**
* Search for the specified ptr in the set. If it is found, return its
* 32bit ID [1..N], or if not found, return 0. Always returns 0 for NULL.
diff --git a/include/core/SkStream.h b/include/core/SkStream.h
index 67512d7700..58f5443aff 100644
--- a/include/core/SkStream.h
+++ b/include/core/SkStream.h
@@ -17,6 +17,8 @@ class SkData;
class SK_API SkStream : public SkRefCnt {
public:
+ SK_DECLARE_INST_COUNT(SkStream)
+
virtual ~SkStream();
/** Called to rewind to the beginning of the stream. If this cannot be
done, return false.
@@ -63,6 +65,9 @@ public:
bool readBool() { return this->readU8() != 0; }
SkScalar readScalar();
size_t readPackedUInt();
+
+private:
+ typedef SkRefCnt INHERITED;
};
class SK_API SkWStream : SkNoncopyable {
diff --git a/include/core/SkWeakRefCnt.h b/include/core/SkWeakRefCnt.h
index 50760e2e2b..a407623068 100644
--- a/include/core/SkWeakRefCnt.h
+++ b/include/core/SkWeakRefCnt.h
@@ -150,6 +150,8 @@ private:
/* Invariant: fWeakCnt = #weak + (fRefCnt > 0 ? 1 : 0) */
mutable int32_t fWeakCnt;
+
+ typedef SkRefCnt INHERITED;
};
#endif