Bug 1072313 - Check for more leaks in the layers code. r=mstange
authorBenoit Girard <b56girard@gmail.com>
Wed, 29 Jul 2015 11:57:03 -0400
changeset 287327 13dd879617e4481e27877d010bcda87f6d906d84
parent 287326 8fa22ffa2da2d3b65837eb711dd165ec07cec099
child 287328 0fbb2ec4b4a84968764a678474fa2ce35a8b2085
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1072313
milestone42.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1072313 - Check for more leaks in the layers code. r=mstange
gfx/layers/Layers.cpp
gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp
gfx/layers/composite/TextureHost.cpp
gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -220,20 +220,24 @@ Layer::Layer(LayerManager* aManager, voi
   mMargins(0, 0, 0, 0),
   mStickyPositionData(nullptr),
   mScrollbarTargetId(FrameMetrics::NULL_SCROLL_ID),
   mScrollbarDirection(ScrollDirection::NONE),
   mScrollbarThumbRatio(0.0f),
   mIsScrollbarContainer(false),
   mDebugColorIndex(0),
   mAnimationGeneration(0)
-{}
+{
+  MOZ_COUNT_CTOR(Layer);
+}
 
 Layer::~Layer()
-{}
+{
+  MOZ_COUNT_DTOR(Layer);
+}
 
 Animation*
 Layer::AddAnimation()
 {
   MOZ_LAYERS_LOG_IF_SHADOWABLE(this, ("Layer::Mutated(%p) AddAnimation", this));
 
   MOZ_ASSERT(!mPendingAnimations, "should have called ClearAnimations first");
 
@@ -984,20 +988,24 @@ ContainerLayer::ContainerLayer(LayerMana
     mPresShellResolution(1.0f),
     mScaleToResolution(false),
     mUseIntermediateSurface(false),
     mSupportsComponentAlphaChildren(false),
     mMayHaveReadbackChild(false),
     mChildrenChanged(false),
     mEventRegionsOverride(EventRegionsOverride::NoOverride)
 {
+  MOZ_COUNT_CTOR(ContainerLayer);
   mContentFlags = 0; // Clear NO_TEXT, NO_TEXT_OVER_TRANSPARENT
 }
 
-ContainerLayer::~ContainerLayer() {}
+ContainerLayer::~ContainerLayer()
+{
+  MOZ_COUNT_DTOR(ContainerLayer);
+}
 
 bool
 ContainerLayer::InsertAfter(Layer* aChild, Layer* aAfter)
 {
   if(aChild->Manager() != Manager()) {
     NS_ERROR("Child has wrong manager");
     return false;
   }
--- a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp
+++ b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.cpp
@@ -9,20 +9,23 @@
 namespace mozilla {
 namespace layers {
 
 MacIOSurfaceTextureSourceBasic::MacIOSurfaceTextureSourceBasic(
                                 BasicCompositor* aCompositor,
                                 MacIOSurface* aSurface)
   : mCompositor(aCompositor)
   , mSurface(aSurface)
-{}
+{
+  MOZ_COUNT_CTOR(MacIOSurfaceTextureSourceBasic);
+}
 
 MacIOSurfaceTextureSourceBasic::~MacIOSurfaceTextureSourceBasic()
 {
+  MOZ_COUNT_DTOR(MacIOSurfaceTextureSourceBasic);
 }
 
 gfx::IntSize
 MacIOSurfaceTextureSourceBasic::GetSize() const
 {
   return gfx::IntSize(mSurface->GetDevicePixelWidth(),
                       mSurface->GetDevicePixelHeight());
 }
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -291,20 +291,23 @@ TextureHost::CompositorRecycle()
   }
   static_cast<TextureParent*>(mActor)->CompositorRecycle();
 }
 
 TextureHost::TextureHost(TextureFlags aFlags)
     : mActor(nullptr)
     , mFlags(aFlags)
     , mCompositableCount(0)
-{}
+{
+  MOZ_COUNT_CTOR(TextureHost);
+}
 
 TextureHost::~TextureHost()
 {
+  MOZ_COUNT_DTOR(TextureHost);
 }
 
 void TextureHost::Finalize()
 {
   if (!(GetFlags() & TextureFlags::DEALLOCATE_CLIENT)) {
     DeallocateSharedData();
     DeallocateDeviceData();
   }
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
@@ -9,21 +9,27 @@
 
 namespace mozilla {
 namespace layers {
 
 MacIOSurfaceTextureHostOGL::MacIOSurfaceTextureHostOGL(TextureFlags aFlags,
                                                        const SurfaceDescriptorMacIOSurface& aDescriptor)
   : TextureHost(aFlags)
 {
+  MOZ_COUNT_CTOR(MacIOSurfaceTextureHostOGL);
   mSurface = MacIOSurface::LookupSurface(aDescriptor.surfaceId(),
                                          aDescriptor.scaleFactor(),
                                          !aDescriptor.isOpaque());
 }
 
+MacIOSurfaceTextureHostOGL::~MacIOSurfaceTextureHostOGL()
+{
+  MOZ_COUNT_DTOR(MacIOSurfaceTextureHostOGL);
+}
+
 bool
 MacIOSurfaceTextureHostOGL::Lock()
 {
   if (!mCompositor || !mSurface) {
     return false;
   }
 
   if (!mTextureSource) {
@@ -72,20 +78,24 @@ MacIOSurfaceTextureHostOGL::GetSize() co
                       mSurface->GetDevicePixelHeight());
 }
 
 MacIOSurfaceTextureSourceOGL::MacIOSurfaceTextureSourceOGL(
                                 CompositorOGL* aCompositor,
                                 MacIOSurface* aSurface)
   : mCompositor(aCompositor)
   , mSurface(aSurface)
-{}
+{
+  MOZ_COUNT_CTOR(MacIOSurfaceTextureSourceOGL);
+}
 
 MacIOSurfaceTextureSourceOGL::~MacIOSurfaceTextureSourceOGL()
-{}
+{
+  MOZ_COUNT_DTOR(MacIOSurfaceTextureSourceOGL);
+}
 
 gfx::IntSize
 MacIOSurfaceTextureSourceOGL::GetSize() const
 {
   return gfx::IntSize(mSurface->GetDevicePixelWidth(),
                       mSurface->GetDevicePixelHeight());
 }
 
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
@@ -59,16 +59,17 @@ protected:
  *
  * Most of the logic actually happens in MacIOSurfaceTextureSourceOGL.
  */
 class MacIOSurfaceTextureHostOGL : public TextureHost
 {
 public:
   MacIOSurfaceTextureHostOGL(TextureFlags aFlags,
                              const SurfaceDescriptorMacIOSurface& aDescriptor);
+  virtual ~MacIOSurfaceTextureHostOGL();
 
   // MacIOSurfaceTextureSourceOGL doesn't own any GL texture
   virtual void DeallocateDeviceData() override {}
 
   virtual void SetCompositor(Compositor* aCompositor) override;
 
   virtual bool Lock() override;