Chromium Code Reviews| Index: runtime/bin/vmservice/client/lib/src/app/application.dart |
| diff --git a/runtime/bin/vmservice/client/lib/src/app/application.dart b/runtime/bin/vmservice/client/lib/src/app/application.dart |
| index 183d6b18a77eeb3d0d240d1a3765691699ba8282..8b83ead101523c0e0aeb4abc264a189632bd94ee 100644 |
| --- a/runtime/bin/vmservice/client/lib/src/app/application.dart |
| +++ b/runtime/bin/vmservice/client/lib/src/app/application.dart |
| @@ -116,6 +116,7 @@ class ErrorViewPane extends Pane { |
| /// The observatory application. Instances of this are created and owned |
| /// by the observatory_application custom element. |
| class ObservatoryApplication extends Observable { |
| + static ObservatoryApplication app; |
| final _paneRegistry = new List<Pane>(); |
| ServiceObjectPane _serviceObjectPane; |
| Pane _currentPane; |
| @@ -126,7 +127,12 @@ class ObservatoryApplication extends Observable { |
| @reflectable ServiceObject lastErrorOrException; |
| + @observable ObservableList<ServiceEvent> notifications = |
| + new ObservableList<ServiceEvent>(); |
| + |
| void _initOnce() { |
| + app = this; |
| + vm.events.stream.listen(_handleEvent); |
| _registerPanes(); |
| vm.errors.stream.listen(_onError); |
| vm.exceptions.stream.listen(_onException); |
| @@ -134,6 +140,55 @@ class ObservatoryApplication extends Observable { |
| locationManager._init(this); |
| } |
| + void _removePauseEvents(Isolate isolate) { |
| + bool isPauseEvent(var event) { |
| + return (event.eventType == 'IsolateInterrupted' || |
| + event.eventType == 'BreakpointReached' || |
| + event.eventType == 'ExceptionThrown'); |
| + } |
| + |
| + notifications.removeWhere((oldEvent) { |
| + return (oldEvent.isolate == isolate && |
| + isPauseEvent(oldEvent)); |
| + }); |
| + } |
| + |
| + void _handleEvent(ServiceEvent event) { |
| + switch(event.eventType) { |
| + case 'IsolateCreated': |
| + // vm.reload(); |
| + break; |
| + |
| + case 'IsolateShutdown': |
| + // TODO(turnidge): Should we show the user isolate shutdown events? |
| + // What if there are hundreds of them? Coalesce multiple |
| + // shutdown events into one notification? |
| + _removePauseEvents(event.isolate); |
| + // vm.reload(); |
| + break; |
| + |
| + case 'BreakpointResolved': |
| + // Do nothing. |
| + break; |
| + |
| + case 'IsolateResumed': |
| + _removePauseEvents(event.isolate); |
| + break; |
| + |
| + case 'BreakpointReached': |
| + case 'IsolateInterrupted': |
| + case 'ExceptionThrown': |
| + _removePauseEvents(event.isolate); |
| + notifications.add(event); |
| + break; |
| + |
| + default: |
| + // Ignore unrecognized events. |
| + Logger.root.severe('Unrecognized event type: ${event.eventType}'); |
| + break; |
| + } |
| + } |
| + |
| void _registerPanes() { |
| if (_serviceObjectPane != null) { |
| // Already done. |
| @@ -199,7 +254,7 @@ class ObservatoryApplication extends Observable { |
| ObservatoryApplication(this.rootElement) : |
| locationManager = new HashLocationManager(), |
| - vm = new HttpVM() { |
| + vm = new WebSocketVM() { |
|
turnidge
2014/06/26 21:27:46
I recall that this broke something last time I cha
Cutch
2014/06/27 16:03:49
This breaks clicking the Observatory link to recon
turnidge
2014/06/27 18:15:06
Ok, good.
|
| _initOnce(); |
| } |
| } |