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.
This commit is contained in:
"Kan-Ru Chen (陳侃如)" 2014-06-14 15:25:02 +08:00
parent e35235cc31
commit 304410dce4
3 changed files with 13 additions and 10 deletions

View File

@ -974,7 +974,7 @@ CompositorParent::RecvNotifyChildCreated(const uint64_t& child)
} }
void void
CompositorParent::NotifyChildCreated(uint64_t aChild) CompositorParent::NotifyChildCreated(const uint64_t& aChild)
{ {
sIndirectLayerTrees[aChild].mParent = this; sIndirectLayerTrees[aChild].mParent = this;
sIndirectLayerTrees[aChild].mLayerManager = mLayerManager; sIndirectLayerTrees[aChild].mLayerManager = mLayerManager;
@ -1286,14 +1286,15 @@ CrossProcessCompositorParent::DeallocPLayerTransactionParent(PLayerTransactionPa
bool bool
CrossProcessCompositorParent::RecvNotifyChildCreated(const uint64_t& child) CrossProcessCompositorParent::RecvNotifyChildCreated(const uint64_t& child)
{ {
const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(child); for (LayerTreeMap::iterator it = sIndirectLayerTrees.begin();
if (!state) { it != sIndirectLayerTrees.end(); it++) {
return false; CompositorParent::LayerTreeState* lts = &it->second;
if (lts->mParent && lts->mCrossProcessParent == this) {
lts->mParent->NotifyChildCreated(child);
return true;
}
} }
return false;
MOZ_ASSERT(state->mParent);
state->mParent->NotifyChildCreated(child);
return true;
} }
void void

View File

@ -119,7 +119,7 @@ public:
void ForceIsFirstPaint(); void ForceIsFirstPaint();
void Destroy(); void Destroy();
void NotifyChildCreated(uint64_t aChild); void NotifyChildCreated(const uint64_t& aChild);
void AsyncRender(); void AsyncRender();

View File

@ -743,7 +743,8 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
// and we'll keep an indirect reference to that tree. // and we'll keep an indirect reference to that tree.
*aId = mLayersId = CompositorParent::AllocateLayerTreeId(); *aId = mLayersId = CompositorParent::AllocateLayerTreeId();
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) { 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); clientManager->GetRemoteRenderer()->SendNotifyChildCreated(mLayersId);
} }
if (aScrollingBehavior == ASYNC_PAN_ZOOM) { if (aScrollingBehavior == ASYNC_PAN_ZOOM) {
@ -753,6 +754,7 @@ RenderFrameParent::RenderFrameParent(nsFrameLoader* aFrameLoader,
} else if (XRE_GetProcessType() == GeckoProcessType_Content) { } else if (XRE_GetProcessType() == GeckoProcessType_Content) {
ContentChild::GetSingleton()->SendAllocateLayerTreeId(aId); ContentChild::GetSingleton()->SendAllocateLayerTreeId(aId);
mLayersId = *aId; mLayersId = *aId;
CompositorChild::Get()->SendNotifyChildCreated(mLayersId);
} }
// Set a default RenderFrameParent // Set a default RenderFrameParent
mFrameLoader->SetCurrentRemoteFrame(this); mFrameLoader->SetCurrentRemoteFrame(this);