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

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

Issue 1152283005: Revert "Add the streamListen and streamCancel rpcs to the vm service." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/include/dart_api.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;
(...skipping 11 matching lines...) Expand all
22 map = JSON.decode(message); 22 map = JSON.decode(message);
23 } catch (e) { 23 } catch (e) {
24 socket.close(PARSE_ERROR_CODE, 'Message parse error: $e'); 24 socket.close(PARSE_ERROR_CODE, 'Message parse error: $e');
25 return; 25 return;
26 } 26 }
27 if (map is! Map) { 27 if (map is! Map) {
28 socket.close(NOT_MAP_ERROR_CODE, 'Message must be a JSON map.'); 28 socket.close(NOT_MAP_ERROR_CODE, 'Message must be a JSON map.');
29 return; 29 return;
30 } 30 }
31 var serial = map['id']; 31 var serial = map['id'];
32 onMessage(serial, new Message.fromJsonRpc(this, map)); 32 onMessage(serial, new Message.fromJsonRpc(map));
33 } else { 33 } else {
34 socket.close(BINARY_MESSAGE_ERROR_CODE, 'Message must be a string.'); 34 socket.close(BINARY_MESSAGE_ERROR_CODE, 'Message must be a string.');
35 } 35 }
36 } 36 }
37 37
38 void post(dynamic result) { 38 void post(dynamic result) {
39 try { 39 try {
40 socket.add(result); 40 socket.add(result);
41 } catch (_) { 41 } catch (_) {
42 print("Ignoring error posting over WebSocket."); 42 print("Ignoring error posting over WebSocket.");
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 assert(resource != null); 134 assert(resource != null);
135 } 135 }
136 if (resource != null) { 136 if (resource != null) {
137 // Serving up a static resource (e.g. .css, .html, .png). 137 // Serving up a static resource (e.g. .css, .html, .png).
138 request.response.headers.contentType = 138 request.response.headers.contentType =
139 ContentType.parse(resource.mimeType); 139 ContentType.parse(resource.mimeType);
140 request.response.add(resource.data); 140 request.response.add(resource.data);
141 request.response.close(); 141 request.response.close();
142 return; 142 return;
143 } 143 }
144 var message = new Message.fromUri(this, request.uri); 144 var message = new Message.fromUri(request.uri);
145 var client = new HttpRequestClient(request, _service); 145 var client = new HttpRequestClient(request, _service);
146 client.onMessage(null, message); 146 client.onMessage(null, message);
147 } 147 }
148 148
149 Future startup() { 149 Future startup() {
150 if (_server != null) { 150 if (_server != null) {
151 // Already running. 151 // Already running.
152 return new Future.value(this); 152 return new Future.value(this);
153 } 153 }
154 154
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n'); 202 print('Could not shutdown Observatory HTTP server:\n$e\n$st\n');
203 _notifyServerState("", 0); 203 _notifyServerState("", 0);
204 return this; 204 return this;
205 }); 205 });
206 } 206 }
207 207
208 } 208 }
209 209
210 void _notifyServerState(String ip, int port) 210 void _notifyServerState(String ip, int port)
211 native "VMServiceIO_NotifyServerState"; 211 native "VMServiceIO_NotifyServerState";
OLDNEW
« no previous file with comments | « runtime/bin/main.cc ('k') | runtime/include/dart_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698