OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart._vmservice; | 5 part of dart._vmservice; |
6 | 6 |
7 class Message { | 7 class Message { |
8 final Completer _completer = new Completer.sync(); | 8 final Completer _completer = new Completer.sync(); |
9 bool get completed => _completer.isCompleted; | 9 bool get completed => _completer.isCompleted; |
10 /// Future of response. | 10 /// Future of response. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 static String _methodNameFromUri(Uri uri) { | 44 static String _methodNameFromUri(Uri uri) { |
45 if (uri == null) { | 45 if (uri == null) { |
46 return ''; | 46 return ''; |
47 } | 47 } |
48 if (uri.pathSegments.length == 0) { | 48 if (uri.pathSegments.length == 0) { |
49 return ''; | 49 return ''; |
50 } | 50 } |
51 return uri.pathSegments[0]; | 51 return uri.pathSegments[0]; |
52 } | 52 } |
53 | 53 |
| 54 Message.forMethod(String method) |
| 55 : client = null, method = method, serial = ''; |
| 56 |
54 Message.fromUri(this.client, Uri uri) | 57 Message.fromUri(this.client, Uri uri) |
55 : serial = '', method = _methodNameFromUri(uri) { | 58 : serial = '', method = _methodNameFromUri(uri) { |
56 params.addAll(uri.queryParameters); | 59 params.addAll(uri.queryParameters); |
57 } | 60 } |
58 | 61 |
59 Message.forIsolate(this.client, Uri uri, RunningIsolate isolate) | 62 Message.forIsolate(this.client, Uri uri, RunningIsolate isolate) |
60 : serial = '', method = _methodNameFromUri(uri) { | 63 : serial = '', method = _methodNameFromUri(uri) { |
61 params.addAll(uri.queryParameters); | 64 params.addAll(uri.queryParameters); |
62 params['isolateId'] = isolate.serviceId; | 65 params['isolateId'] = isolate.serviceId; |
63 } | 66 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 180 |
178 void setErrorResponse(int code, String details) { | 181 void setErrorResponse(int code, String details) { |
179 _completer.complete(encodeRpcError(this, code, | 182 _completer.complete(encodeRpcError(this, code, |
180 details: '$method: $details')); | 183 details: '$method: $details')); |
181 } | 184 } |
182 } | 185 } |
183 | 186 |
184 external bool sendIsolateServiceMessage(SendPort sp, List m); | 187 external bool sendIsolateServiceMessage(SendPort sp, List m); |
185 external void sendRootServiceMessage(List m); | 188 external void sendRootServiceMessage(List m); |
186 external void sendObjectRootServiceMessage(List m); | 189 external void sendObjectRootServiceMessage(List m); |
OLD | NEW |