Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix issue where DevTools would not be immediately available when using --start-paused" #128117

Merged
merged 1 commit into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
40 changes: 8 additions & 32 deletions packages/flutter_tools/lib/src/resident_devtools_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ abstract class ResidentDevtoolsHandler {
Future<void> serveAndAnnounceDevTools({
Uri? devToolsServerAddress,
required List<FlutterDevice?> flutterDevices,
bool isStartPaused = false,
});

bool launchDevToolsInBrowser({required List<FlutterDevice?> flutterDevices});
Expand Down Expand Up @@ -72,7 +71,6 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
Future<void> serveAndAnnounceDevTools({
Uri? devToolsServerAddress,
required List<FlutterDevice?> flutterDevices,
bool isStartPaused = false,
}) async {
assert(!_readyToAnnounce);
if (!_residentRunner.supportsServiceProtocol || _devToolsLauncher == null) {
Expand All @@ -90,14 +88,20 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
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);

final Uri? devToolsUrl = _devToolsLauncher!.devToolsUrl;
if (devToolsUrl != null) {
for (final FlutterDevice? device in flutterDevices) {
for (final FlutterDevice? device in devicesWithExtension) {
if (device == null) {
continue;
}
Expand All @@ -107,35 +111,11 @@ class FlutterResidentDevtoolsHandler implements ResidentDevtoolsHandler {
}
}

Future<void> callServiceExtensions() async {
final List<FlutterDevice?> devicesWithExtension = await _devicesWithExtensions(flutterDevices);
await Future.wait(
<Future<void>>[
_maybeCallDevToolsUriServiceExtension(devicesWithExtension),
_callConnectedVmServiceUriExtension(devicesWithExtension)
]
);
}

// If the application is starting paused, we can't invoke service extensions
// as they're handled on the target app's paused isolate. Since invoking
// service extensions will block in this situation, we should wait to invoke
// them until after we've output the DevTools connection details.
if (!isStartPaused) {
await callServiceExtensions();
}

_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.
_residentRunner.printDebuggerList(includeVmService: false);
}

if (isStartPaused) {
await callServiceExtensions();
}
}

// This must be guaranteed not to return a Future that fails.
Expand Down Expand Up @@ -315,11 +295,7 @@ class NoOpDevtoolsHandler implements ResidentDevtoolsHandler {
}

@override
Future<void> serveAndAnnounceDevTools({
Uri? devToolsServerAddress,
List<FlutterDevice?>? flutterDevices,
bool isStartPaused = false,
}) async {
Future<void> serveAndAnnounceDevTools({Uri? devToolsServerAddress, List<FlutterDevice?>? flutterDevices}) async {
return;
}

Expand Down
2 changes: 0 additions & 2 deletions packages/flutter_tools/lib/src/run_cold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class ColdRunner extends ResidentRunner {
unawaited(residentDevtoolsHandler!.serveAndAnnounceDevTools(
devToolsServerAddress: debuggingOptions.devToolsServerAddress,
flutterDevices: flutterDevices,
isStartPaused: debuggingOptions.startPaused,
));
}
if (debuggingOptions.serveObservatory) {
Expand Down Expand Up @@ -174,7 +173,6 @@ class ColdRunner extends ResidentRunner {
unawaited(residentDevtoolsHandler!.serveAndAnnounceDevTools(
devToolsServerAddress: debuggingOptions.devToolsServerAddress,
flutterDevices: flutterDevices,
isStartPaused: debuggingOptions.startPaused,
));
}
if (debuggingOptions.serveObservatory) {
Expand Down
1 change: 0 additions & 1 deletion packages/flutter_tools/lib/src/run_hot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ class HotRunner extends ResidentRunner {
unawaited(residentDevtoolsHandler!.serveAndAnnounceDevTools(
devToolsServerAddress: debuggingOptions.devToolsServerAddress,
flutterDevices: flutterDevices,
isStartPaused: debuggingOptions.startPaused,
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,14 @@ void main() {
},
),
listViews,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.activeDevToolsServerAddress',
args: <String, Object>{
'isolateId': '1',
'value': 'http://localhost:8080',
},
),
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.connectedVmServiceUri',
args: <String, Object>{
Expand Down Expand Up @@ -314,14 +314,14 @@ void main() {
},
),
listViews,
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.activeDevToolsServerAddress',
args: <String, Object>{
'isolateId': '1',
'value': 'http://localhost:8080',
},
),
listViews,
const FakeVmServiceRequest(
method: 'ext.flutter.connectedVmServiceUri',
args: <String, Object>{
Expand Down

This file was deleted.