Chromium Code Reviews| Index: sdk/lib/vmservice/vmservice.dart |
| diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart |
| index 4101023f6c7dc585ad86a3591acaf7bda4cc1b24..49a260c3405f80e74961668265ca7fe9c9dfc741 100644 |
| --- a/sdk/lib/vmservice/vmservice.dart |
| +++ b/sdk/lib/vmservice/vmservice.dart |
| @@ -295,6 +295,34 @@ 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'); |
|
Cutch
2016/07/07 16:17:45
here you allow for any object as the token but in
turnidge
2016/07/11 21:24:59
Done.
|
| + } |
| + 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 +395,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 +435,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); |