diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-26 18:58:03 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-06-26 18:58:03 +0000 |
commit | 73e19fb1ba2562048c6987272c8d73eee6a44242 (patch) | |
tree | fe9f70745f4a3c227c4b069dcea629a0c742e7ca /include | |
parent | 1909e15a6d52e6c112d271b524c9239407ad9c54 (diff) |
show # of unknown subclasses in dump
git-svn-id: http://skia.googlecode.com/svn/trunk@4347 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkInstCnt.h | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/core/SkInstCnt.h b/include/core/SkInstCnt.h index 087d5a7431..ff9a19f252 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)(int level); \ + typedef int (*PFCheckInstCnt)(int level); \ SkInstanceCountHelper() { \ if (!gInited) { \ initStep \ @@ -57,15 +57,22 @@ return SkInstanceCountHelper::gInstanceCount; \ } \ \ - static void CheckInstanceCount(int level = 0) { \ + static int CheckInstanceCount(int level = 0) { \ if (0 != SkInstanceCountHelper::gInstanceCount) { \ - SkDebugf("%*c Leaked %s objects: %d\n", \ + SkDebugf("%*c Leaked %s: %d\n", \ 4*level, ' ', #className, \ SkInstanceCountHelper::gInstanceCount); \ } \ - for (int i = 0; i < SkInstanceCountHelper::gChildren.count(); ++i) {\ - (*SkInstanceCountHelper::gChildren[i])(level+1); \ + int childCount = SkInstanceCountHelper::gChildren.count(); \ + int count = SkInstanceCountHelper::gInstanceCount; \ + for (int i = 0; i < childCount; ++i) { \ + count -= (*SkInstanceCountHelper::gChildren[i])(level+1); \ } \ + SkASSERT(count >= 0); \ + if (childCount > 0 && count > 0) { \ + SkDebugf("%*c Leaked ???: %d\n", 4*(level + 1), ' ', count); \ + } \ + return SkInstanceCountHelper::gInstanceCount; \ } \ \ static void AddInstChild(SkInstanceCountHelper::PFCheckInstCnt \ |