Bug 1351384 - Stop using the CompositorOptions to check if WebRender is enabled. r=dvander
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 28 Mar 2017 16:40:24 -0400
changeset 350267 106a5b0e636be7ceb1e5c873badde9d7435e0108
parent 350266 913d350950fae0ab046f16e4363218cfb0b6078a
child 350268 5b5080b0f6209ae2dd835fc694b9aeae3c64eb4c
push id88599
push userryanvm@gmail.com
push dateWed, 29 Mar 2017 13:44:26 +0000
treeherdermozilla-inbound@8efb75a46b62 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1351384
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
widget/PuppetWidget.cpp
--- 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;