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 megamorphiccache_view; | 5 library megamorphiccache_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'; | 13 import 'package:observatory/src/elements/helpers/nav_bar.dart'; |
14 import 'package:observatory/src/elements/helpers/nav_menu.dart'; | 14 import 'package:observatory/src/elements/helpers/nav_menu.dart'; |
15 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; | 15 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart'; |
16 import 'package:observatory/src/elements/helpers/tag.dart'; | 16 import 'package:observatory/src/elements/helpers/tag.dart'; |
17 import 'package:observatory/src/elements/nav/isolate_menu.dart'; | 17 import 'package:observatory/src/elements/nav/isolate_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 MegamorphicCacheViewElement extends HtmlElement implements Renderable { | 25 class MegamorphicCacheViewElement extends HtmlElement implements Renderable { |
26 static const tag = | 26 static const tag = const Tag<MegamorphicCacheViewElement>( |
27 const Tag<MegamorphicCacheViewElement>('megamorphiccache-view', | 27 'megamorphiccache-view', |
28 dependencies: const [ | 28 dependencies: const [ |
29 ContextRefElement.tag, | 29 ContextRefElement.tag, |
30 CurlyBlockElement.tag, | 30 CurlyBlockElement.tag, |
31 NavTopMenuElement.tag, | 31 NavTopMenuElement.tag, |
32 NavVMMenuElement.tag, | 32 NavVMMenuElement.tag, |
33 NavIsolateMenuElement.tag, | 33 NavIsolateMenuElement.tag, |
34 NavRefreshElement.tag, | 34 NavRefreshElement.tag, |
35 NavNotifyElement.tag, | 35 NavNotifyElement.tag, |
36 ObjectCommonElement.tag, | 36 ObjectCommonElement.tag, |
37 ViewFooterElement.tag | 37 ViewFooterElement.tag |
38 ]); | 38 ]); |
39 | 39 |
40 RenderingScheduler<MegamorphicCacheViewElement> _r; | 40 RenderingScheduler<MegamorphicCacheViewElement> _r; |
41 | 41 |
42 Stream<RenderedEvent<MegamorphicCacheViewElement>> get onRendered => | 42 Stream<RenderedEvent<MegamorphicCacheViewElement>> get onRendered => |
43 _r.onRendered; | 43 _r.onRendered; |
44 | 44 |
45 M.VM _vm; | 45 M.VM _vm; |
46 M.IsolateRef _isolate; | 46 M.IsolateRef _isolate; |
47 M.EventRepository _events; | 47 M.EventRepository _events; |
48 M.NotificationRepository _notifications; | 48 M.NotificationRepository _notifications; |
49 M.MegamorphicCache _cache; | 49 M.MegamorphicCache _cache; |
50 M.MegamorphicCacheRepository _caches; | 50 M.MegamorphicCacheRepository _caches; |
51 M.RetainedSizeRepository _retainedSizes; | 51 M.RetainedSizeRepository _retainedSizes; |
52 M.ReachableSizeRepository _reachableSizes; | 52 M.ReachableSizeRepository _reachableSizes; |
53 M.InboundReferencesRepository _references; | 53 M.InboundReferencesRepository _references; |
54 M.RetainingPathRepository _retainingPaths; | 54 M.RetainingPathRepository _retainingPaths; |
55 M.InstanceRepository _instances; | 55 M.InstanceRepository _instances; |
56 | 56 |
57 | |
58 M.VMRef get vm => _vm; | 57 M.VMRef get vm => _vm; |
59 M.IsolateRef get isolate => _isolate; | 58 M.IsolateRef get isolate => _isolate; |
60 M.NotificationRepository get notifications => _notifications; | 59 M.NotificationRepository get notifications => _notifications; |
61 M.MegamorphicCache get cache => _cache; | 60 M.MegamorphicCache get cache => _cache; |
62 | 61 |
63 factory MegamorphicCacheViewElement(M.VM vm, M.IsolateRef isolate, | 62 factory MegamorphicCacheViewElement( |
64 M.MegamorphicCache cache, | 63 M.VM vm, |
65 M.EventRepository events, | 64 M.IsolateRef isolate, |
66 M.NotificationRepository notifications, | 65 M.MegamorphicCache cache, |
67 M.MegamorphicCacheRepository caches, | 66 M.EventRepository events, |
68 M.RetainedSizeRepository retainedSizes, | 67 M.NotificationRepository notifications, |
69 M.ReachableSizeRepository reachableSizes, | 68 M.MegamorphicCacheRepository caches, |
70 M.InboundReferencesRepository references, | 69 M.RetainedSizeRepository retainedSizes, |
71 M.RetainingPathRepository retainingPaths, | 70 M.ReachableSizeRepository reachableSizes, |
72 M.InstanceRepository instances, | 71 M.InboundReferencesRepository references, |
73 {RenderingQueue queue}) { | 72 M.RetainingPathRepository retainingPaths, |
| 73 M.InstanceRepository instances, |
| 74 {RenderingQueue queue}) { |
74 assert(vm != null); | 75 assert(vm != null); |
75 assert(isolate != null); | 76 assert(isolate != null); |
76 assert(events != null); | 77 assert(events != null); |
77 assert(notifications != null); | 78 assert(notifications != null); |
78 assert(cache != null); | 79 assert(cache != null); |
79 assert(caches != null); | 80 assert(caches != null); |
80 assert(retainedSizes != null); | 81 assert(retainedSizes != null); |
81 assert(reachableSizes != null); | 82 assert(reachableSizes != null); |
82 assert(references != null); | 83 assert(references != null); |
83 assert(retainingPaths != null); | 84 assert(retainingPaths != null); |
(...skipping 30 matching lines...) Expand all Loading... |
114 } | 115 } |
115 | 116 |
116 void render() { | 117 void render() { |
117 children = [ | 118 children = [ |
118 navBar([ | 119 navBar([ |
119 new NavTopMenuElement(queue: _r.queue), | 120 new NavTopMenuElement(queue: _r.queue), |
120 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 121 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
121 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 122 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
122 navMenu('megamorphic inline cache'), | 123 navMenu('megamorphic inline cache'), |
123 new NavRefreshElement(queue: _r.queue) | 124 new NavRefreshElement(queue: _r.queue) |
124 ..onRefresh.listen((e) async { | 125 ..onRefresh.listen((e) async { |
125 e.element.disabled = true; | 126 e.element.disabled = true; |
126 _cache = await _caches.get(_isolate, _cache.id); | 127 _cache = await _caches.get(_isolate, _cache.id); |
127 _r.dirty(); | 128 _r.dirty(); |
128 }), | 129 }), |
129 new NavNotifyElement(_notifications, queue: _r.queue) | 130 new NavNotifyElement(_notifications, queue: _r.queue) |
130 ]), | 131 ]), |
131 new DivElement()..classes = ['content-centered-big'] | 132 new DivElement() |
| 133 ..classes = ['content-centered-big'] |
132 ..children = [ | 134 ..children = [ |
133 new HeadingElement.h2()..text = 'Megamorphic Cache', | 135 new HeadingElement.h2()..text = 'Megamorphic Cache', |
134 new HRElement(), | 136 new HRElement(), |
135 new ObjectCommonElement(_isolate, _cache, _retainedSizes, | 137 new ObjectCommonElement(_isolate, _cache, _retainedSizes, |
136 _reachableSizes, _references, _retainingPaths, | 138 _reachableSizes, _references, _retainingPaths, _instances, |
137 _instances, queue: _r.queue), | 139 queue: _r.queue), |
138 new BRElement(), | 140 new BRElement(), |
139 new DivElement()..classes = ['memberList'] | 141 new DivElement() |
| 142 ..classes = ['memberList'] |
140 ..children = [ | 143 ..children = [ |
141 new DivElement()..classes = ['memberItem'] | 144 new DivElement() |
| 145 ..classes = ['memberItem'] |
142 ..children = [ | 146 ..children = [ |
143 new DivElement()..classes = ['memberName'] | 147 new DivElement() |
| 148 ..classes = ['memberName'] |
144 ..text = 'selector', | 149 ..text = 'selector', |
145 new DivElement()..classes = ['memberName'] | 150 new DivElement() |
| 151 ..classes = ['memberName'] |
146 ..text = '${_cache.selector}' | 152 ..text = '${_cache.selector}' |
147 ], | 153 ], |
148 new DivElement()..classes = ['memberItem'] | 154 new DivElement() |
| 155 ..classes = ['memberItem'] |
149 ..children = [ | 156 ..children = [ |
150 new DivElement()..classes = ['memberName'] | 157 new DivElement() |
| 158 ..classes = ['memberName'] |
151 ..text = 'mask', | 159 ..text = 'mask', |
152 new DivElement()..classes = ['memberName'] | 160 new DivElement() |
| 161 ..classes = ['memberName'] |
153 ..text = '${_cache.mask}' | 162 ..text = '${_cache.mask}' |
154 ], | 163 ], |
155 new DivElement()..classes = ['memberItem'] | 164 new DivElement() |
| 165 ..classes = ['memberItem'] |
156 ..children = [ | 166 ..children = [ |
157 new DivElement()..classes = ['memberName'] | 167 new DivElement() |
| 168 ..classes = ['memberName'] |
158 ..text = 'buckets', | 169 ..text = 'buckets', |
159 new DivElement()..classes = ['memberName'] | 170 new DivElement() |
| 171 ..classes = ['memberName'] |
160 ..children = [ | 172 ..children = [ |
161 anyRef(_isolate, _cache.buckets, _instances, | 173 anyRef(_isolate, _cache.buckets, _instances, |
162 queue: _r.queue) | 174 queue: _r.queue) |
163 ] | 175 ] |
164 ], | 176 ], |
165 new DivElement()..classes = ['memberItem'] | 177 new DivElement() |
| 178 ..classes = ['memberItem'] |
166 ..children = [ | 179 ..children = [ |
167 new DivElement()..classes = ['memberName'] | 180 new DivElement() |
| 181 ..classes = ['memberName'] |
168 ..text = 'argumentsDescriptor', | 182 ..text = 'argumentsDescriptor', |
169 new DivElement()..classes = ['memberName'] | 183 new DivElement() |
| 184 ..classes = ['memberName'] |
170 ..children = [ | 185 ..children = [ |
171 anyRef(_isolate, _cache.argumentsDescriptor, _instances, | 186 anyRef(_isolate, _cache.argumentsDescriptor, _instances, |
172 queue: _r.queue) | 187 queue: _r.queue) |
173 ] | 188 ] |
174 ] | 189 ] |
175 ], | 190 ], |
176 new HRElement(), | 191 new HRElement(), |
177 new ViewFooterElement(queue: _r.queue) | 192 new ViewFooterElement(queue: _r.queue) |
178 ] | 193 ] |
179 ]; | 194 ]; |
180 } | 195 } |
181 } | 196 } |
OLD | NEW |