Bug 1020169 - Part 2. Register nested LayerTree. r=mattwoodrow
author"Kan-Ru Chen (陳侃如)" <kanru@kanru.info>
Sat, 14 Jun 2014 15:25:02 +0800
changeset 188748 5da74b54a472fe4254e568d730d1c4b9196a2424
parent 188747 1b0af9c77b07402a74d22ba37cbfa35a70ed5b10
child 188749 8d99f061ec3599cf8ca3563fa9e1edaa06470ad7
push id44902
push userkchen@mozilla.com
push dateSat, 14 Jun 2014 07:25:37 +0000
treeherdermozilla-inbound@5da74b54a472 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1020169
milestone33.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 1020169 - Part 2. Register nested LayerTree. r=mattwoodrow Use PCompositor::NotifyChildCreated which was ill-defined for cross-process case. Assume that for all LayerTrees managed by a CrossProcessCompositorParent all share the same CompositorParent.
gfx/layers/ipc/CompositorParent.cpp
gfx/layers/ipc/CompositorParent.h
layout/ipc/RenderFrameParent.cpp
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -969,17 +969,17 @@ CompositorParent* CompositorParent::Remo
 bool
 CompositorParent::RecvNotifyChildCreated(const uint64_t& child)
 {
   NotifyChildCreated(child);
   return true;
 }
 
 void
-CompositorParent::NotifyChildCreated(uint64_t aChild)
+CompositorParent::NotifyChildCreated(const uint64_t& aChild)
 {
   sIndirectLayerTrees[aChild].mParent = this;
   sIndirectLayerTrees[aChild].mLayerManager = mLayerManager;
 }
 
 /*static*/ uint64_t
 CompositorParent::AllocateLayerTreeId()
 {
@@ -1281,24 +1281,25 @@ CrossProcessCompositorParent::DeallocPLa
   RemoveIndirectTree(slp->GetId());
   static_cast<LayerTransactionParent*>(aLayers)->ReleaseIPDLReference();
   return true;
 }
 
 bool
 CrossProcessCompositorParent::RecvNotifyChildCreated(const uint64_t& child)
 {
-  const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(child);
-  if (!state) {
-    return false;
+  for (LayerTreeMap::iterator it = sIndirectLayerTrees.begin();
+       it != sIndirectLayerTrees.end(); it++) {
+    CompositorParent::LayerTreeState* lts = &it->second;
+    if (lts->mParent && lts->mCrossProcessParent == this) {
+      lts->mParent->NotifyChildCreated(child);
+      return true;
+    }
   }
-
-  MOZ_ASSERT(state->mParent);
-  state->mParent->NotifyChildCreated(child);
-  return true;
+  return false;
 }
 
 void
 CrossProcessCompositorParent::ShadowLayersUpdated(
   LayerTransactionParent* aLayerTree,
   const uint64_t& aTransactionId,
   const TargetConfig& aTargetConfig,
   bool aIsFirstPaint,
--- a/gfx/layers/ipc/CompositorParent.h
+++ b/gfx/layers/ipc/CompositorParent.h
@@ -114,17 +114,17 @@ public:
    * be called by the widget code when it loses its viewport information
    * (or for whatever reason wants to refresh the viewport information).
    * The information refresh happens because the compositor will call
    * SetFirstPaintViewport on the next frame of composition.
    */
   void ForceIsFirstPaint();
   void Destroy();
 
-  void NotifyChildCreated(uint64_t aChild);
+  void NotifyChildCreated(const uint64_t& aChild);
 
   void AsyncRender();
 
   // Can be called from any thread
   void ScheduleRenderOnCompositorThread();
   void SchedulePauseOnCompositorThread();
   /**
    * Returns true if a surface was obtained and the resume succeeded; false
--- a/layout/ipc/RenderFrameParent.cpp
+++ b/layout/ipc/RenderFrameParent.cpp
@@ -738,26 +738,28 @@ RenderFrameParent::RenderFrameParent(nsF
     }
   }
 
   if (gfxPlatform::UsesOffMainThreadCompositing()) {
     // Our remote frame will push layers updates to the compositor,
     // and we'll keep an indirect reference to that tree.
     *aId = mLayersId = CompositorParent::AllocateLayerTreeId();
     if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
-      ClientLayerManager *clientManager = static_cast<ClientLayerManager*>(lm.get());
+      ClientLayerManager *clientManager =
+        static_cast<ClientLayerManager*>(lm.get());
       clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId);
     }
     if (aScrollingBehavior == ASYNC_PAN_ZOOM) {
       mContentController = new RemoteContentController(this);
       CompositorParent::SetControllerForLayerTree(mLayersId, mContentController);
     }
   } else if (XRE_GetProcessType() == GeckoProcessType_Content) {
     ContentChild::GetSingleton()->SendAllocateLayerTreeId(aId);
     mLayersId = *aId;
+    CompositorChild::Get()->SendNotifyChildCreated(mLayersId);
   }
   // Set a default RenderFrameParent
   mFrameLoader->SetCurrentRemoteFrame(this);
   *aSuccess = true;
 }
 
 APZCTreeManager*
 RenderFrameParent::GetApzcTreeManager()