diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 5877d1b76f52..b1b4b4c30bb5 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -1015,9 +1015,6 @@ EraseLayerState(uint64_t aId) CompositorParent::DeallocateLayerTreeId(uint64_t aId) { MOZ_ASSERT(NS_IsMainThread()); - // Here main thread notifies compositor to remove an element from - // sIndirectLayerTrees. This removed element might be queried soon. - // Checking the elements of sIndirectLayerTrees exist or not before using. CompositorLoop()->PostTask(FROM_HERE, NewRunnableFunction(&EraseLayerState, aId)); } @@ -1239,15 +1236,9 @@ CrossProcessCompositorParent::AllocPLayerTransactionParent(const nsTArraysecond; - } - - if (state && state->mLayerManager) { - state->mCrossProcessParent = this; - LayerManagerComposite* lm = state->mLayerManager; + if (sIndirectLayerTrees[aId].mLayerManager) { + sIndirectLayerTrees[aId].mCrossProcessParent = this; + LayerManagerComposite* lm = sIndirectLayerTrees[aId].mLayerManager; *aTextureFactoryIdentifier = lm->GetCompositor()->GetTextureFactoryIdentifier(); *aSuccess = true; LayerTransactionParent* p = new LayerTransactionParent(lm, this, aId); @@ -1276,13 +1267,7 @@ CrossProcessCompositorParent::DeallocPLayerTransactionParent(PLayerTransactionPa bool CrossProcessCompositorParent::RecvNotifyChildCreated(const uint64_t& child) { - const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(child); - if (!state) { - return false; - } - - MOZ_ASSERT(state->mParent); - state->mParent->NotifyChildCreated(child); + sIndirectLayerTrees[child].mParent->NotifyChildCreated(child); return true; } @@ -1296,13 +1281,9 @@ CrossProcessCompositorParent::ShadowLayersUpdated( uint64_t id = aLayerTree->GetId(); MOZ_ASSERT(id != 0); + MOZ_ASSERT(sIndirectLayerTrees[id].mParent); - const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(id); - if (!state) { - return; - } - MOZ_ASSERT(state->mParent); - state->mParent->ScheduleRotationOnCompositorThread(aTargetConfig, aIsFirstPaint); + sIndirectLayerTrees[id].mParent->ScheduleRotationOnCompositorThread(aTargetConfig, aIsFirstPaint); Layer* shadowRoot = aLayerTree->GetRoot(); if (shadowRoot) { @@ -1310,7 +1291,7 @@ CrossProcessCompositorParent::ShadowLayersUpdated( } UpdateIndirectTree(id, shadowRoot, aTargetConfig); - state->mParent->NotifyShadowTreeTransaction(id, aIsFirstPaint, aScheduleComposite); + sIndirectLayerTrees[id].mParent->NotifyShadowTreeTransaction(id, aIsFirstPaint, aScheduleComposite); } void @@ -1327,13 +1308,7 @@ CrossProcessCompositorParent::SetTestSampleTime( { uint64_t id = aLayerTree->GetId(); MOZ_ASSERT(id != 0); - const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(id); - if (!state) { - return false; - } - - MOZ_ASSERT(state->mParent); - return state->mParent->SetTestSampleTime(aLayerTree, aTime); + return sIndirectLayerTrees[id].mParent->SetTestSampleTime(aLayerTree, aTime); } void @@ -1341,26 +1316,14 @@ CrossProcessCompositorParent::LeaveTestMode(LayerTransactionParent* aLayerTree) { uint64_t id = aLayerTree->GetId(); MOZ_ASSERT(id != 0); - const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(id); - if (!state) { - return; - } - - MOZ_ASSERT(state->mParent); - state->mParent->LeaveTestMode(aLayerTree); + sIndirectLayerTrees[id].mParent->LeaveTestMode(aLayerTree); } AsyncCompositionManager* CrossProcessCompositorParent::GetCompositionManager(LayerTransactionParent* aLayerTree) { uint64_t id = aLayerTree->GetId(); - const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(id); - if (!state) { - return nullptr; - } - - MOZ_ASSERT(state->mParent); - return state->mParent->GetCompositionManager(aLayerTree); + return sIndirectLayerTrees[id].mParent->GetCompositionManager(aLayerTree); } void