OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library objectpool_view; | 5 library objectpool_view; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:html'; | 8 import 'dart:html'; |
9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
10 import 'package:observatory/src/elements/context_ref.dart'; | 10 import 'package:observatory/src/elements/context_ref.dart'; |
11 import 'package:observatory/src/elements/curly_block.dart'; | 11 import 'package:observatory/src/elements/curly_block.dart'; |
12 import 'package:observatory/src/elements/helpers/any_ref.dart'; | 12 import 'package:observatory/src/elements/helpers/any_ref.dart'; |
| 13 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
| 14 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 15 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
14 import 'package:observatory/src/elements/helpers/tag.dart'; | 16 import 'package:observatory/src/elements/helpers/tag.dart'; |
15 import 'package:observatory/src/elements/nav/bar.dart'; | |
16 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 17 import 'package:observatory/src/elements/nav/isolate_menu.dart'; |
17 import 'package:observatory/src/elements/nav/menu.dart'; | |
18 import 'package:observatory/src/elements/nav/notify.dart'; | 18 import 'package:observatory/src/elements/nav/notify.dart'; |
19 import 'package:observatory/src/elements/nav/refresh.dart'; | 19 import 'package:observatory/src/elements/nav/refresh.dart'; |
20 import 'package:observatory/src/elements/nav/top_menu.dart'; | 20 import 'package:observatory/src/elements/nav/top_menu.dart'; |
21 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 21 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
22 import 'package:observatory/src/elements/object_common.dart'; | 22 import 'package:observatory/src/elements/object_common.dart'; |
23 import 'package:observatory/src/elements/view_footer.dart'; | 23 import 'package:observatory/src/elements/view_footer.dart'; |
24 | 24 |
25 class ObjectPoolViewElement extends HtmlElement implements Renderable { | 25 class ObjectPoolViewElement extends HtmlElement implements Renderable { |
26 static const tag = const Tag<ObjectPoolViewElement>('object-pool-view', | 26 static const tag = const Tag<ObjectPoolViewElement>('object-pool-view', |
27 dependencies: const [ | 27 dependencies: const [ |
28 ContextRefElement.tag, | 28 ContextRefElement.tag, |
29 CurlyBlockElement.tag, | 29 CurlyBlockElement.tag, |
30 NavBarElement.tag, | |
31 NavTopMenuElement.tag, | 30 NavTopMenuElement.tag, |
32 NavVMMenuElement.tag, | 31 NavVMMenuElement.tag, |
33 NavIsolateMenuElement.tag, | 32 NavIsolateMenuElement.tag, |
34 NavMenuElement.tag, | |
35 NavRefreshElement.tag, | 33 NavRefreshElement.tag, |
36 NavNotifyElement.tag, | 34 NavNotifyElement.tag, |
37 ObjectCommonElement.tag, | 35 ObjectCommonElement.tag, |
38 ViewFooterElement.tag | 36 ViewFooterElement.tag |
39 ]); | 37 ]); |
40 | 38 |
41 RenderingScheduler<ObjectPoolViewElement> _r; | 39 RenderingScheduler<ObjectPoolViewElement> _r; |
42 | 40 |
43 Stream<RenderedEvent<ObjectPoolViewElement>> get onRendered => _r.onRendered; | 41 Stream<RenderedEvent<ObjectPoolViewElement>> get onRendered => _r.onRendered; |
44 | 42 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 106 |
109 @override | 107 @override |
110 detached() { | 108 detached() { |
111 super.detached(); | 109 super.detached(); |
112 _r.disable(notify: true); | 110 _r.disable(notify: true); |
113 children = []; | 111 children = []; |
114 } | 112 } |
115 | 113 |
116 void render() { | 114 void render() { |
117 children = [ | 115 children = [ |
118 new NavBarElement(queue: _r.queue) | 116 navBar([ |
119 ..children = [ | 117 new NavTopMenuElement(queue: _r.queue), |
120 new NavTopMenuElement(queue: _r.queue), | 118 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
121 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 119 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
122 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 120 navMenu('instance'), |
123 new NavMenuElement('instance', last: true, queue: _r.queue), | 121 new NavRefreshElement(queue: _r.queue) |
124 new NavRefreshElement(queue: _r.queue) | 122 ..onRefresh.listen((e) async { |
125 ..onRefresh.listen((e) async { | 123 e.element.disabled = true; |
126 e.element.disabled = true; | 124 _pool = await _pools.get(_isolate, _pool.id); |
127 _pool = await _pools.get(_isolate, _pool.id); | 125 _r.dirty(); |
128 _r.dirty(); | 126 }), |
129 }), | 127 new NavNotifyElement(_notifications, queue: _r.queue) |
130 new NavNotifyElement(_notifications, queue: _r.queue) | 128 ]), |
131 ], | |
132 new DivElement()..classes = ['content-centered-big'] | 129 new DivElement()..classes = ['content-centered-big'] |
133 ..children = [ | 130 ..children = [ |
134 new HeadingElement.h2()..text = 'Object Pool', | 131 new HeadingElement.h2()..text = 'Object Pool', |
135 new HRElement(), | 132 new HRElement(), |
136 new ObjectCommonElement(_isolate, _pool, _retainedSizes, | 133 new ObjectCommonElement(_isolate, _pool, _retainedSizes, |
137 _reachableSizes, _references, _retainingPaths, | 134 _reachableSizes, _references, _retainingPaths, |
138 _instances, queue: _r.queue), | 135 _instances, queue: _r.queue), |
139 new HRElement(), | 136 new HRElement(), |
140 new HeadingElement.h3()..text = 'entries (${_pool.entries.length})', | 137 new HeadingElement.h3()..text = 'entries (${_pool.entries.length})', |
141 new DivElement()..classes = ['memberList'] | 138 new DivElement()..classes = ['memberList'] |
(...skipping 25 matching lines...) Expand all Loading... |
167 ]; | 164 ]; |
168 case M.ObjectPoolEntryKind.nativeEntry: | 165 case M.ObjectPoolEntryKind.nativeEntry: |
169 return [ | 166 return [ |
170 new SpanElement() | 167 new SpanElement() |
171 ..text = 'NativeEntry 0x${entry.asInteger.toRadixString(16)}' | 168 ..text = 'NativeEntry 0x${entry.asInteger.toRadixString(16)}' |
172 ]; | 169 ]; |
173 } | 170 } |
174 throw new Exception('Unkown ObjectPoolEntryKind (${entry.kind})'); | 171 throw new Exception('Unkown ObjectPoolEntryKind (${entry.kind})'); |
175 } | 172 } |
176 } | 173 } |
OLD | NEW |