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