Reduce closure allocation in RenderObject.cleanRelayoutBoundary (#51439)

This commit is contained in:
Ferhat 2020-02-26 15:53:19 -08:00 committed by GitHub
parent 2132a0c7a3
commit 1a79592b4a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1584,12 +1584,15 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
if (_relayoutBoundary != this) {
_relayoutBoundary = null;
_needsLayout = true;
visitChildren((RenderObject child) {
child._cleanRelayoutBoundary();
});
visitChildren(_cleanChildRelayoutBoundary);
}
}
// Reduces closure allocation for visitChildren use cases.
static void _cleanChildRelayoutBoundary(RenderObject child) {
child._cleanRelayoutBoundary();
}
/// Bootstrap the rendering pipeline by scheduling the very first layout.
///
/// Requires this render object to be attached and that this render object
@ -1724,9 +1727,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
// The local relayout boundary has changed, must notify children in case
// they also need updating. Otherwise, they will be confused about what
// their actual relayout boundary is later.
visitChildren((RenderObject child) {
child._cleanRelayoutBoundary();
});
visitChildren(_cleanChildRelayoutBoundary);
}
_relayoutBoundary = relayoutBoundary;
assert(!_debugMutationsLocked);