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

Unified Diff: runtime/bin/vmservice/server.dart

Issue 1077823003: Some cleanups in the code that posts results to service clients. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « no previous file | runtime/observatory/lib/service_common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/server.dart
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index a847828b84a6af53388420013ceac87ce1a47ad0..2530f3740f9c15ff89530751b86e3b9dbf85d65e 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -10,11 +10,9 @@ class WebSocketClient extends Client {
static const int NOT_MAP_ERROR_CODE = 4002;
final WebSocket socket;
- WebSocketClient(this.socket, service) : super(service) {
+ WebSocketClient(this.socket, VMService service) : super(service) {
socket.listen((message) => onWebSocketMessage(message));
socket.done.then((_) => close());
- service.subscribe('debug', this);
- service.subscribe('gc', this);
}
void onWebSocketMessage(message) {
@@ -37,15 +35,15 @@ class WebSocketClient extends Client {
}
}
- void post(var serial, dynamic response) {
+ void post(var serial, dynamic result) {
try {
- Map map = {
- 'id': serial,
- 'response': response
- };
- if (serial == null && response is! String) {
- socket.add(response);
+ if (serial == null && result is! String) {
+ socket.add(result);
} else {
+ Map map = {
+ 'id': serial,
+ 'result': result
+ };
socket.add(JSON.encode(map));
}
} catch (_) {
@@ -67,11 +65,12 @@ class HttpRequestClient extends Client {
new ContentType("application", "json", charset: "utf-8");
final HttpRequest request;
- HttpRequestClient(this.request, service) : super(service);
+ HttpRequestClient(this.request, VMService service)
+ : super(service, sendEvents:false);
- void post(var serial, String response) {
+ void post(var serial, String result) {
request.response..headers.contentType = jsonContentType
- ..write(response)
+ ..write(result)
..close();
close();
}
« no previous file with comments | « no previous file | runtime/observatory/lib/service_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698