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

Side by Side Diff: runtime/bin/vmservice/observatory/lib/service_io.dart

Issue 474633002: Optional binary payloads in VM service events. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_io; 5 library service_io;
6 6
7 import 'dart:async';
7 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:typed_data';
8 10
9 import 'package:observatory/service_common.dart'; 11 import 'package:observatory/service_common.dart';
10 12
11 // Export the service library. 13 // Export the service library.
12 export 'package:observatory/service_common.dart'; 14 export 'package:observatory/service_common.dart';
13 15
14 class _IOWebSocket implements CommonWebSocket { 16 class _IOWebSocket implements CommonWebSocket {
15 WebSocket _webSocket; 17 WebSocket _webSocket;
16 18
17 void connect(String address, 19 void connect(String address,
(...skipping 15 matching lines...) Expand all
33 bool get isOpen => 35 bool get isOpen =>
34 (_webSocket != null) && (_webSocket.readyState == WebSocket.OPEN); 36 (_webSocket != null) && (_webSocket.readyState == WebSocket.OPEN);
35 37
36 void send(dynamic data) { 38 void send(dynamic data) {
37 _webSocket.add(data); 39 _webSocket.add(data);
38 } 40 }
39 41
40 void close() { 42 void close() {
41 _webSocket.close(); 43 _webSocket.close();
42 } 44 }
45
46 Future<ByteData> nonStringToByteData(dynamic data) {
47 assert(data is Uint8List);
48 return new Future.sync(() =>
49 new ByteData.view(data.buffer, data.offsetInBytes));
50 }
43 } 51 }
44 52
45 /// The [WebSocketVM] communicates with a Dart VM over WebSocket. The Dart VM 53 /// The [WebSocketVM] communicates with a Dart VM over WebSocket. The Dart VM
46 /// can be embedded in Chromium or standalone. In the case of Chromium, we 54 /// can be embedded in Chromium or standalone. In the case of Chromium, we
47 /// make the service requests via the Chrome Remote Debugging Protocol. 55 /// make the service requests via the Chrome Remote Debugging Protocol.
48 class WebSocketVM extends CommonWebSocketVM { 56 class WebSocketVM extends CommonWebSocketVM {
49 WebSocketVM(WebSocketVMTarget target) : super(target, new _IOWebSocket()); 57 WebSocketVM(WebSocketVMTarget target) : super(target, new _IOWebSocket());
50 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698