Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 26.2.2

- Fix issue where isolate pause events were not reported correctly when using the web socket proxy service.

## 26.2.1

- Add support for DDS APIs and serving Dart DevTools when no Chrome Debugger is available.
Expand Down
2 changes: 2 additions & 0 deletions dwds/lib/src/connections/app_connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class AppConnection {
final SocketConnection _connection;
final Future<void> _readyToRunMain;

bool get hasStarted => _startedCompleter.isCompleted;

AppConnection(this.request, this._connection, this._readyToRunMain) {
safeUnawaited(_connection.sink.done.then((v) => _doneCompleter.complete()));
}
Expand Down
2 changes: 1 addition & 1 deletion dwds/lib/src/injected/client.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 7 additions & 24 deletions dwds/lib/src/services/web_socket/web_socket_proxy_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@ final class WebSocketProxyService extends ProxyService<WebSocketAppInspector> {
return service;
}

// Isolate state
vm_service.Event? _currentPauseEvent;
bool _mainHasStarted = false;

/// Creates a new isolate for WebSocket debugging.
@override
Future<void> createIsolate(
Expand Down Expand Up @@ -276,7 +272,7 @@ final class WebSocketProxyService extends ProxyService<WebSocketAppInspector> {
timestamp: timestamp,
isolate: isolateRef,
);
_currentPauseEvent = pauseEvent;
inspector.isolate.pauseEvent = pauseEvent;
streamNotify(vm_service.EventStreams.kDebug, pauseEvent);
}

Expand Down Expand Up @@ -383,8 +379,6 @@ final class WebSocketProxyService extends ProxyService<WebSocketAppInspector> {

// Reset state
inspector = null;
_currentPauseEvent = null;
_mainHasStarted = false;

if (initializedCompleter.isCompleted) {
initializedCompleter = Completer<void>();
Expand Down Expand Up @@ -784,13 +778,13 @@ final class WebSocketProxyService extends ProxyService<WebSocketAppInspector> {
value == 'true' &&
oldValue == false) {
// Send pause event for existing isolate if not already paused
if (isIsolateRunning && _currentPauseEvent == null) {
if (isIsolateRunning && inspector.isolate.pauseEvent == null) {
final pauseEvent = vm_service.Event(
kind: vm_service.EventKind.kPauseStart,
timestamp: DateTime.now().millisecondsSinceEpoch,
isolate: inspector.isolateRef,
);
_currentPauseEvent = pauseEvent;
inspector.isolate.pauseEvent = pauseEvent;
streamNotify(vm_service.EventStreams.kDebug, pauseEvent);
}
}
Expand All @@ -812,24 +806,13 @@ final class WebSocketProxyService extends ProxyService<WebSocketAppInspector> {
Future<Success> _resume(String isolateId) async {
if (hasPendingRestart && !resumeAfterRestartEventsController.isClosed) {
resumeAfterRestartEventsController.add(isolateId);
} else {
if (!_mainHasStarted) {
try {
appConnection.runMain();
_mainHasStarted = true;
} catch (e) {
if (e.toString().contains('Main has already started')) {
_mainHasStarted = true;
} else {
rethrow;
}
}
}
} else if (!appConnection.hasStarted) {
appConnection.runMain();
}

// Clear pause state and send resume event to notify debugging tools
if (_currentPauseEvent != null) {
_currentPauseEvent = null;
if (inspector.isolate.pauseEvent != null) {
inspector.isolate.pauseEvent = null;
final resumeEvent = vm_service.Event(
kind: vm_service.EventKind.kResume,
timestamp: DateTime.now().millisecondsSinceEpoch,
Expand Down
2 changes: 1 addition & 1 deletion dwds/lib/src/version.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dwds/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dwds
# Every time this changes you need to run `dart run build_runner build`.
version: 26.2.1
version: 26.2.2

description: >-
A service that proxies between the Chrome debug protocol and the Dart VM
Expand Down
Loading