Bug 1361497 - Refactoring to simplify getting the root CompositorBridgeParent and APZCTreeManager. r=jrmuizel

This allows for some code reuse in upcoming patches where we need to get
a hold of the APZCTreeManager.

MozReview-Commit-ID: 8oGiGH07fnF
This commit is contained in:
Kartikaya Gupta 2017-05-12 13:58:17 -04:00
Родитель 3ba2f96414
Коммит a5c9d69f63
4 изменённых файлов: 33 добавлений и 23 удалений

Просмотреть файл

@ -1629,6 +1629,12 @@ CompositorBridgeParent::DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aA
return true;
}
RefPtr<WebRenderBridgeParent>
CompositorBridgeParent::GetWebRenderBridgeParent() const
{
return mWrBridge;
}
void
CompositorBridgeParent::SetWebRenderProfilerEnabled(bool aEnabled)
{

Просмотреть файл

@ -452,6 +452,8 @@ public:
TextureFactoryIdentifier* aTextureFactoryIdentifier,
uint32_t* aIdNamespace) override;
bool DeallocPWebRenderBridgeParent(PWebRenderBridgeParent* aActor) override;
RefPtr<WebRenderBridgeParent> GetWebRenderBridgeParent() const;
static void SetWebRenderProfilerEnabled(bool aEnabled);
static CompositorBridgeParent* GetCompositorBridgeParentFromLayersId(const uint64_t& aLayersId);

Просмотреть файл

@ -330,38 +330,38 @@ WebRenderBridgeParent::HandleDPEnd(const gfx::IntSize& aSize,
UpdateAPZ();
}
void
WebRenderBridgeParent::UpdateAPZ()
CompositorBridgeParent*
WebRenderBridgeParent::GetRootCompositorBridgeParent() const
{
if (!mCompositorBridge) {
return;
return nullptr;
}
CompositorBridgeParent* cbp;
uint64_t rootLayersId;
WebRenderBridgeParent* rootWrbp;
if (mWidget) {
// This WebRenderBridgeParent is attached to the root
// CompositorBridgeParent.
cbp = static_cast<CompositorBridgeParent*>(mCompositorBridge);
rootLayersId = wr::AsUint64(mPipelineId);
rootWrbp = this;
} else {
// This WebRenderBridgeParent is attached to a
// CrossProcessCompositorBridgeParent so we have an extra level of
// indirection to unravel.
uint64_t layersId = wr::AsUint64(mPipelineId);
CompositorBridgeParent::LayerTreeState* lts =
CompositorBridgeParent::GetIndirectShadowTree(layersId);
MOZ_ASSERT(lts);
cbp = lts->mParent;
rootLayersId = cbp->RootLayerTreeId();
lts = CompositorBridgeParent::GetIndirectShadowTree(rootLayersId);
MOZ_ASSERT(lts);
rootWrbp = lts->mWrBridge.get();
return static_cast<CompositorBridgeParent*>(mCompositorBridge);
}
MOZ_ASSERT(cbp);
// Otherwise, this WebRenderBridgeParent is attached to a
// CrossProcessCompositorBridgeParent so we have an extra level of
// indirection to unravel.
uint64_t layersId = wr::AsUint64(mPipelineId);
CompositorBridgeParent::LayerTreeState* lts =
CompositorBridgeParent::GetIndirectShadowTree(layersId);
MOZ_ASSERT(lts);
return lts->mParent;
}
void
WebRenderBridgeParent::UpdateAPZ()
{
CompositorBridgeParent* cbp = GetRootCompositorBridgeParent();
if (!cbp) {
return;
}
uint64_t rootLayersId = cbp->RootLayerTreeId();
RefPtr<WebRenderBridgeParent> rootWrbp = cbp->GetWebRenderBridgeParent();
if (!rootWrbp) {
return;
}

Просмотреть файл

@ -188,6 +188,8 @@ private:
void SampleAnimations(nsTArray<WrOpacityProperty>& aOpacityArray,
nsTArray<WrTransformProperty>& aTransformArray);
CompositorBridgeParent* GetRootCompositorBridgeParent() const;
private:
struct PendingTransactionId {
PendingTransactionId(wr::Epoch aEpoch, uint64_t aId)