Bug 1350638 - Remove sync GetCompositorOptions call in TabChild::ReinitRenderingState. r?dvander draft
authorKartikaya Gupta <kgupta@mozilla.com>
Sun, 09 Apr 2017 17:31:24 -0400
changeset 559369 474741a00eb5720e15f96b8e96ef35e60134d8f6
parent 559368 e6d922ca17dff2adf188c8f987a1ce79a0634970
child 559370 b7ada72e0d3f2b59b4f521d8860e54de3d5cb556
push id53059
push userkgupta@mozilla.com
push dateSun, 09 Apr 2017 21:38:40 +0000
reviewersdvander
bugs1350638
milestone55.0a1
Bug 1350638 - Remove sync GetCompositorOptions call in TabChild::ReinitRenderingState. r?dvander This piggybacks the sync message on the pre-existing EnsureLayersConnected sync message pathway to the compositor. MozReview-Commit-ID: DfYTlJrr3Gu
dom/ipc/PBrowser.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
layout/ipc/RenderFrameParent.cpp
layout/ipc/RenderFrameParent.h
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -589,17 +589,17 @@ parent:
     async AudioChannelActivityNotification(uint32_t aAudioChannel,
                                            bool aActive);
 
     // After a compositor reset, it is necessary to reconnect each layers ID to
     // the compositor of the widget that will render those layers. Note that
     // this is sync so we can ensure that messages to the window compositor
     // arrive before the TabChild attempts to use its cross-process compositor
     // bridge.
-    sync EnsureLayersConnected();
+    sync EnsureLayersConnected() returns (CompositorOptions compositorOptions);
 
     /**
      * Notify the parent that the session history state has been updated.
      *
      * @param aCount
      *        The updated number of entries in child session history
      * @param aLocalIndex
      *        The local session history index which is loaded.
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -3062,26 +3062,21 @@ TabChild::ReinitRendering()
   // Normally this happens in TabParent before TabChild is given rendering
   // information.
   //
   // In this case, we will send a sync message to our TabParent, which in turn
   // will send a sync message to the Compositor of the widget owning this tab.
   // This guarantees the correct association is in place before our
   // PLayerTransaction constructor message arrives on the cross-process
   // compositor bridge.
-  SendEnsureLayersConnected();
+  CompositorOptions options;
+  SendEnsureLayersConnected(&options);
+  mCompositorOptions = Some(options);
 
   RefPtr<CompositorBridgeChild> cb = CompositorBridgeChild::Get();
-
-  // Refresh the compositor options since we may now be attached to a different
-  // compositor than we were previously.
-  CompositorOptions options;
-  Unused << cb->SendGetCompositorOptions(mLayersId, &options);
-  mCompositorOptions = Some(options);
-
   if (gfxVars::UseWebRender()) {
     RefPtr<LayerManager> lm = mPuppetWidget->RecreateLayerManager(nullptr);
     MOZ_ASSERT(lm->AsWebRenderLayerManager());
     lm->AsWebRenderLayerManager()->Initialize(cb,
                                               wr::AsPipelineId(mLayersId),
                                               &mTextureFactoryIdentifier);
   } else {
     bool success;
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -408,20 +408,20 @@ TabParent::Destroy()
   } else {
     ContentParent::NotifyTabDestroying(this->GetTabId(), Manager()->ChildID());
   }
 
   mMarkedDestroying = true;
 }
 
 mozilla::ipc::IPCResult
-TabParent::RecvEnsureLayersConnected()
+TabParent::RecvEnsureLayersConnected(CompositorOptions* aCompositorOptions)
 {
   if (RenderFrameParent* frame = GetRenderFrame()) {
-    frame->EnsureLayersConnected();
+    frame->EnsureLayersConnected(aCompositorOptions);
   }
   return IPC_OK();
 }
 
 mozilla::ipc::IPCResult
 TabParent::Recv__delete__()
 {
   if (XRE_IsParentProcess()) {
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -582,17 +582,17 @@ public:
   void AudioChannelChangeNotification(nsPIDOMWindowOuter* aWindow,
                                       AudioChannel aAudioChannel,
                                       float aVolume,
                                       bool aMuted);
   bool SetRenderFrame(PRenderFrameParent* aRFParent);
   bool GetRenderFrameInfo(TextureFactoryIdentifier* aTextureFactoryIdentifier,
                           uint64_t* aLayersId);
 
-  mozilla::ipc::IPCResult RecvEnsureLayersConnected() override;
+  mozilla::ipc::IPCResult RecvEnsureLayersConnected(CompositorOptions* aCompositorOptions) override;
 
   // LiveResizeListener implementation
   void LiveResizeStarted() override;
   void LiveResizeStopped() override;
 
   void DispatchTabChildNotReadyEvent();
 
 protected:
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -303,28 +303,29 @@ RenderFrameParent::TakeFocusForClickFrom
     return;
   }
   fm->SetFocus(element, nsIFocusManager::FLAG_BYMOUSE |
                         nsIFocusManager::FLAG_BYTOUCH |
                         nsIFocusManager::FLAG_NOSCROLL);
 }
 
 void
-RenderFrameParent::EnsureLayersConnected()
+RenderFrameParent::EnsureLayersConnected(CompositorOptions* aCompositorOptions)
 {
   RefPtr<LayerManager> lm = GetFrom(mFrameLoader);
   if (!lm) {
     return;
   }
 
   if (!lm->GetCompositorBridgeChild()) {
     return;
   }
 
   mLayersConnected = lm->GetCompositorBridgeChild()->SendNotifyChildRecreated(mLayersId, &mCompositorOptions);
+  *aCompositorOptions = mCompositorOptions;
 }
 
 } // namespace layout
 } // namespace mozilla
 
 nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder,
                                  nsSubDocumentFrame* aFrame,
                                  RenderFrameParent* aRemoteFrame)
--- a/layout/ipc/RenderFrameParent.h
+++ b/layout/ipc/RenderFrameParent.h
@@ -83,17 +83,17 @@ public:
   void GetTextureFactoryIdentifier(TextureFactoryIdentifier* aTextureFactoryIdentifier);
 
   inline uint64_t GetLayersId() const { return mLayersId; }
   inline bool IsLayersConnected() const { return mLayersConnected; }
   inline CompositorOptions GetCompositorOptions() const { return mCompositorOptions; }
 
   void TakeFocusForClickFromTap();
 
-  void EnsureLayersConnected();
+  void EnsureLayersConnected(CompositorOptions* aCompositorOptions);
 
 protected:
   void ActorDestroy(ActorDestroyReason why) override;
 
   virtual mozilla::ipc::IPCResult RecvNotifyCompositorTransaction() override;
 
 private:
   void TriggerRepaint();