| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ..[4] = keys | 132 ..[4] = keys |
| 133 ..[5] = values; | 133 ..[5] = values; |
| 134 sendRootServiceMessage(request); | 134 sendRootServiceMessage(request); |
| 135 return _completer.future; | 135 return _completer.future; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void setResponse(String response) { | 138 void setResponse(String response) { |
| 139 _completer.complete(response); | 139 _completer.complete(response); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void setErrorResponse(String message) { | 142 void setErrorResponse(int code, String details) { |
| 143 var response = { | 143 _completer.complete(encodeRpcError(this, code, |
| 144 'jsonrpc': '2.0', | 144 details: '$method: $details')); |
| 145 'id': serial, | |
| 146 'result' : { | |
| 147 'type': 'Error', | |
| 148 'message': message, | |
| 149 'request': { | |
| 150 'method': method, | |
| 151 'params': params | |
| 152 } | |
| 153 } | |
| 154 }; | |
| 155 _completer.complete(JSON.encode(response)); | |
| 156 } | 145 } |
| 157 } | 146 } |
| 158 | 147 |
| 159 bool sendIsolateServiceMessage(SendPort sp, List m) | 148 bool sendIsolateServiceMessage(SendPort sp, List m) |
| 160 native "VMService_SendIsolateServiceMessage"; | 149 native "VMService_SendIsolateServiceMessage"; |
| 161 | 150 |
| 162 void sendRootServiceMessage(List m) | 151 void sendRootServiceMessage(List m) |
| 163 native "VMService_SendRootServiceMessage"; | 152 native "VMService_SendRootServiceMessage"; |
| OLD | NEW |