diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index 49d31e5e9ded..f549b32fc830 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -98,10 +98,6 @@ public: MOZ_CRASH("GFX: Call on compositor, not LayerManagerComposite"); } - virtual LayersBackend GetBackendType() override - { - MOZ_CRASH("GFX: Shouldn't be called for composited layer manager"); - } virtual void GetBackendName(nsAString& name) override { MOZ_CRASH("GFX: Shouldn't be called for composited layer manager"); @@ -403,10 +399,12 @@ public: bool AsyncPanZoomEnabled() const override; public: - virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override - { + virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override { return mCompositor->GetTextureFactoryIdentifier(); } + virtual LayersBackend GetBackendType() override { + return mCompositor ? mCompositor->GetBackendType() : LayersBackend::LAYERS_NONE; + } void ForcePresent() override { mCompositor->ForcePresent(); } diff --git a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp index e5a870c020ab..18252c76e228 100644 --- a/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp +++ b/gfx/layers/ipc/CrossProcessCompositorBridgeParent.cpp @@ -506,6 +506,11 @@ CrossProcessCompositorBridgeParent::AllocPTextureParent(const SurfaceDescriptor& TextureFlags flags = aFlags; + LayersBackend actualBackend = LayersBackend::LAYERS_NONE; + if (state && state->mLayerManager) { + actualBackend = state->mLayerManager->GetBackendType(); + } + if (!state) { // The compositor was recreated, and we're receiving layers updates for a // a layer manager that will soon be discarded or invalidated. We can't @@ -513,8 +518,7 @@ CrossProcessCompositorBridgeParent::AllocPTextureParent(const SurfaceDescriptor& // kill the content process. Instead, we signal that the underlying // TextureHost should not attempt to access the compositor. flags |= TextureFlags::INVALID_COMPOSITOR; - } else if (state->mLayerManager && state->mLayerManager->GetCompositor() && - aLayersBackend != state->mLayerManager->GetCompositor()->GetBackendType()) { + } else if (actualBackend != LayersBackend::LAYERS_NONE && aLayersBackend != actualBackend) { gfxDevCrash(gfx::LogReason::PAllocTextureBackendMismatch) << "Texture backend is wrong"; }