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

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

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