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