Fix restart/reload benchmark synchronization (#11282)

Changes introduced in
8ba522eeae
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
This commit is contained in:
Carlo Bernaschina
2017-07-19 16:54:10 -07:00
committed by GitHub
parent 0b392665bf
commit 741598d848
2 changed files with 9 additions and 1 deletions

View File

@@ -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();
}
}
}

View File

@@ -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;
}