Unverified Commit d2bc74aa authored by Kaushik Iska's avatar Kaushik Iska Committed by GitHub

Fix analyzer issues for onReportTiming to frameTiming (#38840)

Filed: https://github.com/flutter/flutter/issues/38838
to track these usages.

This was introduced by: https://github.com/flutter/engine/pull/11041
parent ecf9748a
...@@ -202,6 +202,8 @@ mixin SchedulerBinding on BindingBase, ServicesBinding { ...@@ -202,6 +202,8 @@ mixin SchedulerBinding on BindingBase, ServicesBinding {
if (!kReleaseMode) { if (!kReleaseMode) {
int frameNumber = 0; int frameNumber = 0;
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
window.onReportTimings = (List<FrameTiming> timings) { window.onReportTimings = (List<FrameTiming> timings) {
for (FrameTiming frameTiming in timings) { for (FrameTiming frameTiming in timings) {
frameNumber += 1; frameNumber += 1;
......
...@@ -741,7 +741,11 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB ...@@ -741,7 +741,11 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
if (_needToReportFirstFrame && _reportFirstFrame) { if (_needToReportFirstFrame && _reportFirstFrame) {
assert(!_firstFrameCompleter.isCompleted); assert(!_firstFrameCompleter.isCompleted);
// TODO(liyuqian): use a broadcast stream approach // TODO(liyuqian): use a broadcast stream approach
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
final TimingsCallback oldCallback = WidgetsBinding.instance.window.onReportTimings; final TimingsCallback oldCallback = WidgetsBinding.instance.window.onReportTimings;
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
WidgetsBinding.instance.window.onReportTimings = (List<FrameTiming> timings) { WidgetsBinding.instance.window.onReportTimings = (List<FrameTiming> timings) {
if (!kReleaseMode) { if (!kReleaseMode) {
developer.Timeline.instantSync('Rasterized first useful frame'); developer.Timeline.instantSync('Rasterized first useful frame');
...@@ -750,6 +754,8 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB ...@@ -750,6 +754,8 @@ mixin WidgetsBinding on BindingBase, SchedulerBinding, GestureBinding, RendererB
if (oldCallback != null) { if (oldCallback != null) {
oldCallback(timings); oldCallback(timings);
} }
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
WidgetsBinding.instance.window.onReportTimings = oldCallback; WidgetsBinding.instance.window.onReportTimings = oldCallback;
_firstFrameCompleter.complete(); _firstFrameCompleter.complete();
}; };
......
...@@ -79,7 +79,11 @@ class TestServiceExtensionsBinding extends BindingBase ...@@ -79,7 +79,11 @@ class TestServiceExtensionsBinding extends BindingBase
await flushMicrotasks(); await flushMicrotasks();
if (ui.window.onDrawFrame != null) if (ui.window.onDrawFrame != null)
ui.window.onDrawFrame(); ui.window.onDrawFrame();
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
if (ui.window.onReportTimings != null) if (ui.window.onReportTimings != null)
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
ui.window.onReportTimings(<ui.FrameTiming>[]); ui.window.onReportTimings(<ui.FrameTiming>[]);
} }
......
...@@ -132,6 +132,8 @@ void main() { ...@@ -132,6 +132,8 @@ void main() {
}); });
test('Flutter.Frame event fired', () async { test('Flutter.Frame event fired', () async {
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
window.onReportTimings(<FrameTiming>[FrameTiming(<int>[ window.onReportTimings(<FrameTiming>[FrameTiming(<int>[
// build start, build finish // build start, build finish
10000, 15000, 10000, 15000,
......
...@@ -272,9 +272,13 @@ class TestWindow implements Window { ...@@ -272,9 +272,13 @@ class TestWindow implements Window {
} }
@override @override
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
TimingsCallback get onReportTimings => _window.onReportTimings; TimingsCallback get onReportTimings => _window.onReportTimings;
@override @override
set onReportTimings(TimingsCallback callback) { set onReportTimings(TimingsCallback callback) {
// use frameTimings. https://github.com/flutter/flutter/issues/38838
// ignore: deprecated_member_use
_window.onReportTimings = callback; _window.onReportTimings = callback;
} }
......
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