From f20e9350d26ef422bea1e6625bd535567ff2f1eb Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Thu, 18 Jul 2019 14:42:33 -0700 Subject: [PATCH] Fix failure of the onReportTimings window hook test (#9923) --- lib/ui/window.dart | 10 ++++++++-- testing/dart/window_hooks_integration_test.dart | 2 ++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/ui/window.dart b/lib/ui/window.dart index dee2d166470..15fc89e65ad 100644 --- a/lib/ui/window.dart +++ b/lib/ui/window.dart @@ -39,6 +39,9 @@ typedef PlatformMessageResponseCallback = void Function(ByteData data); /// Signature for [Window.onPlatformMessage]. typedef PlatformMessageCallback = void Function(String name, ByteData data, PlatformMessageResponseCallback callback); +// Signature for _setNeedsReportTimings. +typedef _SetNeedsReportTimingsFunc = void Function(bool value); + /// Various important time points in the lifetime of a frame. /// /// [FrameTiming] records a timestamp of each phase for performance analysis. @@ -567,7 +570,9 @@ class Locale { /// [Window.viewPadding] anyway, so there is no need to account for that in the /// [Window.padding], which is always safe to use for such calculations. class Window { - Window._(); + Window._() { + _setNeedsReportTimings = _nativeSetNeedsReportTimings; + } /// The number of device pixels for each logical pixel. This number might not /// be a power of two. Indeed, it might not even be an integer. For example, @@ -922,7 +927,8 @@ class Window { _onReportTimingsZone = Zone.current; } - void _setNeedsReportTimings(bool value) native 'Window_setNeedsReportTimings'; + _SetNeedsReportTimingsFunc _setNeedsReportTimings; + void _nativeSetNeedsReportTimings(bool value) native 'Window_setNeedsReportTimings'; /// A callback that is invoked when pointer data is available. /// diff --git a/testing/dart/window_hooks_integration_test.dart b/testing/dart/window_hooks_integration_test.dart index 1a6504d7749..d516a3a583e 100644 --- a/testing/dart/window_hooks_integration_test.dart +++ b/testing/dart/window_hooks_integration_test.dart @@ -153,6 +153,8 @@ void main() { Zone innerZone; Zone runZone; + window._setNeedsReportTimings = (bool _) {}; + runZoned(() { innerZone = Zone.current; window.onReportTimings = (List timings) {