Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(598)

Unified Diff: runtime/observatory/lib/service_html.dart

Issue 839543002: Revert "Build Observatory with runtime" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/lib/service_common.dart ('k') | runtime/observatory/lib/service_io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/service_html.dart
diff --git a/runtime/observatory/lib/service_html.dart b/runtime/observatory/lib/service_html.dart
deleted file mode 100644
index da5a9759c43c68fc66202da1c02cd142852ba293..0000000000000000000000000000000000000000
--- a/runtime/observatory/lib/service_html.dart
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library service_html;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:html';
-import 'dart:typed_data';
-
-import 'package:observatory/service_common.dart';
-
-// Export the service library.
-export 'package:observatory/service_common.dart';
-
-class _HtmlWebSocket implements CommonWebSocket {
- WebSocket _webSocket;
-
- void connect(String address,
- void onOpen(),
- void onMessage(dynamic data),
- void onError(),
- void onClose()) {
- _webSocket = new WebSocket(address);
- _webSocket.onClose.listen((CloseEvent) => onClose());
- _webSocket.onError.listen((Event) => onError());
- _webSocket.onOpen.listen((Event) => onOpen());
- _webSocket.onMessage.listen((MessageEvent event) => onMessage(event.data));
- }
-
- bool get isOpen => _webSocket.readyState == WebSocket.OPEN;
-
- void send(dynamic data) {
- _webSocket.send(data);
- }
-
- void close() {
- _webSocket.close();
- }
-
- Future<ByteData> nonStringToByteData(dynamic data) {
- assert(data is Blob);
- FileReader fileReader = new FileReader();
- fileReader.readAsArrayBuffer(data);
- return fileReader.onLoadEnd.first.then((e) {
- var result = fileReader.result;
- return new ByteData.view(result.buffer,
- result.offsetInBytes,
- result.length);
- });
- }
-}
-
-/// The [WebSocketVM] communicates with a Dart VM over WebSocket. The Dart VM
-/// can be embedded in Chromium or standalone. In the case of Chromium, we
-/// make the service requests via the Chrome Remote Debugging Protocol.
-class WebSocketVM extends CommonWebSocketVM {
- WebSocketVM(WebSocketVMTarget target) : super(target, new _HtmlWebSocket());
-}
-
-// A VM that communicates with the service via posting messages from DevTools.
-class PostMessageVM extends VM {
- final Completer _connected = new Completer();
- final Completer _disconnected = new Completer();
- void disconnect() { /* nope */ }
- Future get onConnect => _connected.future;
- Future get onDisconnect => _disconnected.future;
- final Map<String, Completer> _pendingRequests =
- new Map<String, Completer>();
- int _requestSerial = 0;
-
- PostMessageVM() : super() {
- window.onMessage.listen(_messageHandler);
- _connected.complete(this);
- }
-
- void _messageHandler(msg) {
- var id = msg.data['id'];
- var name = msg.data['name'];
- var data = msg.data['data'];
- if (name != 'observatoryData') {
- return;
- }
- var completer = _pendingRequests[id];
- assert(completer != null);
- _pendingRequests.remove(id);
- completer.complete(data);
- }
-
- Future<String> getString(String path) {
- var idString = '$_requestSerial';
- Map message = {};
- message['id'] = idString;
- message['method'] = 'observatoryQuery';
- message['query'] = '$path';
- _requestSerial++;
- var completer = new Completer();
- _pendingRequests[idString] = completer;
- window.parent.postMessage(JSON.encode(message), '*');
- return completer.future;
- }
-}
« no previous file with comments | « runtime/observatory/lib/service_common.dart ('k') | runtime/observatory/lib/service_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698