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

Unified Diff: runtime/bin/vmservice/client/lib/src/app/application.dart

Issue 340443006: Add support for asynchronous event notification to the observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
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..a4f1fba4d7f6fbe20b56d184844ba77961c5d7e1 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,51 @@ 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 '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 +250,7 @@ class ObservatoryApplication extends Observable {
ObservatoryApplication(this.rootElement) :
locationManager = new HashLocationManager(),
- vm = new HttpVM() {
+ vm = new WebSocketVM() {
_initOnce();
}
}
« no previous file with comments | « runtime/bin/vmservice/client/lib/service_html.dart ('k') | runtime/bin/vmservice/client/lib/src/elements/isolate_ref.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698