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

Side by Side Diff: runtime/bin/vmservice/server.dart

Issue 434763002: Add VMService GC 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
« no previous file with comments | « runtime/bin/vmservice/observatory/test/gc_test.dart ('k') | runtime/vm/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of vmservice_io; 5 part of vmservice_io;
6 6
7 class WebSocketClient extends Client { 7 class WebSocketClient extends Client {
8 static const int PARSE_ERROR_CODE = 4000; 8 static const int PARSE_ERROR_CODE = 4000;
9 static const int BINARY_MESSAGE_ERROR_CODE = 4001; 9 static const int BINARY_MESSAGE_ERROR_CODE = 4001;
10 static const int NOT_MAP_ERROR_CODE = 4002; 10 static const int NOT_MAP_ERROR_CODE = 4002;
11 final WebSocket socket; 11 final WebSocket socket;
12 12
13 WebSocketClient(this.socket, service) : super(service) { 13 WebSocketClient(this.socket, service) : super(service) {
14 socket.listen((message) => onWebSocketMessage(message)); 14 socket.listen((message) => onWebSocketMessage(message));
15 socket.done.then((_) => close()); 15 socket.done.then((_) => close());
16 service.subscribe('debug', this); 16 service.subscribe('debug', this);
17 service.subscribe('gc', this);
17 } 18 }
18 19
19 void onWebSocketMessage(message) { 20 void onWebSocketMessage(message) {
20 if (message is String) { 21 if (message is String) {
21 var map; 22 var map;
22 try { 23 try {
23 map = JSON.decode(message); 24 map = JSON.decode(message);
24 } catch (e) { 25 } catch (e) {
25 socket.close(PARSE_ERROR_CODE, 'Message parse error: $e'); 26 socket.close(PARSE_ERROR_CODE, 'Message parse error: $e');
26 return; 27 return;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 _server = null; 193 _server = null;
193 return this; 194 return this;
194 }).catchError((e, st) { 195 }).catchError((e, st) {
195 _server = null; 196 _server = null;
196 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); 197 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n');
197 return this; 198 return this;
198 }); 199 });
199 } 200 }
200 201
201 } 202 }
OLDNEW
« no previous file with comments | « runtime/bin/vmservice/observatory/test/gc_test.dart ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698