Commit d173d982 authored by sky's avatar sky Committed by Commit bot

Optimize View::UpdateRootBounds

If a view has a ton of children (say > 5000) with the majority hidden
then we spend a lot of unecessary time in View::UpdateRootBounds on
every paint.

BUG=409126
TEST=none, see bug
R=luken@chromium.org

Review URL: https://codereview.chromium.org/566403002

Cr-Commit-Position: refs/heads/master@{#294878}
parent 87a8d403
......@@ -417,8 +417,14 @@ void View::SetVisible(bool visible) {
UpdateLayerVisibility();
// If we are newly visible, schedule paint.
if (visible_)
if (visible_) {
SchedulePaint();
} else {
// We're never painted when hidden, so no need to be in the BoundsTree.
BoundsTree* bounds_tree = GetBoundsTreeFromPaintRoot();
if (bounds_tree)
RemoveRootBounds(bounds_tree);
}
}
}
......@@ -2011,6 +2017,14 @@ void View::SetRootBoundsDirty(bool origin_changed) {
}
void View::UpdateRootBounds(BoundsTree* tree, const gfx::Vector2d& offset) {
// If we're not visible no need to update BoundsTree. When we are made visible
// the BoundsTree will be updated appropriately.
if (!visible_)
return;
if (!root_bounds_dirty_ && children_.empty())
return;
// No need to recompute bounds if we haven't flagged ours as dirty.
TRACE_EVENT1("views", "View::UpdateRootBounds", "class", GetClassName());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment