Unverified Commit 78a96b09 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter] use engine provided frame number (#82934)

parent 25fa2e6c
......@@ -202,12 +202,8 @@ mixin SchedulerBinding on BindingBase {
_instance = this;
if (!kReleaseMode) {
int frameNumber = 0;
addTimingsCallback((List<FrameTiming> timings) {
for (final FrameTiming frameTiming in timings) {
frameNumber += 1;
_profileFramePostEvent(frameNumber, frameTiming);
}
timings.forEach(_profileFramePostEvent);
});
}
}
......@@ -1103,9 +1099,9 @@ mixin SchedulerBinding on BindingBase {
}
}
void _profileFramePostEvent(int frameNumber, FrameTiming frameTiming) {
void _profileFramePostEvent(FrameTiming frameTiming) {
postEvent('Flutter.Frame', <String, dynamic>{
'number': frameNumber,
'number': frameTiming.frameNumber,
'startTime': frameTiming.timestampInMicroseconds(FramePhase.buildStart),
'elapsed': frameTiming.totalSpan.inMicroseconds,
'build': frameTiming.buildDuration.inMicroseconds,
......
......@@ -143,13 +143,14 @@ void main() {
buildFinish: 15000,
rasterStart: 16000,
rasterFinish: 20000,
frameNumber: 1991
)]);
final List<Map<String, dynamic>> events = scheduler.getEventsDispatched('Flutter.Frame');
expect(events, hasLength(1));
final Map<String, dynamic> event = events.first;
expect(event['number'], isNonNegative);
expect(event['number'], 1991);
expect(event['startTime'], 10000);
expect(event['elapsed'], 15000);
expect(event['build'], 5000);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment