[web_benchmarks] Fix _RecordingWidgetsBinding to conform to latest API (#700)

This commit is contained in:
David Iglesias
2022-02-08 13:15:23 -08:00
committed by GitHub
parent 7658cf8a09
commit a7c287bd2a
4 changed files with 22 additions and 6 deletions

View File

@ -1 +1 @@
185bc093e04bd855bb6aabdfab26d4620e2f3f8f
f483b7d808315411fc6ccba66cab8807cee2d371

View File

@ -1,3 +1,7 @@
## 0.0.6
* Update implementation of `_RecordingWidgetsBinding` to match the [new Binding API](https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/foundation/binding.dart#L96-L128)
## 0.0.5
* Updated dependencies to allow broader versions for upstream packages.

View File

@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.7
import 'dart:async';
import 'dart:html' as html;
import 'dart:js';
import 'dart:js_util' as js_util;
import 'dart:math' as math;
import 'dart:ui';
@ -1031,12 +1034,21 @@ class _RecordingWidgetsBinding extends BindingBase
SemanticsBinding,
RendererBinding,
WidgetsBinding {
@override
void initInstances() {
super.initInstances();
_instance = this;
}
static _RecordingWidgetsBinding get instance => _instance;
static _RecordingWidgetsBinding _instance;
/// Makes an instance of [_RecordingWidgetsBinding] the current binding.
static _RecordingWidgetsBinding ensureInitialized() {
if (WidgetsBinding.instance == null) {
if (_RecordingWidgetsBinding.instance == null) {
_RecordingWidgetsBinding();
}
return WidgetsBinding.instance;
return _RecordingWidgetsBinding.instance;
}
FrameRecorder _recorder;
@ -1216,7 +1228,7 @@ void registerEngineBenchmarkValueListener(
if (_engineBenchmarkListeners.isEmpty) {
// The first listener is being registered. Register the global listener.
js_util.setProperty(html.window, '_flutter_internal_on_benchmark',
_dispatchEngineBenchmarkValue);
allowInterop(_dispatchEngineBenchmarkValue));
}
_engineBenchmarkListeners[name] = listener;

View File

@ -2,11 +2,11 @@ name: web_benchmarks
description: A benchmark harness for performance-testing Flutter apps in Chrome.
repository: https://github.com/flutter/packages/tree/main/packages/web_benchmarks
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+web_benchmarks%22
version: 0.0.5
version: 0.0.6
environment:
sdk: ">=2.7.0 <3.0.0"
flutter: ">=1.17.0"
flutter: ">=2.10.0"
# Using +2 upper limit on some packages to allow null-safe versions
dependencies: