Skip to content

Commit 2374b25

Browse files
Anna Gringauzeelliette
authored andcommitted
Support hot restart for multi-ddr scenario (dart-lang#1442)
1 parent cf5a91f commit 2374b25

File tree

11 files changed

+465
-447
lines changed

11 files changed

+465
-447
lines changed

dwds/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
## 11.5.0-dev
2+
3+
- Support hot restart in a multi-app scenario with legacy modules.
4+
- Rename `$dartHotRestart` in the injected client to `$dartHotRestartDwds`.
5+
- Make `$dartHotRestartDwds` take a `runId`.
6+
- No change in behavior for single applications.
7+
- For a multi-app scenario using legacy modules, this will make all
8+
sub-apps with the same `runId` restart at the same time once.
9+
10+
Note that multi-app scenario is currently only supported for legacy modules,
11+
used by DDR, and is not yet supported for amd modules that are used by
12+
flutter tools and webdev.
13+
114
## 11.4.0
215

316
- Fix duplicated scripts returned by `VmService.getScripts` API.

dwds/lib/src/dwds_vm_client.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import 'dart:async';
88
import 'dart:convert';
99

1010
import 'package:logging/logging.dart';
11+
import 'package:uuid/uuid.dart';
1112
import 'package:vm_service/vm_service.dart';
1213
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
1314

@@ -194,14 +195,16 @@ Future<Map<String, dynamic>> _hotRestart(
194195
// restart. Only return success after the isolate has fully started.
195196
var stream = chromeProxyService.onEvent('Isolate');
196197
try {
197-
_logger.info('Issuing \$dartHotRestart request.');
198+
// Generate run id to hot restart all apps loaded into the tab.
199+
var runId = const Uuid().v4().toString();
200+
_logger.info('Issuing \$dartHotRestartDwds request');
198201
await chromeProxyService.remoteDebugger
199202
.sendCommand('Runtime.evaluate', params: {
200-
'expression': r'$dartHotRestart();',
203+
'expression': '\$dartHotRestartDwds(\'$runId\');',
201204
'awaitPromise': true,
202205
'contextId': context,
203206
});
204-
_logger.info('\$dartHotRestart request complete.');
207+
_logger.info('\$dartHotRestartDwds request complete.');
205208
} on WipError catch (exception) {
206209
var code = exception.error['code'];
207210
// This corresponds to `Execution context was destroyed` which can

0 commit comments

Comments
 (0)