From 1a79592b4a23b2c7ef568b3440a193f44424d20b Mon Sep 17 00:00:00 2001 From: Ferhat Date: Wed, 26 Feb 2020 15:53:19 -0800 Subject: [PATCH] Reduce closure allocation in RenderObject.cleanRelayoutBoundary (#51439) --- packages/flutter/lib/src/rendering/object.dart | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index 346b6cc2b5..87a81a631e 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -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);