Bug 1351384 - Stop using the CompositorOptions to check if WebRender is enabled. r?dvander
I suspect that the PuppetWidget is trying to create the layer manager after
it has been connected to a TabChild but before the TabChild has populated the
CompositorOptions. This results in the PuppetWidget effectively getting an
uninitialized value for the CompositorOptions, and so it sometimes randomly
creates a WebRenderLayerManager, later resulting in a crash.
It seems like exposing the potentially-uninitialized CompositorOptions from
TabChild like this is a bad idea, so I'm removing that API and using the more
reliable gfxVars in PuppetWidget. This is fine for WebRender purposes because
we no longer care to allow having WR compositors co-exist with non-WR
compositors.
We may eventually want to remove the CompositorOptions entirely, but for now
the rest of the usage of it seems fine.
MozReview-Commit-ID: 6ekG8j1PskK
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -426,24 +426,16 @@ TabChild::TabChild(nsIContentChild* aMan
}
}
for (uint32_t idx = 0; idx < NUMBER_OF_AUDIO_CHANNELS; idx++) {
mAudioChannelsActive.AppendElement(false);
}
}
-const CompositorOptions&
-TabChild::GetCompositorOptions() const
-{
- // If you're calling this before mCompositorOptions is set, well.. don't.
- MOZ_ASSERT(mCompositorOptions);
- return mCompositorOptions.ref();
-}
-
bool
TabChild::AsyncPanZoomEnabled() const
{
// By the time anybody calls this, we must have had InitRenderingState called
// already, and so mCompositorOptions should be populated.
MOZ_RELEASE_ASSERT(mCompositorOptions);
return mCompositorOptions->UseAPZ();
}
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -615,17 +615,16 @@ public:
bool IPCOpen() const { return mIPCOpen; }
bool ParentIsActive() const
{
return mParentIsActive;
}
- const mozilla::layers::CompositorOptions& GetCompositorOptions() const;
bool AsyncPanZoomEnabled() const;
virtual ScreenIntSize GetInnerSize() override;
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
void DoFakeShow(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame,
--- a/widget/PuppetWidget.cpp
+++ b/widget/PuppetWidget.cpp
@@ -602,20 +602,17 @@ PuppetWidget::GetLayerManager(PLayerTran
if (XRE_IsParentProcess()) {
// On the parent process there is no CompositorBridgeChild which confuses
// some layers code, so we use basic layers instead. Note that we create
// a non-retaining layer manager since we don't care about performance.
mLayerManager = new BasicLayerManager(BasicLayerManager::BLM_OFFSCREEN);
return mLayerManager;
}
- bool useWebRender = mTabChild
- ? mTabChild->GetCompositorOptions().UseWebRender()
- : gfxVars::UseWebRender();
- if (useWebRender) {
+ if (gfxVars::UseWebRender()) {
mLayerManager = new WebRenderLayerManager(this);
} else {
mLayerManager = new ClientLayerManager(this);
}
}
// Attach a shadow forwarder if none exists.
ShadowLayerForwarder* lf = mLayerManager->AsShadowForwarder();
@@ -629,17 +626,17 @@ PuppetWidget::GetLayerManager(PLayerTran
LayerManager*
PuppetWidget::RecreateLayerManager(PLayerTransactionChild* aShadowManager)
{
// Force the old LM to self destruct, otherwise if the reference dangles we
// could fail to revoke the most recent transaction.
DestroyLayerManager();
MOZ_ASSERT(mTabChild);
- if (mTabChild->GetCompositorOptions().UseWebRender()) {
+ if (gfxVars::UseWebRender()) {
mLayerManager = new WebRenderLayerManager(this);
} else {
mLayerManager = new ClientLayerManager(this);
}
if (ShadowLayerForwarder* lf = mLayerManager->AsShadowForwarder()) {
lf->SetShadowManager(aShadowManager);
}
return mLayerManager;