Unverified Commit fd8a9603 authored by shrike69's avatar shrike69 Committed by GitHub

Remove waitForViews() during hot reload (#22371)

parent 5f739a1e
......@@ -168,7 +168,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
for (int port in ports) {
final VMService vmService = await _getVMService(port);
await vmService.getVM();
await vmService.waitForViews();
await vmService.refreshViews();
views.addAll(vmService.vm.views);
}
return views;
......@@ -268,7 +268,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
for (int port in ports) {
final VMService vmService = await _getVMService(port);
await vmService.getVM();
await vmService.waitForViews();
await vmService.refreshViews();
printStatus(_vmServiceToString(vmService));
}
}
......@@ -307,8 +307,10 @@ class FuchsiaReloadCommand extends FlutterCommand {
throwToolExit('Give the GN target with --gn-target(-g).');
final List<String> targetInfo = _extractPathAndName(gnTarget);
_projectRoot = targetInfo[0];
printTrace('_projectRoot is $_projectRoot');
_projectName = targetInfo[1];
_fuchsiaProjectPath = '$_buildDir/../../$_projectRoot';
printTrace('_fuchsiaProjectPath is $_fuchsiaProjectPath');
if (!_directoryExists(_fuchsiaProjectPath))
throwToolExit('Target does not exist in the Fuchsia tree: $_fuchsiaProjectPath.');
......@@ -330,6 +332,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
// to locate the .packages file.
final String packagesFileName = '${_binaryName}_dart_library.packages';
_dotPackagesPath = '$_buildDir/dartlang/gen/$_projectRoot/$packagesFileName';
printTrace('_dotPackagesPath is $_dotPackagesPath');
if (!_fileExists(_dotPackagesPath))
throwToolExit('Couldn\'t find .packages file at $_dotPackagesPath.');
......
......@@ -100,12 +100,6 @@ class FlutterDevice {
await service.getVM();
}
Future<Null> waitForViews() async {
// Refresh the view list, and wait a bit for the list to populate.
for (VMService service in vmServices)
await service.waitForViews();
}
Future<Null> stopApps() async {
final List<FlutterView> flutterViews = views;
if (flutterViews == null || flutterViews.isEmpty)
......@@ -635,7 +629,7 @@ abstract class ResidentRunner {
await device._connect(reloadSources: reloadSources,
compileExpression: compileExpression);
await device.getVMs();
await device.waitForViews();
await device.refreshViews();
if (device.views.isEmpty)
printStatus('No Flutter views available on ${device.device.name}');
else
......
......@@ -344,17 +344,10 @@ class VMService {
return await _vm.reload();
}
Future<Null> waitForViews({int attempts = 5, int attemptSeconds = 1}) async {
Future<Null> refreshViews() async {
if (!vm.isFlutterEngine)
return;
await vm.refreshViews();
for (int i = 0; (vm.firstView == null) && (i < attempts); i++) {
// If the VM doesn't yet have a view, wait for one to show up.
printTrace('Waiting for Flutter view');
await Future<Null>.delayed(Duration(seconds: attemptSeconds));
await getVM();
await vm.refreshViews();
}
}
}
......
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