Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: pkg/front_end/tool/vm/reload.dart

Issue 2976553002: Fix hot reload test (Closed)
Patch Set: pause on startup Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/tool/vm/reload.dart
diff --git a/pkg/front_end/tool/vm/reload.dart b/pkg/front_end/tool/vm/reload.dart
index 087a873ea49027131f4490f782626ea82a44f351..275c9d19e8c9c47510160e9e8788f7eb435e3b49 100644
--- a/pkg/front_end/tool/vm/reload.dart
+++ b/pkg/front_end/tool/vm/reload.dart
@@ -8,10 +8,10 @@
/// Usage:
///
/// ```
-/// var reloader = new VmReloader();
-/// await reloader.reload(uriToEntryScript);
+/// var remoteVm = new RemoteVm();
+/// await remoteVm.reload(uriToEntryScript);
/// ...
-/// await reloader.disconnect();
+/// await remoteVm.disconnect();
/// ```
library front_end.src.vm.reload;
@@ -20,9 +20,11 @@ import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc;
import 'package:stream_channel/stream_channel.dart';
import 'package:web_socket_channel/io.dart';
-/// A user API to trigger hot reloads on a running VM via the VM's service
-/// protocol.
-class VmReloader {
+/// APIs to communicate with a remote VM via the VM's service protocol.
+///
+/// Only supports APIs to resume the program execution (when isolates are paused
+/// at startup) and to trigger hot reloads.
+class RemoteVm {
/// Port used to connect to the vm service protocol, typically 8181.
final int port;
@@ -36,7 +38,7 @@ class VmReloader {
FutureOr<String> get mainId async => _mainId ??= await _computeMainId();
String _mainId;
- VmReloader([this.port = 8181]);
+ RemoteVm([this.port = 8181]);
/// Establishes the JSON rpc connection.
json_rpc.Peer _createPeer() {
@@ -80,6 +82,11 @@ class VmReloader {
return result;
}
+ Future resume() async {
+ var id = await mainId;
+ await rpc.sendRequest('resume', {'isolateId': id});
+ }
+
/// Close any connections used to communicate with the VM.
Future disconnect() async {
if (_rpc == null) return null;
@@ -106,7 +113,7 @@ main(List<String> args) async {
return;
}
- var reloader = new VmReloader();
- await reloader.reload(Uri.base.resolve(args.first));
- await reloader.disconnect();
+ var remoteVm = new RemoteVm();
+ await remoteVm.reload(Uri.base.resolve(args.first));
+ await remoteVm.disconnect();
}
« no previous file with comments | « pkg/front_end/test/src/incremental/hot_reload_e2e_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698