Bug 1583380. Protect APZCTreeManager::mFixedLayerMargins by mMapLock instead of mTreeLock. r=botond

We do this because we will need to access it in APZCTreeManager::SampleForWebRender which can't hold mTreeLock.

Differential Revision: https://phabricator.services.mozilla.com/D54400

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Timothy Nikkel 2019-11-29 23:06:24 +00:00
Родитель 297e2538f7
Коммит 5d06f93d9e
2 изменённых файлов: 15 добавлений и 9 удалений

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

@ -440,6 +440,7 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
}
if (aLayerMetrics.Metrics().IsRootContent()) {
MutexAutoLock lock(mMapLock);
mGeckoFixedLayerMargins =
aLayerMetrics.Metrics().GetFixedLayerMargins();
} else {
@ -1894,7 +1895,7 @@ APZEventResult APZCTreeManager::ProcessTouchInput(MultiTouchInput& aInput) {
}
touchData.mScreenPoint = *untransformedScreenPoint;
if (mFixedPosSidesForInputBlock != SideBits::eNone) {
RecursiveMutexAutoLock lock(mTreeLock);
MutexAutoLock lock(mMapLock);
touchData.mScreenPoint -=
RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, mFixedPosSidesForInputBlock,
@ -3195,6 +3196,7 @@ Maybe<ScreenIntPoint> APZCTreeManager::ConvertToGecko(
UntransformBy(transformScreenToGecko, aPoint);
if (geckoPoint) {
if (mFixedPosSidesForInputBlock != SideBits::eNone) {
MutexAutoLock mapLock(mMapLock);
*geckoPoint -=
RoundedToInt(AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, mFixedPosSidesForInputBlock,
@ -3330,11 +3332,15 @@ LayerToParentLayerMatrix4x4 APZCTreeManager::ComputeTransformForNode(
});
}
} else if (IsFixedToRootContent(aNode)) {
ParentLayerPoint translation = ViewAs<ParentLayerPixel>(
AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, aNode->GetFixedPosSides(),
mGeckoFixedLayerMargins),
PixelCastJustification::ScreenIsParentLayerForRoot);
ParentLayerPoint translation;
{
MutexAutoLock mapLock(mMapLock);
translation = ViewAs<ParentLayerPixel>(
AsyncCompositionManager::ComputeFixedMarginsOffset(
mCompositorFixedLayerMargins, aNode->GetFixedPosSides(),
mGeckoFixedLayerMargins),
PixelCastJustification::ScreenIsParentLayerForRoot);
}
return aNode->GetTransform() *
CompleteAsyncTransform(
AsyncTransformComponentMatrix::Translation(translation));
@ -3445,7 +3451,7 @@ void APZCTreeManager::SendSubtreeTransformsToChromeMainThread(
void APZCTreeManager::SetFixedLayerMargins(ScreenIntCoord aTop,
ScreenIntCoord aBottom) {
RecursiveMutexAutoLock lock(mTreeLock);
MutexAutoLock lock(mMapLock);
mCompositorFixedLayerMargins.top = aTop;
mCompositorFixedLayerMargins.bottom = aBottom;
}

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

@ -895,13 +895,13 @@ class APZCTreeManager : public IAPZCTreeManager, public APZInputBridge {
ScreenPoint mCurrentMousePosition;
/* Extra margins that should be applied to content that fixed wrt. the
* RCD-RSF, to account for the dynamic toolbar.
* Acquire mTreeLock before accessing this.
* Acquire mMapLock before accessing this.
*/
ScreenMargin mCompositorFixedLayerMargins;
/* Similar to above |mCompositorFixedLayerMargins|. But this value is the
* margins on the main-thread at the last time position:fixed elements were
* updated during the dynamic toolbar transitions.
* Acquire mTreeLock before accessing this.
* Acquire mMapLock before accessing this.
*/
ScreenMargin mGeckoFixedLayerMargins;
/* For logging the APZC tree for debugging (enabled by the apz.printtree