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

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

Issue 2279203003: Converted Observatory megamorphiccache-view element (Closed)
Patch Set: Removed double Copyright notice 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
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 'observatory_element.dart'; 8 import 'dart:html';
9 import 'package:observatory/service.dart'; 9 import 'package:observatory/models.dart' as M;
10 import 'package:polymer/polymer.dart'; 10 import 'package:observatory/src/elements/context_ref.dart';
11 import 'package:observatory/src/elements/curly_block.dart';
12 import 'package:observatory/src/elements/helpers/any_ref.dart';
13 import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
14 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/menu.dart';
18 import 'package:observatory/src/elements/nav/notify.dart';
19 import 'package:observatory/src/elements/nav/refresh.dart';
20 import 'package:observatory/src/elements/nav/top_menu.dart';
21 import 'package:observatory/src/elements/nav/vm_menu.dart';
22 import 'package:observatory/src/elements/object_common.dart';
23 import 'package:observatory/src/elements/view_footer.dart';
11 24
12 @CustomTag('megamorphiccache-view') 25 class MegamorphicCacheViewElement extends HtmlElement implements Renderable {
13 class MegamorphicCacheViewElement extends ObservatoryElement { 26 static const tag =
14 @published MegamorphicCache megamorphicCache; 27 const Tag<MegamorphicCacheViewElement>('megamorphiccache-view',
28 dependencies: const [
29 ContextRefElement.tag,
30 CurlyBlockElement.tag,
31 NavBarElement.tag,
32 NavTopMenuElement.tag,
33 NavVMMenuElement.tag,
34 NavIsolateMenuElement.tag,
35 NavMenuElement.tag,
36 NavRefreshElement.tag,
37 NavNotifyElement.tag,
38 ObjectCommonElement.tag,
39 ViewFooterElement.tag
40 ]);
41
42 RenderingScheduler<MegamorphicCacheViewElement> _r;
43
44 Stream<RenderedEvent<MegamorphicCacheViewElement>> get onRendered =>
45 _r.onRendered;
46
47 M.VM _vm;
48 M.IsolateRef _isolate;
49 M.EventRepository _events;
50 M.NotificationRepository _notifications;
51 M.MegamorphicCache _cache;
52 M.MegamorphicCacheRepository _caches;
53 M.RetainedSizeRepository _retainedSizes;
54 M.ReachableSizeRepository _reachableSizes;
55 M.InboundReferencesRepository _references;
56 M.RetainingPathRepository _retainingPaths;
57 M.InstanceRepository _instances;
58
59
60 M.VMRef get vm => _vm;
61 M.IsolateRef get isolate => _isolate;
62 M.NotificationRepository get notifications => _notifications;
63 M.MegamorphicCache get cache => _cache;
64
65 factory MegamorphicCacheViewElement(M.VM vm, M.IsolateRef isolate,
66 M.MegamorphicCache cache,
67 M.EventRepository events,
68 M.NotificationRepository notifications,
69 M.MegamorphicCacheRepository caches,
70 M.RetainedSizeRepository retainedSizes,
71 M.ReachableSizeRepository reachableSizes,
72 M.InboundReferencesRepository references,
73 M.RetainingPathRepository retainingPaths,
74 M.InstanceRepository instances,
75 {RenderingQueue queue}) {
76 assert(vm != null);
77 assert(isolate != null);
78 assert(events != null);
79 assert(notifications != null);
80 assert(cache != null);
81 assert(caches != null);
82 assert(retainedSizes != null);
83 assert(reachableSizes != null);
84 assert(references != null);
85 assert(retainingPaths != null);
86 assert(instances != null);
87 MegamorphicCacheViewElement e = document.createElement(tag.name);
88 e._r = new RenderingScheduler(e, queue: queue);
89 e._vm = vm;
90 e._isolate = isolate;
91 e._events = events;
92 e._notifications = notifications;
93 e._cache = cache;
94 e._caches = caches;
95 e._retainedSizes = retainedSizes;
96 e._reachableSizes = reachableSizes;
97 e._references = references;
98 e._retainingPaths = retainingPaths;
99 e._instances = instances;
100 return e;
101 }
15 102
16 MegamorphicCacheViewElement.created() : super.created(); 103 MegamorphicCacheViewElement.created() : super.created();
17 104
18 Future refresh() { 105 @override
19 return megamorphicCache.reload(); 106 attached() {
107 super.attached();
108 _r.enable();
109 }
110
111 @override
112 detached() {
113 super.detached();
114 _r.disable(notify: true);
115 children = [];
116 }
117
118 void render() {
119 children = [
120 new NavBarElement(queue: _r.queue)
121 ..children = [
122 new NavTopMenuElement(queue: _r.queue),
123 new NavVMMenuElement(_vm, _events, queue: _r.queue),
124 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue),
125 new NavMenuElement('object', last: true, queue: _r.queue),
126 new NavRefreshElement(queue: _r.queue)
127 ..onRefresh.listen((e) async {
128 e.element.disabled = true;
129 _cache = await _caches.get(_isolate, _cache.id);
130 _r.dirty();
131 }),
132 new NavNotifyElement(_notifications, queue: _r.queue)
133 ],
134 new DivElement()..classes = const ['content-centered-big']
135 ..children = [
136 new HeadingElement.h2()..text = 'Megamorphic Cache',
137 new HRElement(),
138 new ObjectCommonElement(_isolate, _cache, _retainedSizes,
139 _reachableSizes, _references, _retainingPaths,
140 _instances, queue: _r.queue),
141 new BRElement(),
142 new DivElement()..classes = ['memberList']
143 ..children = [
144 new DivElement()..classes = ['memberItem']
145 ..children = [
146 new DivElement()..classes = ['memberName']
147 ..text = 'selector',
148 new DivElement()..classes = ['memberName']
149 ..text = '${_cache.selector}'
150 ],
151 new DivElement()..classes = ['memberItem']
152 ..children = [
153 new DivElement()..classes = ['memberName']
154 ..text = 'mask',
155 new DivElement()..classes = ['memberName']
156 ..text = '${_cache.mask}'
157 ],
158 new DivElement()..classes = ['memberItem']
159 ..children = [
160 new DivElement()..classes = ['memberName']
161 ..text = 'buckets',
162 new DivElement()..classes = ['memberName']
163 ..children = [
164 anyRef(_isolate, _cache.buckets, _instances,
165 queue: _r.queue)
166 ]
167 ],
168 new DivElement()..classes = ['memberItem']
169 ..children = [
170 new DivElement()..classes = ['memberName']
171 ..text = 'argumentsDescriptor',
172 new DivElement()..classes = ['memberName']
173 ..children = [
174 anyRef(_isolate, _cache.argumentsDescriptor, _instances,
175 queue: _r.queue)
176 ]
177 ]
178 ],
179 new HRElement(),
180 new ViewFooterElement(queue: _r.queue)
181 ]
182 ];
20 } 183 }
21 } 184 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/css/shared.css ('k') | runtime/observatory/lib/src/elements/megamorphiccache_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698