Bug 1585760 - Store a flag in the TextureChild indicating use of the ImageBridge. r=sotaro

This avoids calling GetTextureForwarder during shutdown which may return a null pointer.

Differential Revision: https://phabricator.services.mozilla.com/D51615

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nicolas Silva 2019-11-05 01:55:23 +00:00
Родитель 6c7032b199
Коммит 8b8031bd60
1 изменённых файлов: 6 добавлений и 5 удалений

Просмотреть файл

@ -117,7 +117,8 @@ class TextureChild final : PTextureChild {
mMainThreadOnly(false),
mIPCOpen(false),
mOwnsTextureData(false),
mOwnerCalledDestroy(false) {}
mOwnerCalledDestroy(false),
mUsesImageBridge(false) {}
mozilla::ipc::IPCResult Recv__delete__() override { return IPC_OK(); }
@ -128,15 +129,13 @@ class TextureChild final : PTextureChild {
bool IPCOpen() const { return mIPCOpen; }
void Lock() const {
if (mCompositableForwarder &&
mCompositableForwarder->GetTextureForwarder()->UsesImageBridge()) {
if (mUsesImageBridge) {
mLock.Enter();
}
}
void Unlock() const {
if (mCompositableForwarder &&
mCompositableForwarder->GetTextureForwarder()->UsesImageBridge()) {
if (mUsesImageBridge) {
mLock.Leave();
}
}
@ -239,6 +238,7 @@ class TextureChild final : PTextureChild {
bool mIPCOpen;
bool mOwnsTextureData;
bool mOwnerCalledDestroy;
bool mUsesImageBridge;
friend class TextureClient;
friend void DeallocateTextureClient(TextureDeallocParams params);
@ -1055,6 +1055,7 @@ bool TextureClient::InitIPDLActor(CompositableForwarder* aForwarder) {
}
}
mActor->mCompositableForwarder = aForwarder;
mActor->mUsesImageBridge = aForwarder->GetTextureForwarder()->UsesImageBridge();
}
return true;
}