Skip to content

Commit

Permalink
Fix failure of the onReportTimings window hook test (flutter#9923)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons authored Jul 18, 2019
1 parent eaf1f33 commit f20e935
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
///
Expand Down
2 changes: 2 additions & 0 deletions testing/dart/window_hooks_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ void main() {
Zone innerZone;
Zone runZone;

window._setNeedsReportTimings = (bool _) {};

runZoned(() {
innerZone = Zone.current;
window.onReportTimings = (List<FrameTiming> timings) {
Expand Down

0 comments on commit f20e935

Please sign in to comment.