Bug 1331509 - Move InitRenderFrame call to TabParent construction. r=dvander
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 17 Jan 2017 15:52:45 -0500
changeset 377146 570f8327ea9a11a0b33c9dddf43303da655cf484
parent 377145 4d8dfb30875e59a6d35b4b7c0915b08788ec724f
child 377147 bf830a2e2346b71f46ab7edd59ae0d787adfbb1c
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1331509
milestone53.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 1331509 - Move InitRenderFrame call to TabParent construction. r=dvander MozReview-Commit-ID: Cg0EDJ3uSmz
dom/base/nsFrameLoader.cpp
dom/ipc/TabParent.cpp
--- a/dom/base/nsFrameLoader.cpp
+++ b/dom/base/nsFrameLoader.cpp
@@ -2932,16 +2932,18 @@ nsFrameLoader::TryRemoteBrowser()
   NS_ENSURE_SUCCESS(rv, false);
 
   nsCOMPtr<Element> ownerElement = mOwnerContent;
   mRemoteBrowser = ContentParent::CreateBrowser(context, ownerElement, openerContentParent,
                                                 mFreshProcess);
   if (!mRemoteBrowser) {
     return false;
   }
+  // Now that mRemoteBrowser is set, we can initialize the RenderFrameParent
+  mRemoteBrowser->InitRenderFrame();
 
   MaybeUpdatePrimaryTabParent(eTabParentChanged);
 
   mChildID = mRemoteBrowser->Manager()->ChildID();
 
   nsCOMPtr<nsIDocShellTreeItem> rootItem;
   parentDocShell->GetRootTreeItem(getter_AddRefs(rootItem));
   nsCOMPtr<nsPIDOMWindowOuter> rootWin = rootItem->GetWindow();
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -624,16 +624,17 @@ void
 TabParent::InitRenderFrame()
 {
   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();
+    MOZ_ASSERT(frameLoader);
     if (frameLoader) {
       bool success;
       RenderFrameParent* renderFrame = new RenderFrameParent(frameLoader, &success);
       uint64_t layersId = renderFrame->GetLayersId();
       AddTabParentToTable(layersId, this);
       Unused << SendPRenderFrameConstructor(renderFrame);
     }
   } else {
@@ -646,18 +647,17 @@ TabParent::InitRenderFrame()
 void
 TabParent::Show(const ScreenIntSize& size, bool aParentIsActive)
 {
     mDimensions = size;
     if (mIsDestroyed) {
         return;
     }
 
-    InitRenderFrame();
-
+    MOZ_ASSERT(GetRenderFrame());
     RenderFrameParent* renderFrame = IsInitedByParent() ? GetRenderFrame() : nullptr;
     uint64_t layersId = renderFrame ? renderFrame->GetLayersId() : 0;
     TextureFactoryIdentifier textureFactoryIdentifier;
     if (renderFrame) {
       renderFrame->GetTextureFactoryIdentifier(&textureFactoryIdentifier);
     }
 
     nsCOMPtr<nsISupports> container = mFrameElement->OwnerDoc()->GetContainer();