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 library vmservice; | 5 library vmservice; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 | 10 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 }); | 131 }); |
132 result['type'] = 'ClientList'; | 132 result['type'] = 'ClientList'; |
133 result['members'] = members; | 133 result['members'] = members; |
134 message.setResponse(JSON.encode(result)); | 134 message.setResponse(JSON.encode(result)); |
135 } | 135 } |
136 | 136 |
137 Future<String> route(Message message) { | 137 Future<String> route(Message message) { |
138 if (message.completed) { | 138 if (message.completed) { |
139 return message.response; | 139 return message.response; |
140 } | 140 } |
| 141 // TODO(turnidge): Update to json rpc. BEFORE SUBMIT. |
141 if ((message.path.length == 1) && (message.path[0] == 'clients')) { | 142 if ((message.path.length == 1) && (message.path[0] == 'clients')) { |
142 _clientCollection(message); | 143 _clientCollection(message); |
143 return message.response; | 144 return message.response; |
144 } | 145 } |
145 if (message.isOld) { | 146 if (message.params['isolateId'] != null) { |
146 if (message.path[0] == 'isolates') { | 147 return runningIsolates.route(message); |
147 return runningIsolates.route(message); | |
148 } | |
149 } else { | |
150 if (message.params['isolate'] != null) { | |
151 return runningIsolates.route(message); | |
152 } | |
153 } | 148 } |
154 return message.sendToVM(); | 149 return message.sendToVM(); |
155 } | 150 } |
156 } | 151 } |
157 | 152 |
158 RawReceivePort boot() { | 153 RawReceivePort boot() { |
159 // Return the port we expect isolate startup and shutdown messages on. | 154 // Return the port we expect isolate startup and shutdown messages on. |
160 return isolateLifecyclePort; | 155 return isolateLifecyclePort; |
161 } | 156 } |
162 | 157 |
163 void _registerIsolate(int port_id, SendPort sp, String name) { | 158 void _registerIsolate(int port_id, SendPort sp, String name) { |
164 var service = new VMService(); | 159 var service = new VMService(); |
165 service.runningIsolates.isolateStartup(port_id, sp, name); | 160 service.runningIsolates.isolateStartup(port_id, sp, name); |
166 } | 161 } |
167 | 162 |
168 void _setEventMask(int mask) | 163 void _setEventMask(int mask) |
169 native "VMService_SetEventMask"; | 164 native "VMService_SetEventMask"; |
170 | 165 |
171 void _onStart() native "VMService_OnStart"; | 166 void _onStart() native "VMService_OnStart"; |
OLD | NEW |