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

Side by Side Diff: runtime/observatory/lib/src/elements/isolate/summary.dart

Issue 2304463002: Converted Observatory vm-view && isolate-view elements (Closed)
Patch Set: Fixed typo Created 4 years, 3 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'dart:html';
6 import 'dart:async';
7 import 'package:observatory/models.dart' as M;
8 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
9 import 'package:observatory/src/elements/helpers/tag.dart';
10 import 'package:observatory/src/elements/helpers/uris.dart';
11 import 'package:observatory/src/elements/isolate_ref.dart';
12 import 'package:observatory/src/elements/isolate/location.dart';
13 import 'package:observatory/src/elements/isolate/run_state.dart';
14 import 'package:observatory/src/elements/isolate/shared_summary.dart';
15
16 class IsolateSummaryElement extends HtmlElement implements Renderable {
17 static const tag = const Tag<IsolateSummaryElement>('isolate-summary',
18 dependencies: const [
19 IsolateRefElement.tag,
20 IsolateLocationElement.tag,
21 IsolateRunStateElement.tag,
22 IsolateSharedSummaryElement.tag
23 ]);
24
25 RenderingScheduler<IsolateSummaryElement> _r;
26
27 Stream<RenderedEvent<IsolateSummaryElement>> get onRendered =>
28 _r.onRendered;
29
30 M.IsolateRef _isolate;
31 M.EventRepository _events;
32 M.IsolateRepository _isolates;
33 M.ScriptRepository _scripts;
34 M.Isolate _loadedIsolate;
35
36 factory IsolateSummaryElement(M.IsolateRef isolate,
37 M.IsolateRepository isolates,
38 M.EventRepository events,
39 M.ScriptRepository scripts,
40 {RenderingQueue queue}) {
41 assert(isolate != null);
42 assert(isolates != null);
43 assert(events != null);
44 assert(scripts != null);
45 IsolateSummaryElement e = document.createElement(tag.name);
46 e._r = new RenderingScheduler(e, queue: queue);
47 e._isolate = isolate;
48 e._isolates = isolates;
49 e._events = events;
50 e._scripts = scripts;
51 return e;
52 }
53
54 IsolateSummaryElement.created() : super.created();
55
56 @override
57 void attached() {
58 super.attached();
59 _r.enable();
60 _load();
61 }
62
63 @override
64 void detached() {
65 super.detached();
66 children = [];
67 _r.disable(notify: true);
68 }
69
70 void render() {
71 if (_loadedIsolate == null) {
72 children = [
73 new SpanElement()..text = 'loading ',
74 new IsolateRefElement(_isolate, _events, queue: _r.queue)
75 ];
76 } else {
77 children = [
78 new DivElement()..classes = ['flex-row']
79 ..children = [
80 new DivElement()
81 ..children = [
82 new IsolateRefElement(_isolate, _events, queue: _r.queue)
83 ],
84 new DivElement()..style.flex = '1',
85 new DivElement()
86 ..children = [
87 new IsolateRunStateElement(_isolate, _events, queue: _r.queue),
88 new IsolateLocationElement(_isolate, _events, _scripts,
89 queue: _r.queue),
90 new SpanElement()..text = ' [',
91 new AnchorElement(href: Uris.debugger(_isolate))
92 ..text = 'debug',
93 new SpanElement()..text = ']'
94 ]
95 ],
96 new BRElement(),
97 new IsolateSharedSummaryElement(_isolate, _events, queue: _r.queue)
98 ];
99 }
100 }
101
102 Future _load() async {
103 _loadedIsolate = await _isolates.get(_isolate);
104 _r.dirty();
105 }
106 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698