OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 service_common; | 5 library service_common; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:typed_data'; | 9 import 'dart:typed_data'; |
10 | 10 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 offset += metaSize; | 203 offset += metaSize; |
204 var data = new ByteData.view( | 204 var data = new ByteData.view( |
205 bytes.buffer, | 205 bytes.buffer, |
206 bytes.offsetInBytes + offset, | 206 bytes.offsetInBytes + offset, |
207 bytes.lengthInBytes - offset); | 207 bytes.lengthInBytes - offset); |
208 var map = _parseJSON(meta); | 208 var map = _parseJSON(meta); |
209 if (map == null) { | 209 if (map == null) { |
210 return; | 210 return; |
211 } | 211 } |
212 var event = map['event']; | 212 var event = map['event']; |
213 postServiceEvent(event, data); | 213 var streamId = map['streamId']; |
| 214 postServiceEvent(streamId, event, data); |
214 }); | 215 }); |
215 } | 216 } |
216 | 217 |
217 void _onStringMessage(String data) { | 218 void _onStringMessage(String data) { |
218 var map = _parseJSON(data); | 219 var map = _parseJSON(data); |
219 if (map == null) { | 220 if (map == null) { |
220 return; | 221 return; |
221 } | 222 } |
222 var event = map['event']; | 223 var event = map['event']; |
223 if (event != null) { | 224 if (event != null) { |
224 postServiceEvent(event, null); | 225 var streamId = map['streamId']; |
| 226 postServiceEvent(streamId, event, null); |
225 return; | 227 return; |
226 } | 228 } |
227 | 229 |
228 // Extract serial and result. | 230 // Extract serial and result. |
229 var serial = map['id']; | 231 var serial = map['id']; |
230 | 232 |
231 // Complete request. | 233 // Complete request. |
232 var request = _pendingRequests.remove(serial); | 234 var request = _pendingRequests.remove(serial); |
233 if (request == null) { | 235 if (request == null) { |
234 Logger.root.severe('Received unexpected message: ${map}'); | 236 Logger.root.severe('Received unexpected message: ${map}'); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (request.method != 'getTagProfile' && | 321 if (request.method != 'getTagProfile' && |
320 request.method != 'getIsolateMetric' && | 322 request.method != 'getIsolateMetric' && |
321 request.method != 'getVMMetric') { | 323 request.method != 'getVMMetric') { |
322 Logger.root.info( | 324 Logger.root.info( |
323 'GET [${serial}] ${request.method}(${request.params}) from ${target.ne
tworkAddress}'); | 325 'GET [${serial}] ${request.method}(${request.params}) from ${target.ne
tworkAddress}'); |
324 } | 326 } |
325 // Send message. | 327 // Send message. |
326 _webSocket.send(message); | 328 _webSocket.send(message); |
327 } | 329 } |
328 } | 330 } |
OLD | NEW |