Bug 1314520 - part 2 Finish initializing TabChild rendering state even if compositing IPC is lost. r=billm a=IanN DONTBUILD CLOSED TREE SEAMONKEY_2_49_ESR_RELBRANCH
authorDavid Anderson <danderson@mozilla.com>
Mon, 14 Nov 2016 14:58:22 -0800
branchSEAMONKEY_2_49_ESR_RELBRANCH
changeset 357569 e0e23e1fd9e3bf023397ebf0dd412ccc6d6954d4
parent 357568 75494cf725fead68d00bc15d189259d707ac9ca8
child 357570 8b321df52efd08e36805b5b8206c2def24f952be
push id7836
push userfrgrahl@gmx.net
push dateMon, 15 Jul 2019 16:17:02 +0000
treeherdermozilla-esr52@3a4afe7ecac5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm, IanN
bugs1314520
milestone52.9.1
Bug 1314520 - part 2 Finish initializing TabChild rendering state even if compositing IPC is lost. r=billm a=IanN DONTBUILD CLOSED TREE SeaMonkey ESR52 release branch only.
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -1346,23 +1346,17 @@ TabChild::RecvShow(const ScreenIntSize& 
     }
 
     nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(WebNavigation());
     if (!baseWindow) {
         NS_ERROR("WebNavigation() doesn't QI to nsIBaseWindow");
         return false;
     }
 
-    if (!InitRenderingState(aTextureFactoryIdentifier, aLayersId, aRenderFrame)) {
-        // We can fail to initialize our widget if the <browser
-        // remote> has already been destroyed, and we couldn't hook
-        // into the parent-process's layer system.  That's not a fatal
-        // error.
-        return true;
-    }
+    InitRenderingState(aTextureFactoryIdentifier, aLayersId, aRenderFrame);
 
     baseWindow->SetVisibility(true);
 
     bool res = InitTabChildGlobal();
     ApplyShowInfo(aInfo);
     RecvParentActivated(aParentIsActive);
 
     return res;
@@ -2528,39 +2522,37 @@ TabChild::InitTabChildGlobal(FrameScript
     if (IsMozBrowserOrApp()) {
       RecvLoadRemoteScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
     }
   }
 
   return true;
 }
 
-bool
+void
 TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
                              const uint64_t& aLayersId,
                              PRenderFrameChild* aRenderFrame)
 {
     mPuppetWidget->InitIMEState();
 
-    RenderFrameChild* remoteFrame = static_cast<RenderFrameChild*>(aRenderFrame);
-    if (!remoteFrame) {
-        NS_WARNING("failed to construct RenderFrame");
-        return false;
+    if (!aRenderFrame) {
+      NS_WARNING("failed to construct RenderFrame");
+      return;
     }
 
     MOZ_ASSERT(aLayersId != 0);
     mTextureFactoryIdentifier = aTextureFactoryIdentifier;
 
     // Pushing layers transactions directly to a separate
     // compositor context.
     PCompositorBridgeChild* compositorChild = CompositorBridgeChild::Get();
     if (!compositorChild) {
       NS_WARNING("failed to get CompositorBridgeChild instance");
-      PRenderFrameChild::Send__delete__(remoteFrame);
-      return false;
+      return;
     }
 
     ShadowLayerForwarder* lf =
         mPuppetWidget->GetLayerManager(
             nullptr, mTextureFactoryIdentifier.mParentBackend)
                 ->AsShadowForwarder();
     // As long as we are creating a ClientLayerManager for the puppet widget,
     // lf must be non-null here.
@@ -2568,36 +2560,25 @@ TabChild::InitRenderingState(const Textu
 
     if (lf) {
       nsTArray<LayersBackend> backends;
       backends.AppendElement(mTextureFactoryIdentifier.mParentBackend);
       bool success;
       PLayerTransactionChild* shadowManager =
           compositorChild->SendPLayerTransactionConstructor(backends,
                                                             aLayersId, &mTextureFactoryIdentifier, &success);
-      if (!success) {
-        NS_WARNING("failed to properly allocate layer transaction");
-        PRenderFrameChild::Send__delete__(remoteFrame);
-        return false;
+      if (shadowManager && success) {
+        lf->SetShadowManager(shadowManager);
+        lf->IdentifyTextureHost(mTextureFactoryIdentifier);
+        ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier);
+        gfx::VRManagerChild::IdentifyTextureHost(mTextureFactoryIdentifier);
       }
-
-      if (!shadowManager) {
-        NS_WARNING("failed to construct LayersChild");
-        // This results in |remoteFrame| being deleted.
-        PRenderFrameChild::Send__delete__(remoteFrame);
-        return false;
-      }
-
-      lf->SetShadowManager(shadowManager);
-      lf->IdentifyTextureHost(mTextureFactoryIdentifier);
-      ImageBridgeChild::IdentifyCompositorTextureHost(mTextureFactoryIdentifier);
-      gfx::VRManagerChild::IdentifyTextureHost(mTextureFactoryIdentifier);
     }
 
-    mRemoteFrame = remoteFrame;
+    mRemoteFrame = static_cast<RenderFrameChild*>(aRenderFrame);
     if (aLayersId != 0) {
       if (!sTabChildren) {
         sTabChildren = new TabChildMap;
       }
       MOZ_ASSERT(!sTabChildren->Get(aLayersId));
       sTabChildren->Put(aLayersId, this);
       mLayersId = aLayersId;
     }
@@ -2607,17 +2588,16 @@ TabChild::InitRenderingState(const Textu
     nsCOMPtr<nsIObserverService> observerService =
         mozilla::services::GetObserverService();
 
     if (observerService) {
         observerService->AddObserver(this,
                                      BEFORE_FIRST_PAINT,
                                      false);
     }
-    return true;
 }
 
 void
 TabChild::GetDPI(float* aDPI)
 {
     *aDPI = -1.0;
     if (!mRemoteFrame) {
         return;
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -702,17 +702,17 @@ private:
   void UpdateFrameType();
 
   void ActorDestroy(ActorDestroyReason why) override;
 
   enum FrameScriptLoading { DONT_LOAD_SCRIPTS, DEFAULT_LOAD_SCRIPTS };
 
   bool InitTabChildGlobal(FrameScriptLoading aScriptLoading = DEFAULT_LOAD_SCRIPTS);
 
-  bool InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
+  void InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
                           const uint64_t& aLayersId,
                           PRenderFrameChild* aRenderFrame);
 
   void DestroyWindow();
 
   void SetProcessNameToAppName();
 
   void ApplyShowInfo(const ShowInfo& aInfo);
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -630,17 +630,16 @@ TabParent::Show(const ScreenIntSize& siz
     if (IsInitedByParent()) {
         // If TabParent is initialized by parent side then the RenderFrame must also
         // be created here. If TabParent is initialized by child side,
         // child side will create RenderFrame.
         MOZ_ASSERT(!GetRenderFrame());
         RefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
         if (frameLoader) {
           renderFrame = new RenderFrameParent(frameLoader, &success);
-          MOZ_ASSERT(success);
           layersId = renderFrame->GetLayersId();
           renderFrame->GetTextureFactoryIdentifier(&textureFactoryIdentifier);
           AddTabParentToTable(layersId, this);
           Unused << SendPRenderFrameConstructor(renderFrame);
         }
     } else {
       // Otherwise, the child should have constructed the RenderFrame,
       // and we should already know about it.