Chromium Code Reviews| Index: lib/src/isolate.dart |
| diff --git a/lib/src/isolate.dart b/lib/src/isolate.dart |
| index d9363daa37947af26664dde7e475026e8286fba8..8b8f367e07abd6cd77763952085136226a1628e0 100644 |
| --- a/lib/src/isolate.dart |
| +++ b/lib/src/isolate.dart |
| @@ -264,6 +264,21 @@ class VMIsolateRef { |
| } |
| } |
| + /// Makes a raw RPC to a VM service extension registered in the isolate |
| + /// corresponding to the ID [number]. |
|
nweiz
2016/02/10 22:17:11
"the isolate ..." -> "this isolate."
|
| + /// |
| + /// [method] must correspond to a VM service extension installed on the VM |
| + /// isolate and it must begin with prefix "ext.". |
|
nweiz
2016/02/10 21:28:28
It sort of feels like this should just automatical
yjbanov
2016/02/10 22:06:06
I think there's value in having `invokeExtension`
nweiz
2016/02/10 22:17:11
SGTM
|
| + /// |
| + /// [params] are passed to the extension handler and must be serializable to |
| + /// a JSON string. |
| + Future<Map> invokeExtension(String method, [Map<String, Object> params]) { |
|
nweiz
2016/02/10 21:28:28
Based on the ServiceExtensionHandler API, I think
yjbanov
2016/02/10 22:06:06
I thought so too initially, but turns out the JSON
nweiz
2016/02/10 22:17:11
I think we should only allow strings here. We defi
|
| + if (!method.startsWith('ext.')) { |
| + throw new ArgumentError('Extension method names must begin with "ext." prefix: ${method}'); |
|
nweiz
2016/02/10 21:28:28
Long line.
Also, you can make this a little more
yjbanov
2016/02/10 22:06:06
Done.
|
| + } |
| + return _scope.sendRequest(method, params); |
| + } |
| + |
| bool operator ==(other) => other is VMIsolateRef && |
| other._scope.isolateId == _scope.isolateId; |
| @@ -365,4 +380,4 @@ class VMStep { |
| const VMStep._(this._value); |
| String toString() => _value; |
| -} |
| +} |