Bug 1122276 - Move lock from GetTargetNode to call sites. r=botond

This commit is contained in:
Kartikaya Gupta 2015-01-16 17:34:47 -05:00
parent ff4dd4c94a
commit 6665c5f98f

View File

@ -956,13 +956,13 @@ void
APZCTreeManager::UpdateZoomConstraints(const ScrollableLayerGuid& aGuid,
const ZoomConstraints& aConstraints)
{
MonitorAutoLock lock(mTreeLock);
nsRefPtr<HitTestingTreeNode> node = GetTargetNode(aGuid, nullptr);
MOZ_ASSERT(!node || node->GetApzc()); // any node returned must have an APZC
// For a given layers id, non-root APZCs inherit the zoom constraints
// of their root.
if (node && node->GetApzc()->IsRootForLayersId()) {
MonitorAutoLock lock(mTreeLock);
UpdateZoomConstraintsRecursively(node.get(), aConstraints);
}
}
@ -1171,6 +1171,7 @@ already_AddRefed<AsyncPanZoomController>
APZCTreeManager::GetTargetAPZC(const ScrollableLayerGuid& aGuid,
GuidComparator aComparator)
{
MonitorAutoLock lock(mTreeLock);
nsRefPtr<HitTestingTreeNode> node = GetTargetNode(aGuid, aComparator);
MOZ_ASSERT(!node || node->GetApzc()); // any node returned must have an APZC
nsRefPtr<AsyncPanZoomController> apzc = node ? node->GetApzc() : nullptr;
@ -1181,7 +1182,7 @@ already_AddRefed<HitTestingTreeNode>
APZCTreeManager::GetTargetNode(const ScrollableLayerGuid& aGuid,
GuidComparator aComparator)
{
MonitorAutoLock lock(mTreeLock);
mTreeLock.AssertCurrentThreadOwns();
nsRefPtr<HitTestingTreeNode> target = FindTargetNode(mRootNode, aGuid, aComparator);
return target.forget();
}