зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1447299 - Have the APZCTreeManagerParent store a reference to the APZSampler. r=botond
MozReview-Commit-ID: BNhkhFAmYP8 --HG-- extra : rebase_source : 43ff9d5f74add3b8b8b0cf651d06a14d8ec82885
This commit is contained in:
Родитель
eacf1f2dcc
Коммит
cf0569e64e
|
@ -43,6 +43,8 @@ class APZSampler {
|
|||
public:
|
||||
explicit APZSampler(const RefPtr<APZCTreeManager>& aApz);
|
||||
|
||||
bool HasTreeManager(const RefPtr<APZCTreeManager>& aApz);
|
||||
|
||||
void ClearTree();
|
||||
void UpdateFocusState(LayersId aRootLayerTreeId,
|
||||
LayersId aOriginatingLayersId,
|
||||
|
|
|
@ -28,6 +28,12 @@ APZSampler::~APZSampler()
|
|||
mApz->SetSampler(nullptr);
|
||||
}
|
||||
|
||||
bool
|
||||
APZSampler::HasTreeManager(const RefPtr<APZCTreeManager>& aApz)
|
||||
{
|
||||
return aApz.get() == mApz.get();
|
||||
}
|
||||
|
||||
void
|
||||
APZSampler::ClearTree()
|
||||
{
|
||||
|
|
|
@ -7,16 +7,22 @@
|
|||
#include "mozilla/layers/APZCTreeManagerParent.h"
|
||||
|
||||
#include "apz/src/APZCTreeManager.h"
|
||||
#include "mozilla/layers/APZSampler.h"
|
||||
#include "mozilla/layers/APZThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
||||
APZCTreeManagerParent::APZCTreeManagerParent(LayersId aLayersId, RefPtr<APZCTreeManager> aAPZCTreeManager)
|
||||
APZCTreeManagerParent::APZCTreeManagerParent(LayersId aLayersId,
|
||||
RefPtr<APZCTreeManager> aAPZCTreeManager,
|
||||
RefPtr<APZSampler> aAPZSampler)
|
||||
: mLayersId(aLayersId)
|
||||
, mTreeManager(aAPZCTreeManager)
|
||||
, mTreeManager(Move(aAPZCTreeManager))
|
||||
, mSampler(Move(aAPZSampler))
|
||||
{
|
||||
MOZ_ASSERT(aAPZCTreeManager != nullptr);
|
||||
MOZ_ASSERT(mTreeManager != nullptr);
|
||||
MOZ_ASSERT(mSampler != nullptr);
|
||||
MOZ_ASSERT(mSampler->HasTreeManager(mTreeManager));
|
||||
}
|
||||
|
||||
APZCTreeManagerParent::~APZCTreeManagerParent()
|
||||
|
@ -24,10 +30,14 @@ APZCTreeManagerParent::~APZCTreeManagerParent()
|
|||
}
|
||||
|
||||
void
|
||||
APZCTreeManagerParent::ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager)
|
||||
APZCTreeManagerParent::ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager,
|
||||
RefPtr<APZSampler> aAPZSampler)
|
||||
{
|
||||
MOZ_ASSERT(aAPZCTreeManager != nullptr);
|
||||
mTreeManager = aAPZCTreeManager;
|
||||
MOZ_ASSERT(aAPZSampler != nullptr);
|
||||
MOZ_ASSERT(aAPZSampler->HasTreeManager(aAPZCTreeManager));
|
||||
mTreeManager = Move(aAPZCTreeManager);
|
||||
mSampler = Move(aAPZSampler);
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
|
|
@ -13,13 +13,16 @@ namespace mozilla {
|
|||
namespace layers {
|
||||
|
||||
class APZCTreeManager;
|
||||
class APZSampler;
|
||||
|
||||
class APZCTreeManagerParent
|
||||
: public PAPZCTreeManagerParent
|
||||
{
|
||||
public:
|
||||
|
||||
explicit APZCTreeManagerParent(LayersId aLayersId, RefPtr<APZCTreeManager> aAPZCTreeManager);
|
||||
APZCTreeManagerParent(LayersId aLayersId,
|
||||
RefPtr<APZCTreeManager> aAPZCTreeManager,
|
||||
RefPtr<APZSampler> mAPZSampler);
|
||||
virtual ~APZCTreeManagerParent();
|
||||
|
||||
LayersId GetLayersId() const { return mLayersId; }
|
||||
|
@ -28,7 +31,8 @@ public:
|
|||
* Called when the layer tree that this protocol is connected to
|
||||
* is adopted by another compositor, and we need to switch APZCTreeManagers.
|
||||
*/
|
||||
void ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager);
|
||||
void ChildAdopted(RefPtr<APZCTreeManager> aAPZCTreeManager,
|
||||
RefPtr<APZSampler> aAPZSampler);
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
RecvSetKeyboardMap(const KeyboardMap& aKeyboardMap) override;
|
||||
|
@ -84,6 +88,7 @@ public:
|
|||
private:
|
||||
LayersId mLayersId;
|
||||
RefPtr<APZCTreeManager> mTreeManager;
|
||||
RefPtr<APZSampler> mSampler;
|
||||
};
|
||||
|
||||
} // namespace layers
|
||||
|
|
|
@ -1096,8 +1096,9 @@ CompositorBridgeParent::AllocPAPZCTreeManagerParent(const LayersId& aLayersId)
|
|||
MOZ_ASSERT(XRE_IsGPUProcess());
|
||||
// We should only ever get this if APZ is enabled in this compositor.
|
||||
MOZ_ASSERT(mOptions.UseAPZ());
|
||||
// The mApzcTreeManager should have been created via RecvInitialize()
|
||||
// The mApzcTreeManager and mApzSampler should have been created via RecvInitialize()
|
||||
MOZ_ASSERT(mApzcTreeManager);
|
||||
MOZ_ASSERT(mApzSampler);
|
||||
// The main process should pass in 0 because we assume mRootLayerTreeID
|
||||
MOZ_ASSERT(!aLayersId.IsValid());
|
||||
|
||||
|
@ -1105,7 +1106,7 @@ CompositorBridgeParent::AllocPAPZCTreeManagerParent(const LayersId& aLayersId)
|
|||
CompositorBridgeParent::LayerTreeState& state = sIndirectLayerTrees[mRootLayerTreeID];
|
||||
MOZ_ASSERT(state.mParent.get() == this);
|
||||
MOZ_ASSERT(!state.mApzcTreeManagerParent);
|
||||
state.mApzcTreeManagerParent = new APZCTreeManagerParent(mRootLayerTreeID, mApzcTreeManager);
|
||||
state.mApzcTreeManagerParent = new APZCTreeManagerParent(mRootLayerTreeID, mApzcTreeManager, mApzSampler);
|
||||
|
||||
return state.mApzcTreeManagerParent;
|
||||
}
|
||||
|
@ -1124,8 +1125,9 @@ CompositorBridgeParent::AllocateAPZCTreeManagerParent(const MonitorAutoLock& aPr
|
|||
{
|
||||
MOZ_ASSERT(aState.mParent == this);
|
||||
MOZ_ASSERT(mApzcTreeManager);
|
||||
MOZ_ASSERT(mApzSampler);
|
||||
MOZ_ASSERT(!aState.mApzcTreeManagerParent);
|
||||
aState.mApzcTreeManagerParent = new APZCTreeManagerParent(aLayersId, mApzcTreeManager);
|
||||
aState.mApzcTreeManagerParent = new APZCTreeManagerParent(aLayersId, mApzcTreeManager, mApzSampler);
|
||||
}
|
||||
|
||||
PAPZParent*
|
||||
|
@ -1727,7 +1729,7 @@ CompositorBridgeParent::RecvAdoptChild(const LayersId& child)
|
|||
if (mApzSampler) {
|
||||
if (parent) {
|
||||
MOZ_ASSERT(mApzcTreeManager);
|
||||
parent->ChildAdopted(mApzcTreeManager);
|
||||
parent->ChildAdopted(mApzcTreeManager, mApzSampler);
|
||||
}
|
||||
mApzSampler->NotifyLayerTreeAdopted(child, oldApzSampler);
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "mozilla/ipc/Transport.h" // for Transport
|
||||
#include "mozilla/layers/AnimationHelper.h" // for CompositorAnimationStorage
|
||||
#include "mozilla/layers/APZCTreeManagerParent.h" // for APZCTreeManagerParent
|
||||
#include "mozilla/layers/APZSampler.h" // for APZSampler
|
||||
#include "mozilla/layers/AsyncCompositionManager.h"
|
||||
#include "mozilla/layers/CompositorOptions.h"
|
||||
#include "mozilla/layers/CompositorThread.h"
|
||||
|
@ -133,8 +134,9 @@ CrossProcessCompositorBridgeParent::AllocPAPZCTreeManagerParent(const LayersId&
|
|||
// Note: we immediately call ClearTree since otherwise the APZCTM will
|
||||
// retain a reference to itself, through the checkerboard observer.
|
||||
RefPtr<APZCTreeManager> temp = new APZCTreeManager(LayersId{0});
|
||||
temp->ClearTree();
|
||||
return new APZCTreeManagerParent(aLayersId, temp);
|
||||
RefPtr<APZSampler> tempSampler = new APZSampler(temp);
|
||||
tempSampler->ClearTree();
|
||||
return new APZCTreeManagerParent(aLayersId, temp, tempSampler);
|
||||
}
|
||||
|
||||
state.mParent->AllocateAPZCTreeManagerParent(lock, aLayersId, state);
|
||||
|
|
Загрузка…
Ссылка в новой задаче