OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'dart:html'; | 5 import 'dart:html'; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
9 import 'package:observatory/src/elements/helpers/tag.dart'; | 9 import 'package:observatory/src/elements/helpers/tag.dart'; |
10 | 10 |
11 class IsolateRunStateElement extends HtmlElement implements Renderable { | 11 class IsolateRunStateElement extends HtmlElement implements Renderable { |
12 static const tag = const Tag<IsolateRunStateElement>('isolate-run-state'); | 12 static const tag = const Tag<IsolateRunStateElement>('isolate-run-state'); |
13 | 13 |
14 RenderingScheduler<IsolateRunStateElement> _r; | 14 RenderingScheduler<IsolateRunStateElement> _r; |
15 | 15 |
16 Stream<RenderedEvent<IsolateRunStateElement>> get onRendered => | 16 Stream<RenderedEvent<IsolateRunStateElement>> get onRendered => _r.onRendered; |
17 _r.onRendered; | |
18 | 17 |
19 M.Isolate _isolate; | 18 M.Isolate _isolate; |
20 M.EventRepository _events; | 19 M.EventRepository _events; |
21 StreamSubscription _debugSubscription; | 20 StreamSubscription _debugSubscription; |
22 StreamSubscription _isolateSubscription; | 21 StreamSubscription _isolateSubscription; |
23 | 22 |
24 factory IsolateRunStateElement(M.Isolate isolate, | 23 factory IsolateRunStateElement(M.Isolate isolate, M.EventRepository events, |
25 M.EventRepository events, | 24 {RenderingQueue queue}) { |
26 {RenderingQueue queue}) { | |
27 assert(isolate != null); | 25 assert(isolate != null); |
28 assert(events != null); | 26 assert(events != null); |
29 IsolateRunStateElement e = document.createElement(tag.name); | 27 IsolateRunStateElement e = document.createElement(tag.name); |
30 e._r = new RenderingScheduler(e, queue: queue); | 28 e._r = new RenderingScheduler(e, queue: queue); |
31 e._isolate = isolate; | 29 e._isolate = isolate; |
32 e._events = events; | 30 e._events = events; |
33 return e; | 31 return e; |
34 } | 32 } |
35 | 33 |
36 IsolateRunStateElement.created() : super.created(); | 34 IsolateRunStateElement.created() : super.created(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 71 } |
74 } | 72 } |
75 | 73 |
76 void _eventListener(e) { | 74 void _eventListener(e) { |
77 if (e.isolate.id == _isolate.id) { | 75 if (e.isolate.id == _isolate.id) { |
78 _isolate = e.isolate; | 76 _isolate = e.isolate; |
79 _r.dirty(); | 77 _r.dirty(); |
80 } | 78 } |
81 } | 79 } |
82 } | 80 } |
OLD | NEW |