Skip to content

Commit

Permalink
Send a kPausePostRequest after restarting to notify clients to resu…
Browse files Browse the repository at this point in the history
  • Loading branch information
elliette authored May 29, 2024
1 parent 1bed26a commit 7eeebbb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Fix bug where debugging clients are not aware of service extensions when connecting to a new web app. - [#2388](https://github.com/dart-lang/webdev/pull/2388)
- Respect the value of `pause_isolates_on_start` during page-refreshes. - [#2431](https://github.com/dart-lang/webdev/pull/2431)
- Fix issue where DAP clients wouldn't resume after a restart. - [#2441](https://github.com/dart-lang/webdev/pull/2441)

## 24.0.0

Expand Down
17 changes: 17 additions & 0 deletions dwds/lib/src/services/chrome_proxy_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ class ChromeProxyService implements VmServiceInterface {
/// This value can be updated at runtime via [setFlag].
bool get pauseIsolatesOnStart => _pauseIsolatesOnStart;

/// Whether or not the connected app has a pending restart.
bool get hasPendingRestart => _resumeAfterRestartEventsController.hasListener;

final _resumeAfterRestartEventsController =
StreamController<String>.broadcast();

Expand Down Expand Up @@ -353,6 +356,20 @@ class ChromeProxyService implements VmServiceInterface {
);
}

// If the new isolate was created as part of a restart, send a
// kPausePostRequest event to notify client that the app is paused so that
// it can resume:
if (hasPendingRestart) {
_streamNotify(
'Debug',
Event(
kind: EventKind.kPausePostRequest,
timestamp: timestamp,
isolate: isolateRef,
),
);
}

// The service is considered initialized when the first isolate is created.
if (!_initializedCompleter.isCompleted) _initializedCompleter.complete();
}
Expand Down

0 comments on commit 7eeebbb

Please sign in to comment.