OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library_view_element; | 5 library library_view_element; |
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/class_ref.dart'; | 10 import 'package:observatory/src/elements/class_ref.dart'; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 M.EventRepository _events; | 58 M.EventRepository _events; |
59 M.NotificationRepository _notifications; | 59 M.NotificationRepository _notifications; |
60 M.Library _library; | 60 M.Library _library; |
61 M.LibraryRepository _libraries; | 61 M.LibraryRepository _libraries; |
62 M.FieldRepository _fields; | 62 M.FieldRepository _fields; |
63 M.RetainedSizeRepository _retainedSizes; | 63 M.RetainedSizeRepository _retainedSizes; |
64 M.ReachableSizeRepository _reachableSizes; | 64 M.ReachableSizeRepository _reachableSizes; |
65 M.InboundReferencesRepository _references; | 65 M.InboundReferencesRepository _references; |
66 M.RetainingPathRepository _retainingPaths; | 66 M.RetainingPathRepository _retainingPaths; |
67 M.ScriptRepository _scripts; | 67 M.ScriptRepository _scripts; |
68 M.InstanceRepository _instances; | 68 M.ObjectRepository _objects; |
69 M.EvalRepository _eval; | 69 M.EvalRepository _eval; |
70 Iterable<M.Field> _variables; | 70 Iterable<M.Field> _variables; |
71 | 71 |
72 M.VMRef get vm => _vm; | 72 M.VMRef get vm => _vm; |
73 M.IsolateRef get isolate => _isolate; | 73 M.IsolateRef get isolate => _isolate; |
74 M.NotificationRepository get notifications => _notifications; | 74 M.NotificationRepository get notifications => _notifications; |
75 M.Library get library => _library; | 75 M.Library get library => _library; |
76 | 76 |
77 factory LibraryViewElement( | 77 factory LibraryViewElement( |
78 M.VM vm, | 78 M.VM vm, |
79 M.IsolateRef isolate, | 79 M.IsolateRef isolate, |
80 M.Library library, | 80 M.Library library, |
81 M.EventRepository events, | 81 M.EventRepository events, |
82 M.NotificationRepository notifications, | 82 M.NotificationRepository notifications, |
83 M.LibraryRepository libraries, | 83 M.LibraryRepository libraries, |
84 M.FieldRepository fields, | 84 M.FieldRepository fields, |
85 M.RetainedSizeRepository retainedSizes, | 85 M.RetainedSizeRepository retainedSizes, |
86 M.ReachableSizeRepository reachableSizes, | 86 M.ReachableSizeRepository reachableSizes, |
87 M.InboundReferencesRepository references, | 87 M.InboundReferencesRepository references, |
88 M.RetainingPathRepository retainingPaths, | 88 M.RetainingPathRepository retainingPaths, |
89 M.ScriptRepository scripts, | 89 M.ScriptRepository scripts, |
90 M.InstanceRepository instances, | 90 M.ObjectRepository objects, |
91 M.EvalRepository eval, | 91 M.EvalRepository eval, |
92 {RenderingQueue queue}) { | 92 {RenderingQueue queue}) { |
93 assert(vm != null); | 93 assert(vm != null); |
94 assert(isolate != null); | 94 assert(isolate != null); |
95 assert(events != null); | 95 assert(events != null); |
96 assert(notifications != null); | 96 assert(notifications != null); |
97 assert(library != null); | 97 assert(library != null); |
98 assert(libraries != null); | 98 assert(libraries != null); |
99 assert(fields != null); | 99 assert(fields != null); |
100 assert(retainedSizes != null); | 100 assert(retainedSizes != null); |
101 assert(reachableSizes != null); | 101 assert(reachableSizes != null); |
102 assert(references != null); | 102 assert(references != null); |
103 assert(retainingPaths != null); | 103 assert(retainingPaths != null); |
104 assert(scripts != null); | 104 assert(scripts != null); |
105 assert(instances != null); | 105 assert(objects != null); |
106 assert(eval != null); | 106 assert(eval != null); |
107 LibraryViewElement e = document.createElement(tag.name); | 107 LibraryViewElement e = document.createElement(tag.name); |
108 e._r = new RenderingScheduler(e, queue: queue); | 108 e._r = new RenderingScheduler(e, queue: queue); |
109 e._vm = vm; | 109 e._vm = vm; |
110 e._isolate = isolate; | 110 e._isolate = isolate; |
111 e._events = events; | 111 e._events = events; |
112 e._notifications = notifications; | 112 e._notifications = notifications; |
113 e._library = library; | 113 e._library = library; |
114 e._libraries = libraries; | 114 e._libraries = libraries; |
115 e._fields = fields; | 115 e._fields = fields; |
116 e._retainedSizes = retainedSizes; | 116 e._retainedSizes = retainedSizes; |
117 e._reachableSizes = reachableSizes; | 117 e._reachableSizes = reachableSizes; |
118 e._references = references; | 118 e._references = references; |
119 e._retainingPaths = retainingPaths; | 119 e._retainingPaths = retainingPaths; |
120 e._scripts = scripts; | 120 e._scripts = scripts; |
121 e._instances = instances; | 121 e._objects = objects; |
122 e._eval = eval; | 122 e._eval = eval; |
123 return e; | 123 return e; |
124 } | 124 } |
125 | 125 |
126 LibraryViewElement.created() : super.created(); | 126 LibraryViewElement.created() : super.created(); |
127 | 127 |
128 @override | 128 @override |
129 attached() { | 129 attached() { |
130 super.attached(); | 130 super.attached(); |
131 _r.enable(); | 131 _r.enable(); |
(...skipping 20 matching lines...) Expand all Loading... |
152 _refresh(); | 152 _refresh(); |
153 }), | 153 }), |
154 new NavNotifyElement(_notifications, queue: _r.queue) | 154 new NavNotifyElement(_notifications, queue: _r.queue) |
155 ]), | 155 ]), |
156 new DivElement() | 156 new DivElement() |
157 ..classes = ['content-centered-big'] | 157 ..classes = ['content-centered-big'] |
158 ..children = [ | 158 ..children = [ |
159 new HeadingElement.h2()..text = 'Library', | 159 new HeadingElement.h2()..text = 'Library', |
160 new HRElement(), | 160 new HRElement(), |
161 new ObjectCommonElement(_isolate, _library, _retainedSizes, | 161 new ObjectCommonElement(_isolate, _library, _retainedSizes, |
162 _reachableSizes, _references, _retainingPaths, _instances, | 162 _reachableSizes, _references, _retainingPaths, _objects, |
163 queue: _r.queue), | 163 queue: _r.queue), |
164 new DivElement() | 164 new DivElement() |
165 ..classes = ['memberList'] | 165 ..classes = ['memberList'] |
166 ..children = [ | 166 ..children = [ |
167 new DivElement() | 167 new DivElement() |
168 ..classes = ['memberItem'] | 168 ..classes = ['memberItem'] |
169 ..children = [ | 169 ..children = [ |
170 new DivElement() | 170 new DivElement() |
171 ..classes = ['memberName'] | 171 ..classes = ['memberName'] |
172 ..text = 'uri', | 172 ..text = 'uri', |
173 new DivElement() | 173 new DivElement() |
174 ..classes = ['memberValue'] | 174 ..classes = ['memberValue'] |
175 ..text = _library.uri | 175 ..text = _library.uri |
176 ], | 176 ], |
177 new DivElement() | 177 new DivElement() |
178 ..classes = ['memberItem'] | 178 ..classes = ['memberItem'] |
179 ..children = [ | 179 ..children = [ |
180 new DivElement() | 180 new DivElement() |
181 ..classes = ['memberName'] | 181 ..classes = ['memberName'] |
182 ..text = 'vm name', | 182 ..text = 'vm name', |
183 new DivElement() | 183 new DivElement() |
184 ..classes = ['memberValue'] | 184 ..classes = ['memberValue'] |
185 ..text = _library.vmName | 185 ..text = _library.vmName |
186 ] | 186 ] |
187 ], | 187 ], |
188 new HRElement(), | 188 new HRElement(), |
189 new EvalBoxElement(_isolate, _library, _instances, _eval, | 189 new EvalBoxElement(_isolate, _library, _objects, _eval, |
190 queue: _r.queue), | 190 queue: _r.queue), |
191 new HRElement(), | 191 new HRElement(), |
192 _createDependencies(), | 192 _createDependencies(), |
193 new BRElement(), | 193 new BRElement(), |
194 _createScripts(), | 194 _createScripts(), |
195 new BRElement(), | 195 new BRElement(), |
196 _createClasses(), | 196 _createClasses(), |
197 new BRElement(), | 197 new BRElement(), |
198 _createVariables(), | 198 _createVariables(), |
199 new BRElement(), | 199 new BRElement(), |
200 _createFunctions(), | 200 _createFunctions(), |
201 new HRElement(), | 201 new HRElement(), |
202 new ScriptInsetElement( | 202 new ScriptInsetElement( |
203 _isolate, _library.rootScript, _scripts, _instances, _events, | 203 _isolate, _library.rootScript, _scripts, _objects, _events, |
204 queue: _r.queue), | 204 queue: _r.queue), |
205 new HRElement(), | 205 new HRElement(), |
206 new ViewFooterElement(queue: _r.queue) | 206 new ViewFooterElement(queue: _r.queue) |
207 ] | 207 ] |
208 ]; | 208 ]; |
209 } | 209 } |
210 | 210 |
211 Future _refresh() async { | 211 Future _refresh() async { |
212 _library = await _libraries.get(_isolate, _library.id); | 212 _library = await _libraries.get(_isolate, _library.id); |
213 _variables = null; | 213 _variables = null; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 ? (new SpanElement()..text = 'loading...') | 292 ? (new SpanElement()..text = 'loading...') |
293 : (new DivElement() | 293 : (new DivElement() |
294 ..classes = ['indent', 'memberList'] | 294 ..classes = ['indent', 'memberList'] |
295 ..children = _variables | 295 ..children = _variables |
296 .map((f) => new DivElement() | 296 .map((f) => new DivElement() |
297 ..classes = ['memberItem'] | 297 ..classes = ['memberItem'] |
298 ..children = [ | 298 ..children = [ |
299 new DivElement() | 299 new DivElement() |
300 ..classes = ['memberName'] | 300 ..classes = ['memberName'] |
301 ..children = [ | 301 ..children = [ |
302 new FieldRefElement(_isolate, f, _instances, | 302 new FieldRefElement(_isolate, f, _objects, |
303 queue: _r.queue) | 303 queue: _r.queue) |
304 ], | 304 ], |
305 new DivElement() | 305 new DivElement() |
306 ..classes = ['memberValue'] | 306 ..classes = ['memberValue'] |
307 ..children = [ | 307 ..children = [ |
308 new SpanElement()..text = ' = ', | 308 new SpanElement()..text = ' = ', |
309 anyRef(_isolate, f.staticValue, _instances, | 309 anyRef(_isolate, f.staticValue, _objects, |
310 queue: _r.queue) | 310 queue: _r.queue) |
311 ] | 311 ] |
312 ]) | 312 ]) |
313 .toList()) | 313 .toList()) |
314 ] | 314 ] |
315 ]; | 315 ]; |
316 } | 316 } |
317 | 317 |
318 Element _createFunctions() { | 318 Element _createFunctions() { |
319 if (_library.functions.isEmpty) { | 319 if (_library.functions.isEmpty) { |
320 return new SpanElement(); | 320 return new SpanElement(); |
321 } | 321 } |
322 final functions = _library.functions.toList(); | 322 final functions = _library.functions.toList(); |
323 return new DivElement() | 323 return new DivElement() |
324 ..children = [ | 324 ..children = [ |
325 new SpanElement()..text = 'functions (${functions.length}) ', | 325 new SpanElement()..text = 'functions (${functions.length}) ', |
326 new CurlyBlockElement(queue: _r.queue) | 326 new CurlyBlockElement(queue: _r.queue) |
327 ..content = functions | 327 ..content = functions |
328 .map((f) => new DivElement() | 328 .map((f) => new DivElement() |
329 ..classes = ['indent'] | 329 ..classes = ['indent'] |
330 ..children = [ | 330 ..children = [ |
331 new FunctionRefElement(_isolate, f, queue: _r.queue) | 331 new FunctionRefElement(_isolate, f, queue: _r.queue) |
332 ]) | 332 ]) |
333 .toList() | 333 .toList() |
334 ]; | 334 ]; |
335 } | 335 } |
336 } | 336 } |
OLD | NEW |