Attempt to mitigate flakiness around devtools (#94879)
This commit is contained in:
@@ -60,7 +60,10 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
|
||||
bool launchedInBrowser = false;
|
||||
|
||||
@override
|
||||
DevToolsServerAddress get activeDevToolsServer => _devToolsLauncher?.activeDevToolsServer;
|
||||
DevToolsServerAddress get activeDevToolsServer {
|
||||
assert(!_readyToAnnounce || _devToolsLauncher?.activeDevToolsServer != null);
|
||||
return _devToolsLauncher?.activeDevToolsServer;
|
||||
}
|
||||
|
||||
@override
|
||||
bool get readyToAnnounce => _readyToAnnounce;
|
||||
@@ -72,6 +75,7 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
|
||||
Uri devToolsServerAddress,
|
||||
@required List<FlutterDevice> flutterDevices,
|
||||
}) async {
|
||||
assert(!_readyToAnnounce);
|
||||
if (!_residentRunner.supportsServiceProtocol || _devToolsLauncher == null) {
|
||||
return;
|
||||
}
|
||||
@@ -82,14 +86,20 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
|
||||
_served = true;
|
||||
}
|
||||
await _devToolsLauncher.ready;
|
||||
// Do not attempt to print debugger list if the connection has failed.
|
||||
if (_devToolsLauncher.activeDevToolsServer == null) {
|
||||
// Do not attempt to print debugger list if the connection has failed or if we're shutting down.
|
||||
if (_devToolsLauncher.activeDevToolsServer == null || _shutdown) {
|
||||
assert(!_readyToAnnounce);
|
||||
return;
|
||||
}
|
||||
final List<FlutterDevice> devicesWithExtension = await _devicesWithExtensions(flutterDevices);
|
||||
await _maybeCallDevToolsUriServiceExtension(devicesWithExtension);
|
||||
await _callConnectedVmServiceUriExtension(devicesWithExtension);
|
||||
if (_shutdown) {
|
||||
// If we're shutting down, no point reporting the debugger list.
|
||||
return;
|
||||
}
|
||||
_readyToAnnounce = true;
|
||||
assert(_devToolsLauncher.activeDevToolsServer != null);
|
||||
if (_residentRunner.reportedDebuggers) {
|
||||
// Since the DevTools only just became available, we haven't had a chance to
|
||||
// report their URLs yet. Do so now.
|
||||
@@ -248,6 +258,7 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
|
||||
return;
|
||||
}
|
||||
_shutdown = true;
|
||||
_readyToAnnounce = false;
|
||||
await _devToolsLauncher.close();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user