Fix failure of the onReportTimings window hook test (#9923)

This commit is contained in:
Jason Simmons 2019-07-18 14:42:33 -07:00 committed by GitHub
parent eaf1f33e56
commit f20e9350d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -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.
///

View File

@ -153,6 +153,8 @@ void main() {
Zone innerZone;
Zone runZone;
window._setNeedsReportTimings = (bool _) {};
runZoned(() {
innerZone = Zone.current;
window.onReportTimings = (List<FrameTiming> timings) {