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

Hot restart now does a full page reload #2374

Closed
wants to merge 14 commits into from
3 changes: 2 additions & 1 deletion dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- Rename `dart_library.js` to `ddc_module_loader.js` to match SDK naming changes. - [#2360](https://github.com/dart-lang/webdev/pull/2360)
- Implement `setFlag` when it is called with `pause_isolates_on_start`. - [#2373](https://github.com/dart-lang/webdev/pull/2373)
- Do not persist breakpoints across hot restarts or page reloads. - [#2371](https://github.com/dart-lang/webdev/pull/2371)
- Hot restart now triggers a full page reload for external apps. - [#2374](https://github.com/dart-lang/webdev/pull/2374)

## 23.3.0

Expand All @@ -16,7 +17,7 @@

## 23.1.1

- Loosen `package:vm_service` constraints to allow `>=13.0.0 <15.0.0`. - [#2329](https://github.com/dart-lang/webdev/pull/2329)
- Loosen `package:vm_service` constraints to allow `>=13.0.0 <15.0.0`. - [#2329](https://github.com/dart-lang/webdev/pull/2329)

## 23.1.0

Expand Down
16 changes: 14 additions & 2 deletions dwds/lib/src/dwds_vm_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'dart:async';
import 'dart:convert';

import 'package:dwds/src/config/tool_configuration.dart';
import 'package:dwds/src/events.dart';
import 'package:dwds/src/services/chrome_debug_exception.dart';
import 'package:dwds/src/services/chrome_proxy_service.dart';
Expand Down Expand Up @@ -36,6 +37,9 @@ class DwdsVmClient {
/// Synchronizes hot restarts to avoid races.
final _hotRestartQueue = AtomicQueue();

/// Synchronizes full reloads to avoid races.
final _fullReloadQueue = AtomicQueue();

DwdsVmClient(this.client, this._requestController, this._responseController);

Future<void> close() => _closed ??= () async {
Expand Down Expand Up @@ -98,7 +102,9 @@ class DwdsVmClient {
client.registerServiceCallback(
'hotRestart',
(request) => captureElapsedTime(
() => dwdsVmClient.hotRestart(chromeProxyService, client),
() => globalToolConfiguration.appMetadata.isInternalBuild
? dwdsVmClient.hotRestart(chromeProxyService, client)
: dwdsVmClient.fullReload(chromeProxyService),
(_) => DwdsEvent.hotRestart(),
),
);
Expand All @@ -107,7 +113,7 @@ class DwdsVmClient {
client.registerServiceCallback(
'fullReload',
(request) => captureElapsedTime(
() => _fullReload(chromeProxyService),
() => dwdsVmClient.fullReload(chromeProxyService),
(_) => DwdsEvent.fullReload(),
),
);
Expand Down Expand Up @@ -169,6 +175,12 @@ class DwdsVmClient {
) {
return _hotRestartQueue.run(() => _hotRestart(chromeProxyService, client));
}

Future<Map<String, dynamic>> fullReload(
ChromeProxyService chromeProxyService,
) {
return _fullReloadQueue.run(() => _fullReload(chromeProxyService));
}
}

void _processSendEvent(
Expand Down
Loading
Loading