This reverts commit e2490f2906.
This commit is contained in:
@@ -41,7 +41,7 @@ class _FilteredChildAnimationPageState extends State<FilteredChildAnimationPage>
|
||||
_filterType = widget.initialFilterType;
|
||||
_complexChild = widget.initialComplexChild;
|
||||
_useRepaintBoundary = widget.initialUseRepaintBoundary;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
WidgetsBinding.instance!.addPostFrameCallback((_) {
|
||||
final RenderBox childBox = _childKey.currentContext!.findRenderObject()! as RenderBox;
|
||||
_childCenter = childBox.paintBounds.center;
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ class LargeImagesPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final ImageCache imageCache = PaintingBinding.instance.imageCache;
|
||||
final ImageCache imageCache = PaintingBinding.instance!.imageCache!;
|
||||
imageCache.maximumSize = 30;
|
||||
imageCache.maximumSizeBytes = 50 << 20;
|
||||
return GridView.builder(
|
||||
|
||||
@@ -66,7 +66,7 @@ class BenchMouseRegionGridHover extends WidgetRecorder {
|
||||
void frameDidDraw() {
|
||||
if (!started) {
|
||||
started = true;
|
||||
SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) async {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((Duration timeStamp) async {
|
||||
_tester.start();
|
||||
registerDidStop(_tester.stop);
|
||||
});
|
||||
@@ -124,7 +124,7 @@ class _UntilNextFrame {
|
||||
static Future<void> wait() {
|
||||
if (_UntilNextFrame._completer == null) {
|
||||
_UntilNextFrame._completer = Completer<void>();
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((_) {
|
||||
_UntilNextFrame._completer!.complete(null);
|
||||
_UntilNextFrame._completer = null;
|
||||
});
|
||||
@@ -145,7 +145,7 @@ class _Tester {
|
||||
TestGesture get gesture {
|
||||
return _gesture ??= TestGesture(
|
||||
dispatcher: (PointerEvent event) async {
|
||||
RendererBinding.instance.handlePointerEvent(event);
|
||||
RendererBinding.instance!.handlePointerEvent(event);
|
||||
},
|
||||
kind: PointerDeviceKind.mouse,
|
||||
);
|
||||
|
||||
@@ -41,7 +41,7 @@ class BenchMouseRegionGridScroll extends WidgetRecorder {
|
||||
void frameDidDraw() {
|
||||
if (!started) {
|
||||
started = true;
|
||||
SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) async {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((Duration timeStamp) async {
|
||||
_tester.start();
|
||||
registerDidStop(_tester.stop);
|
||||
});
|
||||
@@ -96,7 +96,7 @@ class _UntilNextFrame {
|
||||
static Future<void> wait() {
|
||||
if (_UntilNextFrame._completer == null) {
|
||||
_UntilNextFrame._completer = Completer<void>();
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((_) {
|
||||
_UntilNextFrame._completer!.complete(null);
|
||||
_UntilNextFrame._completer = null;
|
||||
});
|
||||
@@ -117,7 +117,7 @@ class _Tester {
|
||||
TestGesture get gesture {
|
||||
return _gesture ??= TestGesture(
|
||||
dispatcher: (PointerEvent event) async {
|
||||
RendererBinding.instance.handlePointerEvent(event);
|
||||
RendererBinding.instance!.handlePointerEvent(event);
|
||||
},
|
||||
kind: PointerDeviceKind.mouse,
|
||||
);
|
||||
|
||||
@@ -85,7 +85,7 @@ class BenchMouseRegionMixedGridHover extends WidgetRecorder {
|
||||
void frameDidDraw() {
|
||||
if (!started) {
|
||||
started = true;
|
||||
SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) async {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((Duration timeStamp) async {
|
||||
_tester.start();
|
||||
registerDidStop(_tester.stop);
|
||||
});
|
||||
@@ -146,7 +146,7 @@ class _UntilNextFrame {
|
||||
static Future<void> wait() {
|
||||
if (_UntilNextFrame._completer == null) {
|
||||
_UntilNextFrame._completer = Completer<void>();
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
SchedulerBinding.instance!.addPostFrameCallback((_) {
|
||||
_UntilNextFrame._completer!.complete(null);
|
||||
_UntilNextFrame._completer = null;
|
||||
});
|
||||
@@ -167,7 +167,7 @@ class _Tester {
|
||||
TestGesture get gesture {
|
||||
return _gesture ??= TestGesture(
|
||||
dispatcher: (PointerEvent event) async {
|
||||
RendererBinding.instance.handlePointerEvent(event);
|
||||
RendererBinding.instance!.handlePointerEvent(event);
|
||||
},
|
||||
kind: PointerDeviceKind.mouse,
|
||||
);
|
||||
|
||||
@@ -935,7 +935,7 @@ double _computeAverage(String label, Iterable<double> values) {
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * <https://en.wikipedia.org/wiki/Standard_deviation>
|
||||
/// * https://en.wikipedia.org/wiki/Standard_deviation
|
||||
double _computeStandardDeviationForPopulation(String label, Iterable<double> population) {
|
||||
if (population.isEmpty) {
|
||||
throw StateError('$label: attempted to compute the standard deviation of empty population.');
|
||||
@@ -987,32 +987,12 @@ class _RecordingWidgetsBinding extends BindingBase
|
||||
SemanticsBinding,
|
||||
RendererBinding,
|
||||
WidgetsBinding {
|
||||
|
||||
@override
|
||||
void initInstances() {
|
||||
super.initInstances();
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
/// The singleton instance of this object.
|
||||
///
|
||||
/// Provides access to the features exposed by this class. The binding must
|
||||
/// be initialized before using this getter; this is typically done by calling
|
||||
/// [_RecordingWidgetsBinding.ensureInitialized].
|
||||
static _RecordingWidgetsBinding get instance => BindingBase.checkInstance(_instance);
|
||||
static _RecordingWidgetsBinding? _instance;
|
||||
|
||||
/// Returns an instance of the [_RecordingWidgetsBinding], creating and
|
||||
/// initializing it if necessary.
|
||||
///
|
||||
/// See also:
|
||||
///
|
||||
/// * [WidgetsFlutterBinding.ensureInitialized], the equivalent in the widgets framework.
|
||||
/// Makes an instance of [_RecordingWidgetsBinding] the current binding.
|
||||
static _RecordingWidgetsBinding ensureInitialized() {
|
||||
if (_instance == null) {
|
||||
if (WidgetsBinding.instance == null) {
|
||||
_RecordingWidgetsBinding();
|
||||
}
|
||||
return instance;
|
||||
return WidgetsBinding.instance! as _RecordingWidgetsBinding;
|
||||
}
|
||||
|
||||
FrameRecorder? _recorder;
|
||||
|
||||
@@ -10,7 +10,8 @@ import 'package:integration_test/integration_test.dart';
|
||||
import 'package:macrobenchmarks/src/simple_scroll.dart';
|
||||
|
||||
void main() {
|
||||
final IntegrationTestWidgetsFlutterBinding binding = IntegrationTestWidgetsFlutterBinding.ensureInitialized();
|
||||
final IntegrationTestWidgetsFlutterBinding binding =
|
||||
IntegrationTestWidgetsFlutterBinding.ensureInitialized() as IntegrationTestWidgetsFlutterBinding;
|
||||
testWidgets(
|
||||
'Frame Counter and Input Delay for benchmarkLive',
|
||||
(WidgetTester tester) async {
|
||||
|
||||
@@ -10,8 +10,8 @@ import 'package:macrobenchmarks/main.dart';
|
||||
|
||||
Future<void> endOfAnimation() async {
|
||||
do {
|
||||
await SchedulerBinding.instance.endOfFrame;
|
||||
} while (SchedulerBinding.instance.hasScheduledFrame);
|
||||
await SchedulerBinding.instance!.endOfFrame;
|
||||
} while (SchedulerBinding.instance!.hasScheduledFrame);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
|
||||
@@ -10,8 +10,8 @@ import 'package:macrobenchmarks/main.dart';
|
||||
|
||||
Future<void> endOfAnimation() async {
|
||||
do {
|
||||
await SchedulerBinding.instance.endOfFrame;
|
||||
} while (SchedulerBinding.instance.hasScheduledFrame);
|
||||
await SchedulerBinding.instance!.endOfFrame;
|
||||
} while (SchedulerBinding.instance!.hasScheduledFrame);
|
||||
}
|
||||
|
||||
Future<void> main() async {
|
||||
|
||||
Reference in New Issue
Block a user