From 5139f05917377b1b5251c12ec83126235d970085 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Tue, 3 Dec 2013 13:44:38 -0500 Subject: [PATCH] Bug 944703 - Part 3: make TextureHost hold a strong reference to its ISurfaceAllocator - r=nical --- gfx/layers/composite/TextureHost.cpp | 12 +++++++----- gfx/layers/composite/TextureHost.h | 11 +++-------- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index 2ceecfcf8ae..410817697a8 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -261,11 +261,13 @@ DeprecatedTextureHost::PrintInfo(nsACString& aTo, const char* aPrefix) AppendToString(aTo, mFlags, " [flags=", "]"); } - - - - - +void +DeprecatedTextureHost::SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator) +{ + MOZ_ASSERT(!mBuffer || mBuffer == aBuffer, "Will leak the old mBuffer"); + mBuffer = aBuffer; + mDeAllocator = aAllocator; +} BufferTextureHost::BufferTextureHost(uint64_t aID, gfx::SurfaceFormat aFormat, diff --git a/gfx/layers/composite/TextureHost.h b/gfx/layers/composite/TextureHost.h index 70977886e09..5cf54e90f39 100644 --- a/gfx/layers/composite/TextureHost.h +++ b/gfx/layers/composite/TextureHost.h @@ -488,7 +488,7 @@ public: protected: mozilla::ipc::Shmem* mShmem; - ISurfaceAllocator* mDeallocator; + RefPtr mDeallocator; }; /** @@ -705,12 +705,7 @@ public: */ // only made virtual to allow overriding in GrallocDeprecatedTextureHostOGL, for hacky fix in gecko 23 for bug 862324. // see bug 865908 about fixing this. - virtual void SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator) - { - MOZ_ASSERT(!mBuffer || mBuffer == aBuffer, "Will leak the old mBuffer"); - mBuffer = aBuffer; - mDeAllocator = aAllocator; - } + virtual void SetBuffer(SurfaceDescriptor* aBuffer, ISurfaceAllocator* aAllocator); // used only for hacky fix in gecko 23 for bug 862324 // see bug 865908 about fixing this. @@ -762,7 +757,7 @@ protected: // which can go away under our feet at any time. This is the cause // of bug 862324 among others. Our current understanding is that // this will be gone in Gecko 24. See bug 858914. - ISurfaceAllocator* mDeAllocator; + RefPtr mDeAllocator; gfx::SurfaceFormat mFormat; };