Bug 1442627 - Don't use GetAPZCTreeManager in CrossProcessCompositorBridgeParent. r=botond

Although CrossProcessCompositorBridgeParent still needs to create a
dummy APZCTreeManager of its own in place, we can at least stop it from
grabbing the "real" APZCTreeManager from CompositorBridgeParent, which
allows access to methods that might not be properly guarded with respect
to thread safety.

MozReview-Commit-ID: Btvez3OkFPs

--HG--
extra : rebase_source : a4bec1769ff2fb899bb2e65f99f8e715f9a94c44
This commit is contained in:
Kartikaya Gupta 2018-03-06 10:25:36 -05:00
parent 185d1fcf42
commit 551f604b60
3 changed files with 18 additions and 4 deletions

View File

@ -1146,6 +1146,17 @@ CompositorBridgeParent::DeallocPAPZCTreeManagerParent(PAPZCTreeManagerParent* aA
return true;
}
void
CompositorBridgeParent::AllocateAPZCTreeManagerParent(const MonitorAutoLock& aProofOfLayerTreeStateLock,
const uint64_t& aLayersId,
LayerTreeState& aState)
{
MOZ_ASSERT(aState.mParent == this);
MOZ_ASSERT(mApzcTreeManager);
MOZ_ASSERT(!aState.mApzcTreeManagerParent);
aState.mApzcTreeManagerParent = new APZCTreeManagerParent(aLayersId, mApzcTreeManager);
}
PAPZParent*
CompositorBridgeParent::AllocPAPZParent(const uint64_t& aLayersId)
{

View File

@ -443,6 +443,12 @@ public:
PAPZCTreeManagerParent* AllocPAPZCTreeManagerParent(const uint64_t& aLayersId) override;
bool DeallocPAPZCTreeManagerParent(PAPZCTreeManagerParent* aActor) override;
// Helper method so that we don't have to expose mApzcTreeManager to
// CrossProcessCompositorBridgeParent.
void AllocateAPZCTreeManagerParent(const MonitorAutoLock& aProofOfLayerTreeStateLock,
const uint64_t& aLayersId,
LayerTreeState& aLayerTreeStateToUpdate);
PAPZParent* AllocPAPZParent(const uint64_t& aLayersId) override;
bool DeallocPAPZParent(PAPZParent* aActor) override;

View File

@ -17,7 +17,6 @@
#include "mozilla/layers/AnimationHelper.h" // for CompositorAnimationStorage
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
#include "mozilla/layers/APZCTreeManagerParent.h" // for APZCTreeManagerParent
#include "mozilla/layers/APZThreadUtils.h" // for APZCTreeManager
#include "mozilla/layers/AsyncCompositionManager.h"
#include "mozilla/layers/CompositorOptions.h"
#include "mozilla/layers/CompositorThread.h"
@ -136,9 +135,7 @@ CrossProcessCompositorBridgeParent::AllocPAPZCTreeManagerParent(const uint64_t&
return new APZCTreeManagerParent(aLayersId, temp);
}
MOZ_ASSERT(!state.mApzcTreeManagerParent);
state.mApzcTreeManagerParent = new APZCTreeManagerParent(aLayersId, state.mParent->GetAPZCTreeManager());
state.mParent->AllocateAPZCTreeManagerParent(lock, aLayersId, state);
return state.mApzcTreeManagerParent;
}
bool