Commit 741598d8 authored by Carlo Bernaschina's avatar Carlo Bernaschina Committed by GitHub

Fix restart/reload benchmark synchronization (#11282)

Changes introduced in
https://github.com/flutter/engine/commit/8ba522eeae35d8c70ada3c7b8e200ca2274f4f95
has removed from the `_flutter.listViews` the thread synchronization
side effect used during benchmarks.

The thread synchronization is restored via the new
`_flutter.flushUIThreadTasks` RPC.

Fixes https://github.com/flutter/flutter/issues/11241

Related https://github.com/flutter/engine/pull/3898
parent 0b392665
......@@ -153,7 +153,6 @@ class HotRunner extends ResidentRunner {
// Measure time to perform a hot restart.
printStatus('Benchmarking hot restart');
await restart(fullRestart: true);
await refreshViews();
// TODO(johnmccutchan): Modify script entry point.
printStatus('Benchmarking hot reload');
// Measure time to perform a hot reload.
......@@ -313,6 +312,11 @@ class HotRunner extends ResidentRunner {
deviceEntryUri,
devicePackagesUri,
deviceAssetsDirectoryUri);
if (benchmarkMode) {
for (FlutterDevice device in flutterDevices)
for (FlutterView view in device.views)
await view.flushUIThreadTasks();
}
}
}
......
......@@ -1230,6 +1230,10 @@ class FlutterView extends ServiceObject {
bool get hasIsolate => _uiIsolate != null;
Future<Null> flushUIThreadTasks() async {
await owner.vm.invokeRpcRaw('_flutter.flushUIThreadTasks');
}
@override
String toString() => id;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment