mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 913821 - Conservatively ensure that TextureClients/Hosts are removed at the end of a video. r=sotaro
This commit is contained in:
parent
86d7c1b1ec
commit
be66706698
@ -32,9 +32,26 @@ CompositableClient::~CompositableClient()
|
||||
{
|
||||
MOZ_COUNT_DTOR(CompositableClient);
|
||||
Destroy();
|
||||
|
||||
FlushTexturesToRemoveCallbacks();
|
||||
|
||||
MOZ_ASSERT(mTexturesToRemove.Length() == 0, "would leak textures pending for deletion");
|
||||
}
|
||||
|
||||
void
|
||||
CompositableClient::FlushTexturesToRemoveCallbacks()
|
||||
{
|
||||
std::map<uint64_t,TextureClientData*>::iterator it
|
||||
= mTexturesToRemoveCallbacks.begin();
|
||||
std::map<uint64_t,TextureClientData*>::iterator stop
|
||||
= mTexturesToRemoveCallbacks.end();
|
||||
for (; it != stop; ++it) {
|
||||
it->second->DeallocateSharedData(GetForwarder());
|
||||
delete it->second;
|
||||
}
|
||||
mTexturesToRemoveCallbacks.clear();
|
||||
}
|
||||
|
||||
LayersBackend
|
||||
CompositableClient::GetCompositorBackendType() const
|
||||
{
|
||||
|
@ -141,6 +141,7 @@ public:
|
||||
|
||||
void OnReplyTextureRemoved(uint64_t aTextureID);
|
||||
|
||||
void FlushTexturesToRemoveCallbacks();
|
||||
protected:
|
||||
struct TextureIDAndFlags {
|
||||
TextureIDAndFlags(uint64_t aID, TextureFlags aFlags)
|
||||
|
@ -261,7 +261,7 @@ public:
|
||||
|
||||
void AddTextureHost(TextureHost* aTexture);
|
||||
virtual void UseTextureHost(TextureHost* aTexture) {}
|
||||
void RemoveTextureHost(uint64_t aTextureID);
|
||||
virtual void RemoveTextureHost(uint64_t aTextureID);
|
||||
TextureHost* GetTextureHost(uint64_t aTextureID);
|
||||
|
||||
protected:
|
||||
|
@ -42,6 +42,15 @@ ImageHost::UseTextureHost(TextureHost* aTexture)
|
||||
mFrontBuffer = aTexture;
|
||||
}
|
||||
|
||||
void
|
||||
ImageHost::RemoveTextureHost(uint64_t aTextureID)
|
||||
{
|
||||
CompositableHost::RemoveTextureHost(aTextureID);
|
||||
if (mFrontBuffer && mFrontBuffer->GetID() == aTextureID) {
|
||||
mFrontBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
TextureHost*
|
||||
ImageHost::GetTextureHost()
|
||||
{
|
||||
|
@ -57,6 +57,8 @@ public:
|
||||
|
||||
virtual void UseTextureHost(TextureHost* aTexture) MOZ_OVERRIDE;
|
||||
|
||||
virtual void RemoveTextureHost(uint64_t aTextureID) MOZ_OVERRIDE;
|
||||
|
||||
virtual TextureHost* GetTextureHost() MOZ_OVERRIDE;
|
||||
|
||||
virtual void SetPictureRect(const nsIntRect& aPictureRect) MOZ_OVERRIDE
|
||||
|
@ -444,6 +444,7 @@ void ImageBridgeChild::FlushImageNow(ImageClient* aClient, ImageContainer* aCont
|
||||
aClient->FlushImage();
|
||||
aClient->OnTransaction();
|
||||
sImageBridgeChildSingleton->EndTransaction();
|
||||
aClient->FlushTexturesToRemoveCallbacks();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -111,6 +111,20 @@ GrallocTextureClientOGL::GrallocTextureClientOGL(CompositableClient* aCompositab
|
||||
GrallocTextureClientOGL::~GrallocTextureClientOGL()
|
||||
{
|
||||
MOZ_COUNT_DTOR(GrallocTextureClientOGL);
|
||||
if (ShouldDeallocateInDestructor()) {
|
||||
// If the buffer has never been shared we must deallocate it or it would
|
||||
// leak.
|
||||
if (mBufferLocked) {
|
||||
mBufferLocked->Unlock();
|
||||
} else {
|
||||
MOZ_ASSERT(mCompositable);
|
||||
// We just need to wrap the actor in a SurfaceDescriptor because that's what
|
||||
// ISurfaceAllocator uses as input, we don't care about the other parameters.
|
||||
SurfaceDescriptor sd = SurfaceDescriptorGralloc(nullptr, mGrallocActor,
|
||||
nsIntSize(0,0), false, false);
|
||||
mCompositable->GetForwarder()->DestroySharedSurface(&sd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user