зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1576524 - Clean up APZCTreeManager::mDetachedLayersIds in UpdateHitTestingTree. r=tnikkel
This ensures that mDetachedLayersIds doesn't grow indefinitely. Differential Revision: https://phabricator.services.mozilla.com/D44741 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
11566e8cc0
Коммит
4fa43ed7fe
|
@ -407,11 +407,13 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
|
||||||
bool haveRootContentOutsideAsyncZoomContainer = false;
|
bool haveRootContentOutsideAsyncZoomContainer = false;
|
||||||
|
|
||||||
if (aRoot) {
|
if (aRoot) {
|
||||||
|
std::unordered_set<LayersId, LayersId::HashFn> seenLayersIds;
|
||||||
std::stack<gfx::TreeAutoIndent<LOG_DEFAULT>> indents;
|
std::stack<gfx::TreeAutoIndent<LOG_DEFAULT>> indents;
|
||||||
std::stack<AncestorTransform> ancestorTransforms;
|
std::stack<AncestorTransform> ancestorTransforms;
|
||||||
HitTestingTreeNode* parent = nullptr;
|
HitTestingTreeNode* parent = nullptr;
|
||||||
HitTestingTreeNode* next = nullptr;
|
HitTestingTreeNode* next = nullptr;
|
||||||
LayersId layersId = mRootLayersId;
|
LayersId layersId = mRootLayersId;
|
||||||
|
seenLayersIds.insert(mRootLayersId);
|
||||||
std::stack<wr::RenderRoot> renderRoots;
|
std::stack<wr::RenderRoot> renderRoots;
|
||||||
renderRoots.push(wr::RenderRoot::Default);
|
renderRoots.push(wr::RenderRoot::Default);
|
||||||
ancestorTransforms.push(AncestorTransform());
|
ancestorTransforms.push(AncestorTransform());
|
||||||
|
@ -489,6 +491,7 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
|
||||||
// Update the layersId or renderroot if we have a new one
|
// Update the layersId or renderroot if we have a new one
|
||||||
if (Maybe<LayersId> newLayersId = aLayerMetrics.GetReferentId()) {
|
if (Maybe<LayersId> newLayersId = aLayerMetrics.GetReferentId()) {
|
||||||
layersId = *newLayersId;
|
layersId = *newLayersId;
|
||||||
|
seenLayersIds.insert(layersId);
|
||||||
}
|
}
|
||||||
if (Maybe<wr::RenderRoot> newRenderRoot =
|
if (Maybe<wr::RenderRoot> newRenderRoot =
|
||||||
aLayerMetrics.GetReferentRenderRoot()) {
|
aLayerMetrics.GetReferentRenderRoot()) {
|
||||||
|
@ -558,6 +561,19 @@ APZCTreeManager::UpdateHitTestingTreeImpl(const ScrollNode& aRoot,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove any layers ids for which we no longer have content from
|
||||||
|
// mDetachedLayersIds.
|
||||||
|
for (auto iter = mDetachedLayersIds.begin();
|
||||||
|
iter != mDetachedLayersIds.end();) {
|
||||||
|
// unordered_set::erase() invalidates the iterator pointing to the
|
||||||
|
// element being erased, but returns an iterator to the next element.
|
||||||
|
if (seenLayersIds.find(*iter) == seenLayersIds.end()) {
|
||||||
|
iter = mDetachedLayersIds.erase(iter);
|
||||||
|
} else {
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We do not support tree structures where the root node has siblings.
|
// We do not support tree structures where the root node has siblings.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче