dart-archive / vm_service_client

A Darty client for the VM service protocol
https://pub.dev/packages/vm_service_client
BSD 3-Clause "New" or "Revised" License
12 stars 19 forks source link

Allow talking to custom VM service extensions #2

Closed yjbanov closed 8 years ago

yjbanov commented 8 years ago

dart:developer supports registering custom extensions. vm_service_client should support communicating with those. Since the parameter and the response schemas (other than the isolate ID) are not known, the API has to be generic. One way to do it is to simply add a sendRequest method to VMIsolateRef that forwards to _scope.sendRequest:

class VMIsolateRef {

  ...

  /// Makes a raw RPC to the VM isolate corresponding to the ID [number].
  ///
  /// [method] must correspond either to a built-in VM service method or to a
  /// custom VM service extension installed on the VM isolate.
  ///
  /// [params] are passed to the extension handler and must be serializable to
  /// a JSON string.
  Future<Map> sendRequest(String method, [Map<String, Object> params]) async {
    return _scope.sendRequest(method, params);
  }

  ...

}
yjbanov commented 8 years ago

https://codereview.chromium.org/1670283002/