From 304410dce473a75c4ff629ef69f1187694a9bed5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=22Kan-Ru=20Chen=20=28=E9=99=B3=E4=BE=83=E5=A6=82=29=22?= Date: Sat, 14 Jun 2014 15:25:02 +0800 Subject: [PATCH] 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 | 17 +++++++++-------- gfx/layers/ipc/CompositorParent.h | 2 +- layout/ipc/RenderFrameParent.cpp | 4 +++- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 2bcb6d8db32..7657bff023b 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -974,7 +974,7 @@ CompositorParent::RecvNotifyChildCreated(const uint64_t& child) } void -CompositorParent::NotifyChildCreated(uint64_t aChild) +CompositorParent::NotifyChildCreated(const uint64_t& aChild) { sIndirectLayerTrees[aChild].mParent = this; sIndirectLayerTrees[aChild].mLayerManager = mLayerManager; @@ -1286,14 +1286,15 @@ CrossProcessCompositorParent::DeallocPLayerTransactionParent(PLayerTransactionPa 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 diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index 9b162f141ef..de41299ef88 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -119,7 +119,7 @@ public: void ForceIsFirstPaint(); void Destroy(); - void NotifyChildCreated(uint64_t aChild); + void NotifyChildCreated(const uint64_t& aChild); void AsyncRender(); diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index d2e1f774292..d683facebbc 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -743,7 +743,8 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader, // 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(lm.get()); + ClientLayerManager *clientManager = + static_cast(lm.get()); clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId); } if (aScrollingBehavior == ASYNC_PAN_ZOOM) { @@ -753,6 +754,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader, } else if (XRE_GetProcessType() == GeckoProcessType_Content) { ContentChild::GetSingleton()->SendAllocateLayerTreeId(aId); mLayersId = *aId; + CompositorChild::Get()->SendNotifyChildCreated(mLayersId); } // Set a default RenderFrameParent mFrameLoader->SetCurrentRemoteFrame(this);