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

Unified Diff: runtime/observatory/lib/src/app/application.dart

Issue 1093043004: Do not JSON encode the 'result' of a service rpc. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: edits 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
Index: runtime/observatory/lib/src/app/application.dart
diff --git a/runtime/observatory/lib/src/app/application.dart b/runtime/observatory/lib/src/app/application.dart
index d87d6fb6339416b0ed32c2fe8d92ee40876a3f16..fbe49a8cdbe4dfc919c63ee9c6c95fe126bb9f65 100644
--- a/runtime/observatory/lib/src/app/application.dart
+++ b/runtime/observatory/lib/src/app/application.dart
@@ -25,8 +25,22 @@ class ObservatoryApplication extends Observable {
}
if (vm != null) {
Logger.root.info('Registering new VM callbacks');
- vm.onConnect.then(_vmConnected);
- vm.onDisconnect.then(_vmDisconnected);
+
+ vm.onConnect.then((_) {
+ if (vm is WebSocketVM) {
+ targets.add(vm.target);
+ }
+ _removeDisconnectEvents();
+ });
+
+ vm.onDisconnect.then((String reason) {
+ if (this.vm != vm) {
+ // This disconnect event occured *after* a new VM was installed.
+ return;
+ }
+ notifications.add(new ServiceEvent.connectionClosed(reason));
+ });
+
vm.errors.stream.listen(_onError);
vm.events.stream.listen(_onEvent);
vm.exceptions.stream.listen(_onException);
@@ -204,23 +218,7 @@ class ObservatoryApplication extends Observable {
void _removeDisconnectEvents() {
notifications.removeWhere((oldEvent) {
- return (oldEvent.eventType == ServiceEvent.kVMDisconnected);
+ return (oldEvent.eventType == ServiceEvent.kConnectionClosed);
});
}
-
- _vmConnected(VM vm) {
- if (vm is WebSocketVM) {
- targets.add(vm.target);
- }
- _removeDisconnectEvents();
- }
-
- _vmDisconnected(VM vm) {
- if (this.vm != vm) {
- // This disconnect event occured *after* a new VM was installed.
- return;
- }
- this.vm = null;
- notifications.add(new ServiceEvent.vmDisconencted());
- }
}

Powered by Google App Engine
This is Rietveld 408576698