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

Unified Diff: runtime/observatory/lib/src/repositories/event.dart

Issue 2211603002: Centralized event streams (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Merged with master Created 4 years, 4 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/repositories/event.dart
diff --git a/runtime/observatory/lib/src/repositories/event.dart b/runtime/observatory/lib/src/repositories/event.dart
new file mode 100644
index 0000000000000000000000000000000000000000..d6300e99afaaee6393d61aeb78a84f6633797216
--- /dev/null
+++ b/runtime/observatory/lib/src/repositories/event.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of repositories;
+
+class EventRepository implements M.EventRepository {
+ final StreamController<M.Event> _onEvent;
+ Stream<M.Event> get onEvent => _onEvent.stream;
+
+ final Stream<M.VMEvent> onVMEvent;
+ final Stream<M.VMUpdateEvent> onVMUpdate;
+ final Stream<M.IsolateEvent> onIsolateEvent;
+ final Stream<M.IsolateStartEvent> onIsolateStart;
+ final Stream<M.IsolateRunnableEvent> onIsolateRunnable;
+ final Stream<M.IsolateExitEvent> onIsolateExit;
+ final Stream<M.IsolateUpdateEvent> onIsolateUpdate;
+ final Stream<M.IsolateReloadEvent> onIsolateReload;
+ final Stream<M.ServiceExtensionAddedEvent> onServiceExtensionAdded;
+ final Stream<M.DebugEvent> onDebugEvent;
+ final Stream<M.PauseStartEvent> onPauseStart;
+ final Stream<M.PauseExitEvent> onPauseExit;
+ final Stream<M.PauseBreakpointEvent> onPauseBreakpoint;
+ final Stream<M.PauseInterruptedEvent> onPauseInterrupted;
+ final Stream<M.PauseExceptionEvent> onPauseException;
+ final Stream<M.ResumeEvent> onResume;
+ final Stream<M.BreakpointAddedEvent> onBreakpointAdded;
+ final Stream<M.BreakpointResolvedEvent> onBreakpointResolved;
+ final Stream<M.BreakpointRemovedEvent> onBreakpointRemoved;
+ final Stream<M.InspectEvent> onInspect;
+ final Stream<M.GCEvent> onGCEvent;
+ final Stream<M.ExtensionEvent> onExtensionEvent;
+ final Stream<M.TimelineEventsEvent> onTimelineEvents;
+ final Stream<M.ConnectionClosedEvent> onConnectionClosed;
+
+ EventRepository() : this._(new StreamController.broadcast());
+
+ EventRepository._(StreamController controller) : this.__(controller,
+ controller.stream.where((e) => e is M.VMEvent),
+ controller.stream.where((e) => e is M.IsolateEvent),
+ controller.stream.where((e) => e is M.DebugEvent),
+ controller.stream.where((e) => e is M.GCEvent),
+ controller.stream.where((e) => e is M.ExtensionEvent),
+ controller.stream.where((e) => e is M.TimelineEventsEvent),
+ controller.stream.where((e) => e is M.ConnectionClosedEvent));
+
+ EventRepository.__(StreamController controller,
+ Stream<M.VMEvent> onVMEvent, Stream<M.IsolateEvent> onIsolateEvent,
+ Stream<M.DebugEvent> onDebugEvent, Stream<M.GCEvent> onGCEvent,
+ Stream<M.ExtensionEvent> onExtensionEvent,
+ Stream<M.TimelineEventsEvent> onTimelineEvents,
+ Stream<M.ConnectionClosedEvent> onConnectionClosed)
+ : _onEvent = controller,
+ onVMEvent = onVMEvent,
+ onVMUpdate = onVMEvent.where((e) => e is M.VMUpdateEvent),
+ onIsolateEvent = onIsolateEvent,
+ onIsolateStart = onIsolateEvent.where((e) => e is M.IsolateStartEvent),
+ onIsolateRunnable =
+ onIsolateEvent.where((e) => e is M.IsolateRunnableEvent),
+ onIsolateExit = onIsolateEvent.where((e) => e is M.IsolateExitEvent),
+ onIsolateUpdate = onIsolateEvent.where((e) => e is M.IsolateUpdateEvent),
+ onIsolateReload = onIsolateEvent.where((e) => e is M.IsolateReloadEvent),
+ onServiceExtensionAdded =
+ onIsolateEvent.where((e) => e is M.IsolateReloadEvent),
+ onDebugEvent = onDebugEvent,
+ onPauseStart = onDebugEvent.where((e) => e is M.PauseStartEvent),
+ onPauseExit = onDebugEvent.where((e) => e is M.PauseExitEvent),
+ onPauseBreakpoint =
+ onDebugEvent.where((e) => e is M.PauseBreakpointEvent),
+ onPauseInterrupted =
+ onDebugEvent.where((e) => e is M.PauseInterruptedEvent),
+ onPauseException = onDebugEvent.where((e) => e is M.PauseExceptionEvent),
+ onResume = onDebugEvent.where((e) => e is M.ResumeEvent),
+ onBreakpointAdded =
+ onDebugEvent.where((e) => e is M.BreakpointAddedEvent),
+ onBreakpointResolved =
+ onDebugEvent.where((e) => e is M.BreakpointResolvedEvent),
+ onBreakpointRemoved =
+ onDebugEvent.where((e) => e is M.BreakpointRemovedEvent),
+ onInspect = onDebugEvent.where((e) => e is M.InspectEvent),
+ onGCEvent = onGCEvent,
+ onExtensionEvent = onExtensionEvent,
+ onTimelineEvents = onTimelineEvents,
+ onConnectionClosed = onConnectionClosed;
+
+ void add(M.Event e) {
+ _onEvent.add(e);
+ }
+}
« no previous file with comments | « runtime/observatory/lib/src/models/repositories/target.dart ('k') | runtime/observatory/lib/src/repositories/flag.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698