Skip to content

Commit 1a79592

Browse files
authored
Reduce closure allocation in RenderObject.cleanRelayoutBoundary (#51439)
1 parent 2132a0c commit 1a79592

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

packages/flutter/lib/src/rendering/object.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,12 +1584,15 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
15841584
if (_relayoutBoundary != this) {
15851585
_relayoutBoundary = null;
15861586
_needsLayout = true;
1587-
visitChildren((RenderObject child) {
1588-
child._cleanRelayoutBoundary();
1589-
});
1587+
visitChildren(_cleanChildRelayoutBoundary);
15901588
}
15911589
}
15921590

1591+
// Reduces closure allocation for visitChildren use cases.
1592+
static void _cleanChildRelayoutBoundary(RenderObject child) {
1593+
child._cleanRelayoutBoundary();
1594+
}
1595+
15931596
/// Bootstrap the rendering pipeline by scheduling the very first layout.
15941597
///
15951598
/// Requires this render object to be attached and that this render object
@@ -1724,9 +1727,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im
17241727
// The local relayout boundary has changed, must notify children in case
17251728
// they also need updating. Otherwise, they will be confused about what
17261729
// their actual relayout boundary is later.
1727-
visitChildren((RenderObject child) {
1728-
child._cleanRelayoutBoundary();
1729-
});
1730+
visitChildren(_cleanChildRelayoutBoundary);
17301731
}
17311732
_relayoutBoundary = relayoutBoundary;
17321733
assert(!_debugMutationsLocked);

0 commit comments

Comments
 (0)