Skip to content

Commit cb9a3f6

Browse files
authored
Add timeline events for post frame callbacks (flutter#136435)
Before this change, long-running post-frame callbacks wouldn't show up in the timeline at all. This adds a timeline event for post-frame callbacks, with a debug flag that will add timeline events for each individual callback. #testexempt -- we have no way to test calls to the timeline.
1 parent 024e0da commit cb9a3f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+126
-73
lines changed

packages/flutter/lib/src/cupertino/context_menu.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ class _CupertinoContextMenuState extends State<CupertinoContextMenu> with Ticker
585585
_lastOverlayEntry?.dispose();
586586
_lastOverlayEntry = null;
587587
_openController.reset();
588-
});
588+
}, debugLabel: 'removeContextMenuDecoy');
589589

590590
case AnimationStatus.forward:
591591
case AnimationStatus.reverse:
@@ -1009,7 +1009,7 @@ class _ContextMenuRoute<T> extends PopupRoute<T> {
10091009
_updateTweenRects();
10101010
_internalOffstage = false;
10111011
_setOffstageInternally();
1012-
});
1012+
}, debugLabel: 'renderContextMenuRouteOffstage');
10131013
return super.didPush();
10141014
}
10151015

packages/flutter/lib/src/cupertino/date_picker.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ class _CupertinoDatePickerDateTimeState extends State<CupertinoDatePicker> {
10071007
final int position = minCheck ? positionDouble.ceil() : positionDouble.floor();
10081008
_animateColumnControllerToItem(minuteController, position);
10091009
}
1010-
});
1010+
}, debugLabel: 'DatePicker.scrollToDate');
10111011
}
10121012

10131013
@override
@@ -1401,7 +1401,7 @@ class _CupertinoDatePickerDateState extends State<CupertinoDatePicker> {
14011401
if (selectedDay != newDate.day) {
14021402
_animateColumnControllerToItem(dayController, newDate.day - 1);
14031403
}
1404-
});
1404+
}, debugLabel: 'DatePicker.scrollToDate');
14051405
}
14061406

14071407
@override
@@ -1725,7 +1725,7 @@ class _CupertinoDatePickerMonthYearState extends State<CupertinoDatePicker> {
17251725
if (selectedMonth != newDate.month) {
17261726
_animateColumnControllerToItem(monthController, newDate.month - 1);
17271727
}
1728-
});
1728+
}, debugLabel: 'DatePicker.scrollToDate');
17291729
}
17301730

17311731
@override

packages/flutter/lib/src/cupertino/refresh.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ class _CupertinoSliverRefreshControlState extends State<CupertinoSliverRefreshCo
461461
} else {
462462
SchedulerBinding.instance.addPostFrameCallback((Duration timestamp) {
463463
setState(() => hasSliverLayoutExtent = false);
464-
});
464+
}, debugLabel: 'Refresh.goToDone');
465465
}
466466
}
467467

@@ -497,7 +497,7 @@ class _CupertinoSliverRefreshControlState extends State<CupertinoSliverRefreshCo
497497
}
498498
});
499499
setState(() => hasSliverLayoutExtent = true);
500-
});
500+
}, debugLabel: 'Refresh.transition');
501501
}
502502
return RefreshIndicatorMode.armed;
503503
}

packages/flutter/lib/src/cupertino/spell_check_suggestions_toolbar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class CupertinoSpellCheckSuggestionsToolbar extends StatelessWidget {
130130
if (editableTextState.mounted) {
131131
editableTextState.bringIntoView(editableTextState.textEditingValue.selection.extent);
132132
}
133-
});
133+
}, debugLabel: 'SpellCheckSuggestions.bringIntoView');
134134
editableTextState.hideToolbar();
135135
}
136136

packages/flutter/lib/src/gestures/binding.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ class _Resampler {
175175
_timer = Timer.periodic(_samplingInterval, (_) => _onSampleTimeChanged());
176176
// Trigger an immediate sample time change.
177177
_onSampleTimeChanged();
178-
});
178+
}, debugLabel: 'Resampler.startTimer');
179179
}
180180
}
181181

packages/flutter/lib/src/material/autocomplete.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ class _AutocompleteOptions<T extends Object> extends StatelessWidget {
201201
if (highlight) {
202202
SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) {
203203
Scrollable.ensureVisible(context, alignment: 0.5);
204-
});
204+
}, debugLabel: 'AutocompleteOptions.ensureVisible');
205205
}
206206
return Container(
207207
color: highlight ? Theme.of(context).focusColor : null,

packages/flutter/lib/src/material/dropdown_menu.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> {
423423
setState(() {
424424
leadingPadding = getWidth(_leadingKey);
425425
});
426-
});
426+
}, debugLabel: 'DropdownMenu.refreshLeadingPadding');
427427
}
428428

429429
void scrollToHighlight() {
@@ -432,7 +432,7 @@ class _DropdownMenuState<T> extends State<DropdownMenu<T>> {
432432
if (highlightContext != null) {
433433
Scrollable.ensureVisible(highlightContext);
434434
}
435-
});
435+
}, debugLabel: 'DropdownMenu.scrollToHighlight');
436436
}
437437

438438
double? getWidth(GlobalKey key) {

packages/flutter/lib/src/material/input_date_picker_form_field.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class _InputDatePickerFormFieldState extends State<InputDatePickerFormField> {
174174
_selectedDate = widget.initialDate;
175175
_updateValueForSelectedDate();
176176
});
177-
});
177+
}, debugLabel: 'InputDatePickerFormField.update');
178178
}
179179
}
180180

packages/flutter/lib/src/material/menu_anchor.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ _MenuAnchorState? get _previousFocusableSibling {
583583
} else if (!inDispose) {
584584
SchedulerBinding.instance.addPostFrameCallback((_) {
585585
_overlayController.hide();
586-
});
586+
}, debugLabel: 'MenuAnchor.hide');
587587
}
588588
if (!inDispose) {
589589
// Notify that _childIsOpen changed state, but only if not
@@ -1150,7 +1150,7 @@ class _MenuItemButtonState extends State<MenuItemButton> {
11501150
SchedulerBinding.instance.addPostFrameCallback((Duration _) {
11511151
FocusManager.instance.applyFocusChangesIfNeeded();
11521152
widget.onPressed?.call();
1153-
});
1153+
}, debugLabel: 'MenuAnchor.onPressed');
11541154
}
11551155

11561156
void _createInternalFocusNodeIfNeeded() {
@@ -1902,7 +1902,7 @@ class _SubmenuButtonState extends State<SubmenuButton> {
19021902
SchedulerBinding.instance.addPostFrameCallback((_) {
19031903
_menuController._anchor?._focusButton();
19041904
_waitingToFocusMenu = false;
1905-
});
1905+
}, debugLabel: 'MenuAnchor.focus');
19061906
_waitingToFocusMenu = true;
19071907
}
19081908
setState(() { /* Rebuild with updated controller.isOpen value */ });

packages/flutter/lib/src/material/spell_check_suggestions_toolbar.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class SpellCheckSuggestionsToolbar extends StatelessWidget {
142142
if (editableTextState.mounted) {
143143
editableTextState.bringIntoView(editableTextState.textEditingValue.selection.extent);
144144
}
145-
});
145+
}, debugLabel: 'SpellCheckerSuggestionsToolbar.bringIntoView');
146146
editableTextState.hideToolbar();
147147
}
148148

0 commit comments

Comments
 (0)