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

Unified Diff: runtime/observatory/lib/src/elements/nav/isolate_menu_wrapper.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/elements/nav/isolate_menu_wrapper.dart
diff --git a/runtime/observatory/lib/src/elements/nav/isolate_menu_wrapper.dart b/runtime/observatory/lib/src/elements/nav/isolate_menu_wrapper.dart
index 3af85d2576ed61b3180a915ee6f46171588059ea..ff4e1ed8cd6537f1ce8adcd0abd98e7de0df19d4 100644
--- a/runtime/observatory/lib/src/elements/nav/isolate_menu_wrapper.dart
+++ b/runtime/observatory/lib/src/elements/nav/isolate_menu_wrapper.dart
@@ -3,12 +3,9 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:html';
-import 'dart:async';
import 'package:observatory/app.dart';
import 'package:observatory/service.dart';
-import 'package:observatory/mocks.dart';
-import 'package:observatory/models.dart' as M;
import 'package:observatory/src/elements/helpers/tag.dart';
import 'package:observatory/src/elements/shims/binding.dart';
import 'package:observatory/src/elements/nav/isolate_menu.dart';
@@ -22,24 +19,22 @@ class NavIsolateMenuElementWrapper extends HtmlElement {
static const tag =
const Tag<NavIsolateMenuElementWrapper>('isolate-nav-menu');
- final StreamController<M.IsolateUpdateEvent> _updatesController =
- new StreamController<M.IsolateUpdateEvent>();
- Stream<M.IsolateUpdateEvent> _updates;
- StreamSubscription _subscription;
-
bool _last = false;
Isolate _isolate;
+
bool get last => _last;
Isolate get isolate => _isolate;
+
set last(bool value) {
- _last = value; render();
+ _last = value;
+ render();
}
set isolate(Isolate value) {
- _isolate = value; _detached(); _attached();
+ _isolate = value;
+ render();
}
NavIsolateMenuElementWrapper.created() : super.created() {
- _updates = _updatesController.stream.asBroadcastStream();
binder.registerCallback(this);
_last = _getBoolAttribute('last');
createShadowRoot();
@@ -49,42 +44,24 @@ class NavIsolateMenuElementWrapper extends HtmlElement {
@override
void attached() {
super.attached();
- _attached();
- }
-
- @override
- void detached() {
- super.detached();
- _detached();
- }
-
- void _attached() {
- if (_isolate != null) {
- _subscription = _isolate.changes.listen((_) {
- _updatesController.add(new IsolateUpdateEventMock(isolate: isolate));
- });
- }
render();
}
- void _detached() {
- if (_subscription != null) {
- _subscription.cancel();
- _subscription = null;
- }
- }
-
void render() {
shadowRoot.children = [];
- if (_isolate == null || _last == null) return;
+ if (_isolate == null || _last == null) {
+ return;
+ }
shadowRoot.children = [
- new NavIsolateMenuElement(isolate, _updates, last: last,
- queue: ObservatoryApplication.app.queue)
+ new NavIsolateMenuElement(_isolate, app.events, last: _last,
+ queue: app.queue)
..children = [new ContentElement()]
];
}
+ ObservatoryApplication get app => ObservatoryApplication.app;
+
bool _getBoolAttribute(String name) {
final String value = getAttribute(name);
return !(value == null || value == 'false');
« no previous file with comments | « runtime/observatory/lib/src/elements/nav/isolate_menu.dart ('k') | runtime/observatory/lib/src/elements/nav/library_menu.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698