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

Unified Diff: sdk/lib/vmservice/vmservice.dart

Issue 2072543002: First cut at _spawnUri rpc in the vm service. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Code review Created 4 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 | « sdk/lib/vmservice/message.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/vmservice/vmservice.dart
diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart
index 4101023f6c7dc585ad86a3591acaf7bda4cc1b24..df5642b520091619d2534ca8042fe498d5cfc1b2 100644
--- a/sdk/lib/vmservice/vmservice.dart
+++ b/sdk/lib/vmservice/vmservice.dart
@@ -295,6 +295,37 @@ class VMService extends MessageRouter {
return encodeSuccess(message);
}
+ Future<String> _spawnUri(Message message) async {
+ var token = message.params['token'];
+ if (token == null) {
+ return encodeMissingParamError(message, 'token');
+ }
+ if (token is! String) {
+ return encodeInvalidParamError(message, 'token');
+ }
+ var uri = message.params['uri'];
+ if (uri == null) {
+ return encodeMissingParamError(message, 'uri');
+ }
+ if (uri is! String) {
+ return encodeInvalidParamError(message, 'uri');
+ }
+ var args = message.params['args'];
+ if (args != null &&
+ args is! List<String>) {
+ return encodeInvalidParamError(message, 'args');
+ }
+ var msg = message.params['message'];
+
+ Isolate.spawnUri(Uri.parse(uri), args, msg).then((isolate) {
+ _spawnUriNotify(isolate.controlPort, token);
+ }).catchError((e) {
+ _spawnUriNotify(e.toString(), token);
+ });
+
+ return encodeSuccess(message);
+ }
+
// TODO(johnmccutchan): Turn this into a command line tool that uses the
// service library.
Future<String> _getCrashDump(Message message) async {
@@ -367,6 +398,9 @@ class VMService extends MessageRouter {
if (message.method == 'streamCancel') {
return _streamCancel(message);
}
+ if (message.method == '_spawnUri') {
+ return _spawnUri(message);
+ }
if (_devfs.shouldHandleMessage(message)) {
return _devfs.handleMessage(message);
}
@@ -404,3 +438,6 @@ external void _vmCancelStream(String streamId);
/// Get the bytes to the tar archive.
external Uint8List _requestAssets();
+
+/// Notify the vm service that an isolate has been spawned via rpc.
+external void _spawnUriNotify(obj, String token);
« no previous file with comments | « sdk/lib/vmservice/message.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698