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

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: code review 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 | « runtime/observatory/lib/service_common.dart ('k') | runtime/observatory/lib/src/app/location_manager.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a76823276e0f34b0996428b57188e5bbb7b56bc4..ae1c2fbb4c5a1b3ed8bdb71f83b12caf01cd274e 100644
--- a/runtime/observatory/lib/src/app/application.dart
+++ b/runtime/observatory/lib/src/app/application.dart
@@ -26,8 +26,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);
@@ -130,7 +144,7 @@ class ObservatoryApplication extends Observable {
this.vm = null;
locationManager.go(locationManager.makeLink('/vm-connect/'));
} else {
- _visit(Uri.parse('error/'), null);
+ _visit(Uri.parse('error/'), {});
}
}
@@ -200,23 +214,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());
- }
}
« no previous file with comments | « runtime/observatory/lib/service_common.dart ('k') | runtime/observatory/lib/src/app/location_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698