diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 23e899c353b0..ce847d311b22 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -557,7 +557,6 @@ TextureClient::KeepUntilFullDeallocation(UniquePtr aKeep, bool aMainT void TextureClient::ForceRemove(bool sync) { - FinalizeOnIPDLThread(); if (mValid && mActor) { if (sync || GetFlags() & TextureFlags::DEALLOCATE_CLIENT) { MOZ_PERFORMANCE_WARNING("gfx", "TextureClient/Host pair requires synchronous deallocation"); diff --git a/gfx/layers/client/TextureClient.h b/gfx/layers/client/TextureClient.h index 373b5a307486..1337cbfed7f6 100644 --- a/gfx/layers/client/TextureClient.h +++ b/gfx/layers/client/TextureClient.h @@ -408,8 +408,6 @@ public: * help avoid race conditions in some cases. * It's a temporary hack to ensure that DXGI textures don't get destroyed * between serialization and deserialization. - * - * This must not be called off the texture's IPDL thread. */ void KeepUntilFullDeallocation(UniquePtr aKeep, bool aMainThreadOnly = false); @@ -506,20 +504,13 @@ private: static void TextureClientRecycleCallback(TextureClient* aClient, void* aClosure); /** - * Called once, during the destruction of the Texture, on the thread in which - * texture's reference count reaches 0 (could be any thread). + * Called once, just before the destructor. * * Here goes the shut-down code that uses virtual methods. * Must only be called by Release(). */ B2G_ACL_EXPORT void Finalize(); - /** - * Called once during the destruction of the texture on the IPDL thread, if - * the texture is shared on the compositor (otherwise it is not called at all). - */ - virtual void FinalizeOnIPDLThread() {} - friend class AtomicRefCountedWithFinalize; protected: diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp index 51c8513316ec..bf0f945da777 100644 --- a/gfx/layers/d3d11/TextureD3D11.cpp +++ b/gfx/layers/d3d11/TextureD3D11.cpp @@ -198,6 +198,13 @@ TextureClientD3D11::TextureClientD3D11(ISurfaceAllocator* aAllocator, TextureClientD3D11::~TextureClientD3D11() { + if (mActor) { + if (mTexture) { + KeepUntilFullDeallocation(MakeUnique>(mTexture)); + } else if (mTexture10) { + KeepUntilFullDeallocation(MakeUnique>(mTexture10)); + } + } #ifdef DEBUG // An Azure DrawTarget needs to be locked when it gets nullptr'ed as this is // when it calls EndDraw. This EndDraw should not execute anything so it @@ -221,18 +228,6 @@ TextureClientD3D11::~TextureClientD3D11() #endif } -void -TextureClientD3D11::FinalizeOnIPDLThread() -{ - if (mActor) { - if (mTexture) { - KeepUntilFullDeallocation(MakeUnique>(mTexture)); - } else if (mTexture10) { - KeepUntilFullDeallocation(MakeUnique>(mTexture10)); - } - } -} - // static already_AddRefed TextureClientD3D11::Create(ISurfaceAllocator* aAllocator, @@ -661,16 +656,11 @@ protected: }; DXGIYCbCrTextureClient::~DXGIYCbCrTextureClient() -{ - MOZ_COUNT_DTOR(DXGIYCbCrTextureClient); -} - -void -DXGIYCbCrTextureClient::FinalizeOnIPDLThread() { if (mHoldRefs[0] && mActor) { KeepUntilFullDeallocation(MakeUnique(mHoldRefs), true); } + MOZ_COUNT_DTOR(DXGIYCbCrTextureClient); } // static diff --git a/gfx/layers/d3d11/TextureD3D11.h b/gfx/layers/d3d11/TextureD3D11.h index b19877ce49b2..c3d1ad8c002d 100644 --- a/gfx/layers/d3d11/TextureD3D11.h +++ b/gfx/layers/d3d11/TextureD3D11.h @@ -88,8 +88,6 @@ public: protected: bool AllocateD3D11Surface(ID3D11Device* aDevice, const gfx::IntSize& aSize); - virtual void FinalizeOnIPDLThread() override; - gfx::IntSize mSize; RefPtr mTexture10; RefPtr mTexture; @@ -159,8 +157,6 @@ public: CreateSimilar(TextureFlags, TextureAllocationFlags) const override{ return nullptr; } private: - virtual void FinalizeOnIPDLThread() override; - RefPtr mHoldRefs[3]; HANDLE mHandles[3]; gfx::IntSize mSize; diff --git a/gfx/layers/d3d9/TextureD3D9.cpp b/gfx/layers/d3d9/TextureD3D9.cpp index 17ea1e48c35b..2f46658cdb2c 100644 --- a/gfx/layers/d3d9/TextureD3D9.cpp +++ b/gfx/layers/d3d9/TextureD3D9.cpp @@ -660,12 +660,6 @@ SharedTextureClientD3D9::SharedTextureClientD3D9(ISurfaceAllocator* aAllocator, } SharedTextureClientD3D9::~SharedTextureClientD3D9() -{ - MOZ_COUNT_DTOR(SharedTextureClientD3D9); -} - -void -SharedTextureClientD3D9::FinalizeOnIPDLThread() { if (mTexture && mActor) { KeepUntilFullDeallocation(MakeUnique>(mTexture)); @@ -673,6 +667,7 @@ SharedTextureClientD3D9::FinalizeOnIPDLThread() if (mTexture) { gfxWindowsPlatform::sD3D9SharedTextureUsed -= mDesc.Width * mDesc.Height * 4; } + MOZ_COUNT_DTOR(SharedTextureClientD3D9); } // static diff --git a/gfx/layers/d3d9/TextureD3D9.h b/gfx/layers/d3d9/TextureD3D9.h index 5708775af9d0..27ff3093be66 100644 --- a/gfx/layers/d3d9/TextureD3D9.h +++ b/gfx/layers/d3d9/TextureD3D9.h @@ -285,8 +285,6 @@ public: } private: - virtual void FinalizeOnIPDLThread() override; - RefPtr mDevice; RefPtr mTexture; gfx::SurfaceFormat mFormat; diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index 06cb4ca773dc..301c6b578479 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -188,7 +188,7 @@ static void ImageBridgeShutdownStep1(ReentrantMonitor *aBarrier, bool *aDone) InfallibleTArray textures; sImageBridgeChildSingleton->ManagedPTextureChild(textures); for (int i = textures.Length() - 1; i >= 0; --i) { - RefPtr client = TextureClient::AsTextureClient(textures[i]); + TextureClient* client = TextureClient::AsTextureClient(textures[i]); if (client) { client->ForceRemove(); } diff --git a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp index fbefd06c8f65..159b41291fc7 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp +++ b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.cpp @@ -16,11 +16,6 @@ MacIOSurfaceTextureClientOGL::MacIOSurfaceTextureClientOGL(ISurfaceAllocator* aA {} MacIOSurfaceTextureClientOGL::~MacIOSurfaceTextureClientOGL() -{ -} - -void -MacIOSurfaceTextureClientOGL::FinalizeOnIPDLThread() { if (mActor && mSurface) { KeepUntilFullDeallocation(MakeUnique>(mSurface)); diff --git a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h index 7548beeafdc7..5a0c03825d36 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h +++ b/gfx/layers/opengl/MacIOSurfaceTextureClientOGL.h @@ -50,8 +50,6 @@ public: CreateSimilar(TextureFlags, TextureAllocationFlags) const override { return nullptr; } protected: - virtual void FinalizeOnIPDLThread() override; - RefPtr mSurface; bool mIsLocked; };