[tool] remove some temporary printTrace calls (#151074)

Cleans up printTrace calls added while investigating https://github.com/flutter/flutter/issues/146879.

Also makes[ this `catch` clause ](https://github.com/flutter/flutter/pull/151074/files#diff-214723283174eb75e740a102252215723aa56716226ea92d084ef8a5bea4e931L578-R581)more precise.
This commit is contained in:
Andrew Kolos
2024-07-01 17:53:19 -07:00
committed by GitHub
parent d07a165d22
commit 271e0427e3
5 changed files with 19 additions and 23 deletions

View File

@@ -172,7 +172,11 @@ class ResidentWebRunner extends ResidentRunner {
final vmservice.VmService? service = _connectionResult?.vmService;
final Uri websocketUri = Uri.parse(_connectionResult!.debugConnection!.uri);
final Uri httpUri = _httpUriFromWebsocketUri(websocketUri);
return _instance ??= FlutterVmService(service!, wsAddress: websocketUri, httpAddress: httpUri, logger: _logger);
return _instance ??= FlutterVmService(
service!,
wsAddress: websocketUri,
httpAddress: httpUri,
);
}
FlutterVmService? _instance;

View File

@@ -417,7 +417,7 @@ Future<FlutterVmService> _connect(
// This call is to ensure we are able to establish a connection instead of
// keeping on trucking and failing farther down the process.
await delegateService.getVersion();
return FlutterVmService(service, httpAddress: httpUri, wsAddress: wsUri, logger: logger);
return FlutterVmService(service, httpAddress: httpUri, wsAddress: wsUri);
}
String _validateRpcStringParam(String methodName, Map<String, Object?> params, String paramName) {
@@ -486,13 +486,11 @@ class FlutterVmService {
this.service, {
this.wsAddress,
this.httpAddress,
required Logger logger,
}) : _logger = logger;
});
final vm_service.VmService service;
final Uri? wsAddress;
final Uri? httpAddress;
final Logger _logger;
Future<vm_service.Response?> callMethodWrapper(
String method, {
@@ -571,22 +569,19 @@ class FlutterVmService {
required Uri main,
required Uri assetsDirectory,
}) async {
_logger.printTrace('Running $main in view $viewId...');
try {
await service.streamListen(vm_service.EventStreams.kIsolate);
} on vm_service.RPCError catch (e) {
_logger.printTrace(
'Unable to listen to VM service stream "${vm_service.EventStreams.kIsolate}".\n'
'Error: $e',
);
// Do nothing, since the tool is already subscribed.
// Do nothing if the tool is already subscribed.
const int streamAlreadySubscribed = 103;
if (e.code != streamAlreadySubscribed) {
rethrow;
}
}
final Future<void> onRunnable = service.onIsolateEvent.firstWhere((vm_service.Event event) {
_logger.printTrace('runInView VM service onIsolateEvent listener received $event');
return event.kind == vm_service.EventKind.kIsolateRunnable;
});
_logger.printTrace('Calling $kRunInViewMethod...');
await callMethodWrapper(
kRunInViewMethod,
args: <String, Object>{
@@ -595,9 +590,7 @@ class FlutterVmService {
'assetDirectory': assetsDirectory.toString(),
},
);
_logger.printTrace('Finished $kRunInViewMethod');
await onRunnable;
_logger.printTrace('Finished running $main in view $viewId');
}
/// Renders the last frame with additional raster tracing enabled.