mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Reuse a TimelineTask for the scheduler frame and animate events (#90168)
This commit is contained in:
parent
4889064ff5
commit
c2f452c0a8
@ -55,7 +55,7 @@ void main() {
|
||||
},
|
||||
<String, dynamic>{
|
||||
'name': 'listener',
|
||||
'args': <String, dynamic>{'parentId': '0', 'isolateId': isolateId}
|
||||
'args': <String, dynamic>{'isolateId': isolateId}
|
||||
},
|
||||
<String, dynamic>{
|
||||
'name': 'ImageCache.clear',
|
||||
|
@ -996,8 +996,7 @@ mixin SchedulerBinding on BindingBase {
|
||||
handleDrawFrame();
|
||||
}
|
||||
|
||||
TimelineTask? _frameTimelineTask;
|
||||
TimelineTask? _animateTimelineTask;
|
||||
final TimelineTask? _frameTimelineTask = kReleaseMode ? null : TimelineTask();
|
||||
|
||||
/// Called by the engine to prepare the framework to produce a new frame.
|
||||
///
|
||||
@ -1023,7 +1022,7 @@ mixin SchedulerBinding on BindingBase {
|
||||
/// statements printed during a frame from those printed between frames (e.g.
|
||||
/// in response to events or timers).
|
||||
void handleBeginFrame(Duration? rawTimeStamp) {
|
||||
_frameTimelineTask = TimelineTask()..start('Frame', arguments: timelineArgumentsIndicatingLandmarkEvent);
|
||||
_frameTimelineTask?.start('Frame', arguments: timelineArgumentsIndicatingLandmarkEvent);
|
||||
_firstRawTimeStampInEpoch ??= rawTimeStamp;
|
||||
_currentFrameTimeStamp = _adjustForEpoch(rawTimeStamp ?? _lastRawTimeStamp);
|
||||
if (rawTimeStamp != null)
|
||||
@ -1050,7 +1049,7 @@ mixin SchedulerBinding on BindingBase {
|
||||
_hasScheduledFrame = false;
|
||||
try {
|
||||
// TRANSIENT FRAME CALLBACKS
|
||||
_animateTimelineTask = TimelineTask()..start('Animate', arguments: timelineArgumentsIndicatingLandmarkEvent);
|
||||
_frameTimelineTask?.start('Animate', arguments: timelineArgumentsIndicatingLandmarkEvent);
|
||||
_schedulerPhase = SchedulerPhase.transientCallbacks;
|
||||
final Map<int, _FrameCallbackEntry> callbacks = _transientCallbacks;
|
||||
_transientCallbacks = <int, _FrameCallbackEntry>{};
|
||||
@ -1075,8 +1074,7 @@ mixin SchedulerBinding on BindingBase {
|
||||
/// useful when working with frame callbacks.
|
||||
void handleDrawFrame() {
|
||||
assert(_schedulerPhase == SchedulerPhase.midFrameMicrotasks);
|
||||
_animateTimelineTask?.finish(); // end the "Animate" phase
|
||||
_animateTimelineTask = null;
|
||||
_frameTimelineTask?.finish(); // end the "Animate" phase
|
||||
try {
|
||||
// PERSISTENT FRAME CALLBACKS
|
||||
_schedulerPhase = SchedulerPhase.persistentCallbacks;
|
||||
@ -1093,7 +1091,6 @@ mixin SchedulerBinding on BindingBase {
|
||||
} finally {
|
||||
_schedulerPhase = SchedulerPhase.idle;
|
||||
_frameTimelineTask?.finish(); // end the Frame
|
||||
_frameTimelineTask = null;
|
||||
assert(() {
|
||||
if (debugPrintEndFrameBanner)
|
||||
debugPrint('▀' * _debugBanner!.length);
|
||||
|
Loading…
Reference in New Issue
Block a user