| Index: runtime/vm/service/message.dart
|
| diff --git a/runtime/vm/service/message.dart b/runtime/vm/service/message.dart
|
| index 6a7c66bca97564d565c07482d5b3db596d0d03d4..86f57c1eebaab3474eb45617d2be7d9d3003246a 100644
|
| --- a/runtime/vm/service/message.dart
|
| +++ b/runtime/vm/service/message.dart
|
| @@ -9,10 +9,16 @@ class Message {
|
| bool get completed => _completer.isCompleted;
|
| /// Future of response.
|
| Future<String> get response => _completer.future;
|
| - /// Path.
|
| +
|
| + final bool isOld;
|
| +
|
| + // In new messages.
|
| + final String method;
|
| +
|
| + // In old messages.
|
| final List path = new List();
|
| - /// Options.
|
| - final Map options = new Map();
|
| +
|
| + final Map params = new Map();
|
|
|
| void _setPath(List<String> pathSegments) {
|
| if (pathSegments == null) {
|
| @@ -26,27 +32,33 @@ class Message {
|
| });
|
| }
|
|
|
| - Message.fromUri(Uri uri) {
|
| + Message.fromUri(Uri uri) : isOld = true {
|
| var split = uri.path.split('/');
|
| if (split.length == 0) {
|
| setErrorResponse('Invalid uri: $uri.');
|
| return;
|
| }
|
| _setPath(split);
|
| - options.addAll(uri.queryParameters);
|
| + params.addAll(uri.queryParameters);
|
| + }
|
| +
|
| + Message.fromJsonRpc(this.method, Map rpcParams)
|
| + : isOld = false {
|
| + params.addAll(rpcParams);
|
| }
|
|
|
| - Message.fromMap(Map map) {
|
| + Message.fromMap(Map map) : isOld = true {
|
| _setPath(map['path']);
|
| + // TODO - turnidge - change this to params in sender.
|
| if (map['options'] != null) {
|
| - options.addAll(map['options']);
|
| + params.addAll(map['options']);
|
| }
|
| }
|
|
|
| dynamic toJson() {
|
| return {
|
| 'path': path,
|
| - 'options': options
|
| + 'params': params
|
| };
|
| }
|
|
|
| @@ -60,12 +72,12 @@ class Message {
|
| _completer.complete(value);
|
| }
|
| };
|
| - var keys = options.keys.toList(growable:false);
|
| - var values = options.values.toList(growable:false);
|
| + var keys = params.keys.toList(growable:false);
|
| + var values = params.values.toList(growable:false);
|
| var request = new List(5)
|
| ..[0] = 0 // Make room for OOB message type.
|
| ..[1] = receivePort.sendPort
|
| - ..[2] = path
|
| + ..[2] = (isOld ? path : method)
|
| ..[3] = keys
|
| ..[4] = values;
|
| sendIsolateServiceMessage(sendPort, request);
|
| @@ -82,12 +94,12 @@ class Message {
|
| _completer.complete(value);
|
| }
|
| };
|
| - var keys = options.keys.toList(growable:false);
|
| - var values = options.values.toList(growable:false);
|
| + var keys = params.keys.toList(growable:false);
|
| + var values = params.values.toList(growable:false);
|
| var request = new List(5)
|
| ..[0] = 0 // Make room for OOB message type.
|
| ..[1] = receivePort.sendPort
|
| - ..[2] = path
|
| + ..[2] = (isOld ? path : method)
|
| ..[3] = keys
|
| ..[4] = values;
|
| sendRootServiceMessage(request);
|
| @@ -105,7 +117,7 @@ class Message {
|
| 'kind': 'RequestError',
|
| 'message': error,
|
| 'path': path,
|
| - 'options': options
|
| + 'params': params
|
| }));
|
| }
|
| }
|
|
|