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:
committed by
GitHub
parent
0b392665bf
commit
741598d848
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user