Don't require a Compositor for texture backend checks. (bug 1365879 part 12, r=mattwoodrow)

This commit is contained in:
David Anderson 2017-06-20 01:17:19 -07:00
parent 392b83f1c4
commit 3a500a9070
2 changed files with 10 additions and 8 deletions

View File

@ -98,10 +98,6 @@ public:
MOZ_CRASH("GFX: Call on compositor, not LayerManagerComposite"); 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 virtual void GetBackendName(nsAString& name) override
{ {
MOZ_CRASH("GFX: Shouldn't be called for composited layer manager"); MOZ_CRASH("GFX: Shouldn't be called for composited layer manager");
@ -403,10 +399,12 @@ public:
bool AsyncPanZoomEnabled() const override; bool AsyncPanZoomEnabled() const override;
public: public:
virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() override {
{
return mCompositor->GetTextureFactoryIdentifier(); return mCompositor->GetTextureFactoryIdentifier();
} }
virtual LayersBackend GetBackendType() override {
return mCompositor ? mCompositor->GetBackendType() : LayersBackend::LAYERS_NONE;
}
void ForcePresent() override { mCompositor->ForcePresent(); } void ForcePresent() override { mCompositor->ForcePresent(); }

View File

@ -506,6 +506,11 @@ CrossProcessCompositorBridgeParent::AllocPTextureParent(const SurfaceDescriptor&
TextureFlags flags = aFlags; TextureFlags flags = aFlags;
LayersBackend actualBackend = LayersBackend::LAYERS_NONE;
if (state && state->mLayerManager) {
actualBackend = state->mLayerManager->GetBackendType();
}
if (!state) { if (!state) {
// The compositor was recreated, and we're receiving layers updates for a // 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 // 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 // kill the content process. Instead, we signal that the underlying
// TextureHost should not attempt to access the compositor. // TextureHost should not attempt to access the compositor.
flags |= TextureFlags::INVALID_COMPOSITOR; flags |= TextureFlags::INVALID_COMPOSITOR;
} else if (state->mLayerManager && state->mLayerManager->GetCompositor() && } else if (actualBackend != LayersBackend::LAYERS_NONE && aLayersBackend != actualBackend) {
aLayersBackend != state->mLayerManager->GetCompositor()->GetBackendType()) {
gfxDevCrash(gfx::LogReason::PAllocTextureBackendMismatch) << "Texture backend is wrong"; gfxDevCrash(gfx::LogReason::PAllocTextureBackendMismatch) << "Texture backend is wrong";
} }