Chromium Code Reviews| 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_html; | 5 library service_html; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:html'; | 9 import 'dart:html'; |
| 10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 } | 53 } |
| 54 | 54 |
| 55 /// The [WebSocketVM] communicates with a Dart VM over WebSocket. The Dart VM | 55 /// The [WebSocketVM] communicates with a Dart VM over WebSocket. The Dart VM |
| 56 /// can be embedded in Chromium or standalone. In the case of Chromium, we | 56 /// can be embedded in Chromium or standalone. In the case of Chromium, we |
| 57 /// make the service requests via the Chrome Remote Debugging Protocol. | 57 /// make the service requests via the Chrome Remote Debugging Protocol. |
| 58 class WebSocketVM extends CommonWebSocketVM { | 58 class WebSocketVM extends CommonWebSocketVM { |
| 59 WebSocketVM(WebSocketVMTarget target) : super(target, new _HtmlWebSocket()); | 59 WebSocketVM(WebSocketVMTarget target) : super(target, new _HtmlWebSocket()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // A VM that communicates with the service via posting messages from DevTools. | 62 // A VM that communicates with the service via posting messages from DevTools. |
| 63 class PostMessageVM extends VM { | 63 class PostMessageVM extends VM { |
|
Cutch
2015/02/02 22:20:04
This whole class should die now.
turnidge
2015/02/02 22:44:05
Done.
| |
| 64 final Completer _connected = new Completer(); | 64 final Completer _connected = new Completer(); |
| 65 final Completer _disconnected = new Completer(); | 65 final Completer _disconnected = new Completer(); |
| 66 void disconnect() { /* nope */ } | 66 void disconnect() { /* nope */ } |
| 67 Future get onConnect => _connected.future; | 67 Future get onConnect => _connected.future; |
| 68 Future get onDisconnect => _disconnected.future; | 68 Future get onDisconnect => _disconnected.future; |
| 69 final Map<String, Completer> _pendingRequests = | 69 final Map<String, Completer> _pendingRequests = |
| 70 new Map<String, Completer>(); | 70 new Map<String, Completer>(); |
| 71 int _requestSerial = 0; | 71 int _requestSerial = 0; |
| 72 | 72 |
| 73 PostMessageVM() : super() { | 73 PostMessageVM() : super() { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 93 Map message = {}; | 93 Map message = {}; |
| 94 message['id'] = idString; | 94 message['id'] = idString; |
| 95 message['method'] = 'observatoryQuery'; | 95 message['method'] = 'observatoryQuery'; |
| 96 message['query'] = '$path'; | 96 message['query'] = '$path'; |
| 97 _requestSerial++; | 97 _requestSerial++; |
| 98 var completer = new Completer(); | 98 var completer = new Completer(); |
| 99 _pendingRequests[idString] = completer; | 99 _pendingRequests[idString] = completer; |
| 100 window.parent.postMessage(JSON.encode(message), '*'); | 100 window.parent.postMessage(JSON.encode(message), '*'); |
| 101 return completer.future; | 101 return completer.future; |
| 102 } | 102 } |
| 103 | |
| 104 Future<String> invokeRpcRaw(String method, Map params) { | |
| 105 throw 'not-implemented'; | |
| 106 } | |
| 103 } | 107 } |
| OLD | NEW |