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 vmservice; | 5 part of 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 sendRootServiceMessage(request); | 83 sendRootServiceMessage(request); |
84 return _completer.future; | 84 return _completer.future; |
85 } | 85 } |
86 | 86 |
87 void setResponse(String response) { | 87 void setResponse(String response) { |
88 _completer.complete(response); | 88 _completer.complete(response); |
89 } | 89 } |
90 | 90 |
91 void setErrorResponse(String error) { | 91 void setErrorResponse(String error) { |
92 _completer.complete(JSON.encode({ | 92 _completer.complete(JSON.encode({ |
93 'type': 'Error', | 93 'type': 'ServiceError', |
94 'msg': error, | 94 'id': '', |
| 95 'kind': 'RequestError', |
| 96 'message': error, |
95 'path': path, | 97 'path': path, |
96 'options': options | 98 'options': options |
97 })); | 99 })); |
98 } | 100 } |
99 } | 101 } |
100 | 102 |
101 void sendIsolateServiceMessage(SendPort sp, List m) | 103 void sendIsolateServiceMessage(SendPort sp, List m) |
102 native "VMService_SendIsolateServiceMessage"; | 104 native "VMService_SendIsolateServiceMessage"; |
103 | 105 |
104 void sendRootServiceMessage(List m) | 106 void sendRootServiceMessage(List m) |
105 native "VMService_SendRootServiceMessage"; | 107 native "VMService_SendRootServiceMessage"; |
OLD | NEW |