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