Skip to content

Commit

Permalink
Reduce closure allocation in RenderObject.cleanRelayoutBoundary (#51439)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatb authored Feb 26, 2020
1 parent 2132a0c commit 1a79592
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/flutter/lib/src/rendering/object.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1a79592

Please sign in to comment.