| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 void onMessage(dynamic data), | 69 void onMessage(dynamic data), |
| 70 void onError(), | 70 void onError(), |
| 71 void onClose()); | 71 void onClose()); |
| 72 bool get isOpen; | 72 bool get isOpen; |
| 73 void send(dynamic data); | 73 void send(dynamic data); |
| 74 void close(); | 74 void close(); |
| 75 Future<ByteData> nonStringToByteData(dynamic data); | 75 Future<ByteData> nonStringToByteData(dynamic data); |
| 76 } | 76 } |
| 77 | 77 |
| 78 /// A [CommonWebSocketVM] communicates with a Dart VM over a CommonWebSocket. | 78 /// A [CommonWebSocketVM] communicates with a Dart VM over a CommonWebSocket. |
| 79 /// The Dart VM can be embedded in Chromium or standalone. In the case of | 79 /// The Dart VM can be embedded in Chromium or standalone. |
| 80 /// Chromium, we make the service requests via the Chrome Remote Debugging | |
| 81 /// Protocol. | |
| 82 abstract class CommonWebSocketVM extends VM { | 80 abstract class CommonWebSocketVM extends VM { |
| 83 final Completer _connected = new Completer(); | 81 final Completer _connected = new Completer(); |
| 84 final Completer _disconnected = new Completer<String>(); | 82 final Completer _disconnected = new Completer<String>(); |
| 85 final WebSocketVMTarget target; | 83 final WebSocketVMTarget target; |
| 86 final Map<String, _WebSocketRequest> _delayedRequests = | 84 final Map<String, _WebSocketRequest> _delayedRequests = |
| 87 new Map<String, _WebSocketRequest>(); | 85 new Map<String, _WebSocketRequest>(); |
| 88 final Map<String, _WebSocketRequest> _pendingRequests = | 86 final Map<String, _WebSocketRequest> _pendingRequests = |
| 89 new Map<String, _WebSocketRequest>(); | 87 new Map<String, _WebSocketRequest>(); |
| 90 int _requestSerial = 0; | 88 int _requestSerial = 0; |
| 91 bool _hasInitiatedConnect = false; | 89 bool _hasInitiatedConnect = false; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 if (request.method != 'getTagProfile' && | 317 if (request.method != 'getTagProfile' && |
| 320 request.method != 'getIsolateMetric' && | 318 request.method != 'getIsolateMetric' && |
| 321 request.method != 'getVMMetric') { | 319 request.method != 'getVMMetric') { |
| 322 Logger.root.info( | 320 Logger.root.info( |
| 323 'GET [${serial}] ${request.method}(${request.params}) from ${target.ne
tworkAddress}'); | 321 'GET [${serial}] ${request.method}(${request.params}) from ${target.ne
tworkAddress}'); |
| 324 } | 322 } |
| 325 // Send message. | 323 // Send message. |
| 326 _webSocket.send(message); | 324 _webSocket.send(message); |
| 327 } | 325 } |
| 328 } | 326 } |
| OLD | NEW |