Bug 1350638 - Remove sync GetCompositorOptions call in TabChild::ReinitRenderingState. r=dvander
authorKartikaya Gupta <kgupta@mozilla.com>
Sun, 09 Apr 2017 17:31:24 -0400
changeset 352070 4b455ab566a205ad6f37eadd1f3400ac01203ec1
parent 352069 dbfa42b56f1b7a94c9f0c0cdb3b249fcfb9fbe6c
child 352071 1a8d35bbcb2fd9e5a2bef88d89a757402267df0b
push id31629
push usercbook@mozilla.com
push dateMon, 10 Apr 2017 08:32:22 +0000
treeherdermozilla-central@50cb1ce431d7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1350638
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 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();