From 211615fc6391cc06afee304e4fb91a1f11ed3f7b Mon Sep 17 00:00:00 2001 From: Florian Loitsch Date: Wed, 6 Jun 2018 11:43:43 +0200 Subject: [PATCH] Disable engine calls doring layout_bench. (#18163) --- .../microbenchmarks/lib/stocks/layout_bench.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart b/dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart index 777fbc1a62..5c2af6ebfa 100644 --- a/dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart +++ b/dev/benchmarks/microbenchmarks/lib/stocks/layout_bench.dart @@ -33,6 +33,11 @@ Future main() async { await tester.pump(); // Start drawer animation await tester.pump(const Duration(seconds: 1)); // Complete drawer animation + + // Disable calls from the engine which would interfere with the benchmark. + ui.window.onBeginFrame = null; + ui.window.onDrawFrame = null; + final TestViewConfiguration big = new TestViewConfiguration(size: const Size(360.0, 640.0)); final TestViewConfiguration small = new TestViewConfiguration(size: const Size(355.0, 635.0)); final RenderView renderView = WidgetsBinding.instance.renderView; @@ -47,8 +52,8 @@ Future main() async { // frames are missed, etc. // We use Timer.run to ensure there's a microtask flush in between // the two calls below. - Timer.run(() { ui.window.onBeginFrame(new Duration(milliseconds: iterations * 16)); }); - Timer.run(() { ui.window.onDrawFrame(); }); + Timer.run(() { binding.handleBeginFrame(new Duration(milliseconds: iterations * 16)); }); + Timer.run(() { binding.handleDrawFrame(); }); await tester.idle(); // wait until the frame has run (also uses Timer.run) iterations += 1; }