From da44133fe92ec11fa6b904c498e7e5cd23a43cbf Mon Sep 17 00:00:00 2001 From: Nicolas Roard Date: Sun, 30 Jan 2011 15:34:46 -0800 Subject: Add a ClassTracker class to more easily track leaks bug:3376517 Change-Id: Ieb419bc3140963ccbda3e2f130778ec53b2920aa --- WebCore/platform/graphics/android/LayerAndroid.cpp | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'WebCore/platform/graphics/android/LayerAndroid.cpp') diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index 277840d..5d6d8ff 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -4,6 +4,7 @@ #if USE(ACCELERATED_COMPOSITING) #include "AndroidAnimation.h" +#include "ClassTracker.h" #include "DrawExtra.h" #include "GLUtils.h" #include "MediaLayer.h" @@ -38,14 +39,8 @@ namespace WebCore { -static int gDebugLayerAndroidInstances; static int gUniqueId; -inline int LayerAndroid::instancesCount() -{ - return gDebugLayerAndroidInstances; -} - class OpacityDrawFilter : public SkDrawFilter { public: OpacityDrawFilter(int opacity) : m_opacity(opacity) { } @@ -87,7 +82,9 @@ LayerAndroid::LayerAndroid(bool isRootLayer) : SkLayer(), m_preserves3D = false; m_dirty = false; - gDebugLayerAndroidInstances++; +#ifdef DEBUG_COUNT + ClassTracker::instance()->increment("LayerAndroid"); +#endif } LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), @@ -134,7 +131,9 @@ LayerAndroid::LayerAndroid(const LayerAndroid& layer) : SkLayer(layer), for (KeyframesMap::const_iterator it = layer.m_animations.begin(); it != end; ++it) m_animations.add((it->second)->name(), (it->second)->copy()); - gDebugLayerAndroidInstances++; +#ifdef DEBUG_COUNT + ClassTracker::instance()->increment("LayerAndroid"); +#endif } LayerAndroid::LayerAndroid(SkPicture* picture) : SkLayer(), @@ -153,7 +152,9 @@ LayerAndroid::LayerAndroid(SkPicture* picture) : SkLayer(), m_backgroundColor = 0; m_dirty = false; SkSafeRef(m_recordingPicture); - gDebugLayerAndroidInstances++; +#ifdef DEBUG_COUNT + ClassTracker::instance()->increment("LayerAndroid"); +#endif } void LayerAndroid::removeTexture(BackedDoubleBufferedTexture* aTexture) @@ -188,7 +189,9 @@ LayerAndroid::~LayerAndroid() m_contentsImage->safeUnref(); m_recordingPicture->safeUnref(); m_animations.clear(); - gDebugLayerAndroidInstances--; +#ifdef DEBUG_COUNT + ClassTracker::instance()->decrement("LayerAndroid"); +#endif } static int gDebugNbAnims = 0; -- cgit v1.1