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 class_view_element; | 5 library class_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_allocation_profile.dart'; | 10 import 'package:observatory/src/elements/class_allocation_profile.dart'; |
(...skipping 15 matching lines...) Expand all Loading... |
26 import 'package:observatory/src/elements/nav/notify.dart'; | 26 import 'package:observatory/src/elements/nav/notify.dart'; |
27 import 'package:observatory/src/elements/nav/refresh.dart'; | 27 import 'package:observatory/src/elements/nav/refresh.dart'; |
28 import 'package:observatory/src/elements/nav/top_menu.dart'; | 28 import 'package:observatory/src/elements/nav/top_menu.dart'; |
29 import 'package:observatory/src/elements/nav/vm_menu.dart'; | 29 import 'package:observatory/src/elements/nav/vm_menu.dart'; |
30 import 'package:observatory/src/elements/object_common.dart'; | 30 import 'package:observatory/src/elements/object_common.dart'; |
31 import 'package:observatory/src/elements/source_inset.dart'; | 31 import 'package:observatory/src/elements/source_inset.dart'; |
32 import 'package:observatory/src/elements/source_link.dart'; | 32 import 'package:observatory/src/elements/source_link.dart'; |
33 import 'package:observatory/src/elements/view_footer.dart'; | 33 import 'package:observatory/src/elements/view_footer.dart'; |
34 | 34 |
35 class ClassViewElement extends HtmlElement implements Renderable { | 35 class ClassViewElement extends HtmlElement implements Renderable { |
36 static const tag = const Tag<ClassViewElement>('class-view', | 36 static const tag = |
37 dependencies: const [ | 37 const Tag<ClassViewElement>('class-view', dependencies: const [ |
38 ClassInstancesElement.tag, | 38 ClassInstancesElement.tag, |
39 ClassRefElement.tag, | 39 ClassRefElement.tag, |
40 CurlyBlockElement.tag, | 40 CurlyBlockElement.tag, |
41 ErrorRefElement.tag, | 41 ErrorRefElement.tag, |
42 EvalBoxElement.tag, | 42 EvalBoxElement.tag, |
43 FieldRefElement.tag, | 43 FieldRefElement.tag, |
44 FunctionRefElement.tag, | 44 FunctionRefElement.tag, |
45 InstanceRefElement.tag, | 45 InstanceRefElement.tag, |
46 LibraryRefElement.tag, | 46 LibraryRefElement.tag, |
47 NavClassMenuElement.tag, | 47 NavClassMenuElement.tag, |
48 NavTopMenuElement.tag, | 48 NavTopMenuElement.tag, |
49 NavVMMenuElement.tag, | 49 NavVMMenuElement.tag, |
50 NavIsolateMenuElement.tag, | 50 NavIsolateMenuElement.tag, |
51 NavRefreshElement.tag, | 51 NavRefreshElement.tag, |
52 NavNotifyElement.tag, | 52 NavNotifyElement.tag, |
53 ObjectCommonElement.tag, | 53 ObjectCommonElement.tag, |
54 SourceInsetElement.tag, | 54 SourceInsetElement.tag, |
55 SourceLinkElement.tag, | 55 SourceLinkElement.tag, |
56 ViewFooterElement.tag | 56 ViewFooterElement.tag |
57 ]); | 57 ]); |
58 | 58 |
59 RenderingScheduler<ClassViewElement> _r; | 59 RenderingScheduler<ClassViewElement> _r; |
60 | 60 |
61 Stream<RenderedEvent<ClassViewElement>> get onRendered => _r.onRendered; | 61 Stream<RenderedEvent<ClassViewElement>> get onRendered => _r.onRendered; |
62 | 62 |
63 M.VM _vm; | 63 M.VM _vm; |
64 M.IsolateRef _isolate; | 64 M.IsolateRef _isolate; |
65 M.EventRepository _events; | 65 M.EventRepository _events; |
66 M.NotificationRepository _notifications; | 66 M.NotificationRepository _notifications; |
67 M.Class _cls; | 67 M.Class _cls; |
68 M.ClassRepository _classes; | 68 M.ClassRepository _classes; |
69 M.RetainedSizeRepository _retainedSizes; | 69 M.RetainedSizeRepository _retainedSizes; |
70 M.ReachableSizeRepository _reachableSizes; | 70 M.ReachableSizeRepository _reachableSizes; |
71 M.InboundReferencesRepository _references; | 71 M.InboundReferencesRepository _references; |
72 M.RetainingPathRepository _retainingPaths; | 72 M.RetainingPathRepository _retainingPaths; |
73 M.StronglyReachableInstancesRepository _stronglyReachableInstances; | 73 M.StronglyReachableInstancesRepository _stronglyReachableInstances; |
74 M.TopRetainingInstancesRepository _topRetainedInstances; | 74 M.TopRetainingInstancesRepository _topRetainedInstances; |
75 M.FieldRepository _fields; | 75 M.FieldRepository _fields; |
76 M.ScriptRepository _scripts; | 76 M.ScriptRepository _scripts; |
77 M.InstanceRepository _instances; | 77 M.InstanceRepository _instances; |
78 M.EvalRepository _eval; | 78 M.EvalRepository _eval; |
79 M.ClassSampleProfileRepository _profiles; | 79 M.ClassSampleProfileRepository _profiles; |
80 Iterable<M.Field> _classFields; | 80 Iterable<M.Field> _classFields; |
81 | 81 |
82 | |
83 M.VMRef get vm => _vm; | 82 M.VMRef get vm => _vm; |
84 M.IsolateRef get isolate => _isolate; | 83 M.IsolateRef get isolate => _isolate; |
85 M.NotificationRepository get notifications => _notifications; | 84 M.NotificationRepository get notifications => _notifications; |
86 M.Class get cls => _cls; | 85 M.Class get cls => _cls; |
87 | 86 |
88 factory ClassViewElement(M.VM vm, M.IsolateRef isolate, M.Class cls, | 87 factory ClassViewElement( |
89 M.EventRepository events, | 88 M.VM vm, |
90 M.NotificationRepository notifications, | 89 M.IsolateRef isolate, |
91 M.ClassRepository classes, | 90 M.Class cls, |
92 M.RetainedSizeRepository retainedSizes, | 91 M.EventRepository events, |
93 M.ReachableSizeRepository reachableSizes, | 92 M.NotificationRepository notifications, |
94 M.InboundReferencesRepository references, | 93 M.ClassRepository classes, |
95 M.RetainingPathRepository retainingPaths, | 94 M.RetainedSizeRepository retainedSizes, |
96 M.FieldRepository fields, | 95 M.ReachableSizeRepository reachableSizes, |
97 M.ScriptRepository scripts, | 96 M.InboundReferencesRepository references, |
98 M.InstanceRepository instances, | 97 M.RetainingPathRepository retainingPaths, |
99 M.EvalRepository eval, | 98 M.FieldRepository fields, |
100 M.StronglyReachableInstancesRepository stronglyReachable, | 99 M.ScriptRepository scripts, |
101 M.TopRetainingInstancesRepository topRetained, | 100 M.InstanceRepository instances, |
102 M.ClassSampleProfileRepository profiles, | 101 M.EvalRepository eval, |
103 {RenderingQueue queue}) { | 102 M.StronglyReachableInstancesRepository stronglyReachable, |
| 103 M.TopRetainingInstancesRepository topRetained, |
| 104 M.ClassSampleProfileRepository profiles, |
| 105 {RenderingQueue queue}) { |
104 assert(vm != null); | 106 assert(vm != null); |
105 assert(isolate != null); | 107 assert(isolate != null); |
106 assert(events != null); | 108 assert(events != null); |
107 assert(notifications != null); | 109 assert(notifications != null); |
108 assert(cls != null); | 110 assert(cls != null); |
109 assert(classes != null); | 111 assert(classes != null); |
110 assert(retainedSizes != null); | 112 assert(retainedSizes != null); |
111 assert(reachableSizes != null); | 113 assert(reachableSizes != null); |
112 assert(references != null); | 114 assert(references != null); |
113 assert(retainingPaths != null); | 115 assert(retainingPaths != null); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 super.detached(); | 156 super.detached(); |
155 _r.disable(notify: true); | 157 _r.disable(notify: true); |
156 children = []; | 158 children = []; |
157 } | 159 } |
158 | 160 |
159 ObjectCommonElement _common; | 161 ObjectCommonElement _common; |
160 ClassInstancesElement _classInstances; | 162 ClassInstancesElement _classInstances; |
161 bool _loadProfile = false; | 163 bool _loadProfile = false; |
162 | 164 |
163 void render() { | 165 void render() { |
164 _common = _common ?? new ObjectCommonElement(_isolate, _cls, _retainedSizes, | 166 _common = _common ?? |
165 _reachableSizes, _references, _retainingPaths, _instances, | 167 new ObjectCommonElement(_isolate, _cls, _retainedSizes, _reachableSizes, |
166 queue: _r.queue); | 168 _references, _retainingPaths, _instances, |
167 _classInstances = _classInstances ?? new ClassInstancesElement(_isolate, | 169 queue: _r.queue); |
168 _cls, _retainedSizes, _reachableSizes, _stronglyReachableInstances, | 170 _classInstances = _classInstances ?? |
169 _topRetainedInstances, _instances, queue: _r.queue); | 171 new ClassInstancesElement( |
| 172 _isolate, |
| 173 _cls, |
| 174 _retainedSizes, |
| 175 _reachableSizes, |
| 176 _stronglyReachableInstances, |
| 177 _topRetainedInstances, |
| 178 _instances, |
| 179 queue: _r.queue); |
170 var header = ''; | 180 var header = ''; |
171 if (_cls.isAbstract) { | 181 if (_cls.isAbstract) { |
172 header += 'abstract '; | 182 header += 'abstract '; |
173 } | 183 } |
174 if (_cls.isPatch) { | 184 if (_cls.isPatch) { |
175 header += 'patch '; | 185 header += 'patch '; |
176 } | 186 } |
177 children = [ | 187 children = [ |
178 navBar([ | 188 navBar([ |
179 new NavTopMenuElement(queue: _r.queue), | 189 new NavTopMenuElement(queue: _r.queue), |
180 new NavVMMenuElement(_vm, _events, queue: _r.queue), | 190 new NavVMMenuElement(_vm, _events, queue: _r.queue), |
181 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), | 191 new NavIsolateMenuElement(_isolate, _events, queue: _r.queue), |
182 new NavClassMenuElement(_isolate, _cls, queue: _r.queue), | 192 new NavClassMenuElement(_isolate, _cls, queue: _r.queue), |
183 new NavRefreshElement(label: 'Refresh Allocation Profile', | 193 new NavRefreshElement( |
184 queue: _r.queue) | 194 label: 'Refresh Allocation Profile', queue: _r.queue) |
185 ..onRefresh.listen((e) { | 195 ..onRefresh.listen((e) { |
186 e.element.disabled = true; | 196 e.element.disabled = true; |
187 _loadProfile = true; | 197 _loadProfile = true; |
188 _r.dirty(); | 198 _r.dirty(); |
189 }), | 199 }), |
190 new NavRefreshElement(queue: _r.queue) | 200 new NavRefreshElement(queue: _r.queue) |
191 ..onRefresh.listen((e) { | 201 ..onRefresh.listen((e) { |
192 e.element.disabled = true; | 202 e.element.disabled = true; |
193 _common = null; | 203 _common = null; |
194 _classInstances = null; | 204 _classInstances = null; |
195 _fieldsExpanded = null; | 205 _fieldsExpanded = null; |
196 _functionsExpanded = null; | 206 _functionsExpanded = null; |
197 _refresh(); | 207 _refresh(); |
198 }), | 208 }), |
199 new NavNotifyElement(_notifications, queue: _r.queue) | 209 new NavNotifyElement(_notifications, queue: _r.queue) |
200 ]), | 210 ]), |
201 new DivElement()..classes = ['content-centered-big'] | 211 new DivElement() |
| 212 ..classes = ['content-centered-big'] |
202 ..children = [ | 213 ..children = [ |
203 new HeadingElement.h2()..text = '$header class ${_cls.name}', | 214 new HeadingElement.h2()..text = '$header class ${_cls.name}', |
204 new HRElement(), | 215 new HRElement(), |
205 _common, | 216 _common, |
206 new BRElement(), | 217 new BRElement(), |
207 new DivElement()..classes = ['memberList'] | 218 new DivElement() |
| 219 ..classes = ['memberList'] |
208 ..children = _createMembers(), | 220 ..children = _createMembers(), |
209 new DivElement() | 221 new DivElement() |
210 ..children = _cls.error == null | 222 ..children = _cls.error == null |
211 ? const [] | 223 ? const [] |
212 : [ | 224 : [ |
213 new HRElement(), | 225 new HRElement(), |
214 new ErrorRefElement(_cls.error, queue: _r.queue) | 226 new ErrorRefElement(_cls.error, queue: _r.queue) |
215 ], | 227 ], |
216 new HRElement(), | 228 new HRElement(), |
217 new EvalBoxElement(_isolate, _cls, _instances, _eval, | 229 new EvalBoxElement(_isolate, _cls, _instances, _eval, |
218 queue: _r.queue), | 230 queue: _r.queue), |
219 new HRElement(), | 231 new HRElement(), |
220 new HeadingElement.h2()..text = 'Fields & Functions', | 232 new HeadingElement.h2()..text = 'Fields & Functions', |
221 new DivElement()..classes = ['memberList'] | 233 new DivElement() |
| 234 ..classes = ['memberList'] |
222 ..children = _createElements(), | 235 ..children = _createElements(), |
223 new HRElement(), | 236 new HRElement(), |
224 new HeadingElement.h2()..text = 'Instances', | 237 new HeadingElement.h2()..text = 'Instances', |
225 new DivElement() | 238 new DivElement() |
226 ..children = _cls.hasAllocations | 239 ..children = _cls.hasAllocations ? [_classInstances] : const [], |
227 ? [_classInstances] | |
228 : const [], | |
229 new HRElement(), | 240 new HRElement(), |
230 new HeadingElement.h2()..text = 'Allocations', | 241 new HeadingElement.h2()..text = 'Allocations', |
231 new DivElement()..classes = ['memberList'] | 242 new DivElement() |
| 243 ..classes = ['memberList'] |
232 ..children = [ | 244 ..children = [ |
233 new DivElement()..classes = ['memberName'] | 245 new DivElement() |
| 246 ..classes = ['memberName'] |
234 ..text = 'Tracing allocations? ', | 247 ..text = 'Tracing allocations? ', |
235 new DivElement()..classes = ['memberValue'] | 248 new DivElement() |
| 249 ..classes = ['memberValue'] |
236 ..children = _cls.traceAllocations | 250 ..children = _cls.traceAllocations |
237 ? [ | 251 ? [ |
238 new SpanElement()..text = 'Yes ', | 252 new SpanElement()..text = 'Yes ', |
239 new ButtonElement()..text = 'disable' | 253 new ButtonElement() |
240 ..onClick.listen((e) async { | 254 ..text = 'disable' |
241 e.target.disabled = true; | 255 ..onClick.listen((e) async { |
242 await _profiles.disable(_isolate, _cls); | 256 e.target.disabled = true; |
243 _loadProfile = true; | 257 await _profiles.disable(_isolate, _cls); |
244 _refresh(); | 258 _loadProfile = true; |
245 }) | 259 _refresh(); |
246 ] | 260 }) |
247 : [ | 261 ] |
248 new SpanElement()..text = 'No ', | 262 : [ |
249 new ButtonElement()..text = 'enable' | 263 new SpanElement()..text = 'No ', |
250 ..onClick.listen((e) async { | 264 new ButtonElement() |
251 e.target.disabled = true; | 265 ..text = 'enable' |
252 await _profiles.enable(_isolate, _cls); | 266 ..onClick.listen((e) async { |
253 _refresh(); | 267 e.target.disabled = true; |
254 }) | 268 await _profiles.enable(_isolate, _cls); |
255 ] | 269 _refresh(); |
| 270 }) |
| 271 ] |
256 ], | 272 ], |
257 new DivElement() | 273 new DivElement() |
258 ..children = _loadProfile | 274 ..children = _loadProfile |
259 ? [new ClassAllocationProfileElement(_isolate, _cls, _profiles, | 275 ? [ |
260 queue: _r.queue)] | 276 new ClassAllocationProfileElement(_isolate, _cls, _profiles, |
261 : const [], | 277 queue: _r.queue) |
| 278 ] |
| 279 : const [], |
262 new DivElement() | 280 new DivElement() |
263 ..children = _cls.location != null | 281 ..children = _cls.location != null |
264 ? [new HRElement(), | 282 ? [ |
265 new SourceInsetElement(_isolate, _cls.location, _scripts, | 283 new HRElement(), |
266 _instances, _events, queue: _r.queue)] | 284 new SourceInsetElement( |
267 : const [], | 285 _isolate, _cls.location, _scripts, _instances, _events, |
| 286 queue: _r.queue) |
| 287 ] |
| 288 : const [], |
268 new HRElement(), | 289 new HRElement(), |
269 new ViewFooterElement(queue: _r.queue) | 290 new ViewFooterElement(queue: _r.queue) |
270 ] | 291 ] |
271 ]; | 292 ]; |
272 } | 293 } |
273 | 294 |
274 bool _fieldsExpanded; | 295 bool _fieldsExpanded; |
275 bool _functionsExpanded; | 296 bool _functionsExpanded; |
276 | 297 |
277 List<Element> _createMembers() { | 298 List<Element> _createMembers() { |
278 final members = <Element>[]; | 299 final members = <Element>[]; |
279 if (_cls.library != null) { | 300 if (_cls.library != null) { |
280 members.add( | 301 members.add(new DivElement() |
281 new DivElement()..classes = ['memberItem'] | 302 ..classes = ['memberItem'] |
282 ..children = [ | 303 ..children = [ |
283 new DivElement()..classes = ['memberName'] | 304 new DivElement() |
284 ..text = 'library', | 305 ..classes = ['memberName'] |
285 new DivElement()..classes = ['memberValue'] | 306 ..text = 'library', |
286 ..children = [ | 307 new DivElement() |
287 new LibraryRefElement(_isolate, _cls.library, queue: _r.queue) | 308 ..classes = ['memberValue'] |
288 ] | 309 ..children = [ |
289 ] | 310 new LibraryRefElement(_isolate, _cls.library, queue: _r.queue) |
290 ); | 311 ] |
| 312 ]); |
291 } | 313 } |
292 if (_cls.location != null) { | 314 if (_cls.location != null) { |
293 members.add( | 315 members.add(new DivElement() |
294 new DivElement()..classes = ['memberItem'] | 316 ..classes = ['memberItem'] |
295 ..children = [ | 317 ..children = [ |
296 new DivElement()..classes = ['memberName'] | 318 new DivElement() |
297 ..text = 'script', | 319 ..classes = ['memberName'] |
298 new DivElement()..classes = ['memberValue'] | 320 ..text = 'script', |
299 ..children = [ | 321 new DivElement() |
300 new SourceLinkElement(_isolate, _cls.location, _scripts, | 322 ..classes = ['memberValue'] |
301 queue: _r.queue) | 323 ..children = [ |
302 ] | 324 new SourceLinkElement(_isolate, _cls.location, _scripts, |
303 ] | 325 queue: _r.queue) |
304 ); | 326 ] |
| 327 ]); |
305 } | 328 } |
306 if (_cls.superclass != null) { | 329 if (_cls.superclass != null) { |
307 members.add( | 330 members.add(new DivElement() |
308 new DivElement()..classes = ['memberItem'] | 331 ..classes = ['memberItem'] |
309 ..children = [ | 332 ..children = [ |
310 new DivElement()..classes = ['memberName'] | 333 new DivElement() |
311 ..text = 'superclass', | 334 ..classes = ['memberName'] |
312 new DivElement()..classes = ['memberValue'] | 335 ..text = 'superclass', |
313 ..children = [ | 336 new DivElement() |
314 new ClassRefElement(_isolate, _cls.superclass, queue: _r.queue) | 337 ..classes = ['memberValue'] |
315 ] | 338 ..children = [ |
316 ] | 339 new ClassRefElement(_isolate, _cls.superclass, queue: _r.queue) |
317 ); | 340 ] |
| 341 ]); |
318 } | 342 } |
319 if (_cls.superType != null) { | 343 if (_cls.superType != null) { |
320 members.add( | 344 members.add(new DivElement() |
321 new DivElement()..classes = ['memberItem'] | 345 ..classes = ['memberItem'] |
322 ..children = [ | 346 ..children = [ |
323 new DivElement()..classes = ['memberName'] | 347 new DivElement() |
324 ..text = 'supertype', | 348 ..classes = ['memberName'] |
325 new DivElement()..classes = ['memberValue'] | 349 ..text = 'supertype', |
326 ..children = [ | 350 new DivElement() |
327 new InstanceRefElement(_isolate, _cls.superType, _instances, | 351 ..classes = ['memberValue'] |
328 queue: _r.queue) | 352 ..children = [ |
329 ] | 353 new InstanceRefElement(_isolate, _cls.superType, _instances, |
330 ] | 354 queue: _r.queue) |
331 ); | 355 ] |
| 356 ]); |
332 } | 357 } |
333 if (cls.mixin != null) { | 358 if (cls.mixin != null) { |
334 members.add( | 359 members.add(new DivElement() |
335 new DivElement()..classes = ['memberItem'] | 360 ..classes = ['memberItem'] |
336 ..children = [ | 361 ..children = [ |
337 new DivElement()..classes = ['memberName'] | 362 new DivElement() |
338 ..text = 'mixin', | 363 ..classes = ['memberName'] |
339 new DivElement()..classes = ['memberValue'] | 364 ..text = 'mixin', |
340 ..children = [ | 365 new DivElement() |
341 new InstanceRefElement(_isolate, _cls.mixin, _instances, | 366 ..classes = ['memberValue'] |
342 queue: _r.queue) | 367 ..children = [ |
343 ] | 368 new InstanceRefElement(_isolate, _cls.mixin, _instances, |
344 ] | 369 queue: _r.queue) |
345 ); | 370 ] |
| 371 ]); |
346 } | 372 } |
347 if (_cls.subclasses.length > 0) { | 373 if (_cls.subclasses.length > 0) { |
348 members.add( | 374 members.add(new DivElement() |
349 new DivElement()..classes = ['memberItem'] | 375 ..classes = ['memberItem'] |
350 ..children = [ | 376 ..children = [ |
351 new DivElement()..classes = ['memberName'] | 377 new DivElement() |
352 ..text = 'extended by', | 378 ..classes = ['memberName'] |
353 new DivElement()..classes = ['memberValue'] | 379 ..text = 'extended by', |
354 ..children = (_cls.subclasses.expand((subcls) => [ | 380 new DivElement() |
355 new ClassRefElement(_isolate, subcls, queue: _r.queue), | 381 ..classes = ['memberValue'] |
356 new SpanElement()..text = ', ' | 382 ..children = (_cls.subclasses |
357 ]).toList()..removeLast()) | 383 .expand((subcls) => [ |
358 ] | 384 new ClassRefElement(_isolate, subcls, queue: _r.queue), |
359 ); | 385 new SpanElement()..text = ', ' |
| 386 ]) |
| 387 .toList()..removeLast()) |
| 388 ]); |
360 } | 389 } |
361 | 390 |
362 members.add(new BRElement()); | 391 members.add(new BRElement()); |
363 | 392 |
364 if (_cls.interfaces.length > 0) { | 393 if (_cls.interfaces.length > 0) { |
365 members.add( | 394 members.add(new DivElement() |
366 new DivElement()..classes = ['memberItem'] | 395 ..classes = ['memberItem'] |
367 ..children = [ | 396 ..children = [ |
368 new DivElement()..classes = ['memberName'] | 397 new DivElement() |
369 ..text = 'implements', | 398 ..classes = ['memberName'] |
370 new DivElement()..classes = ['memberValue'] | 399 ..text = 'implements', |
371 ..children = (_cls.interfaces.expand((interf) => [ | 400 new DivElement() |
372 new InstanceRefElement(_isolate, interf, _instances, | 401 ..classes = ['memberValue'] |
373 queue: _r.queue), | 402 ..children = (_cls.interfaces |
374 new SpanElement()..text = ', ' | 403 .expand((interf) => [ |
375 ]).toList()..removeLast()) | 404 new InstanceRefElement(_isolate, interf, _instances, |
376 ] | 405 queue: _r.queue), |
377 ); | 406 new SpanElement()..text = ', ' |
| 407 ]) |
| 408 .toList()..removeLast()) |
| 409 ]); |
378 } | 410 } |
379 if (_cls.name != _cls.vmName) { | 411 if (_cls.name != _cls.vmName) { |
380 members.add( | 412 members.add(new DivElement() |
381 new DivElement()..classes = ['memberItem'] | 413 ..classes = ['memberItem'] |
382 ..children = [ | 414 ..children = [ |
383 new DivElement()..classes = ['memberName'] | 415 new DivElement() |
384 ..text = 'vm name', | 416 ..classes = ['memberName'] |
385 new DivElement()..classes = ['memberValue'] | 417 ..text = 'vm name', |
386 ..text = '${_cls.vmName}' | 418 new DivElement() |
387 ] | 419 ..classes = ['memberValue'] |
388 ); | 420 ..text = '${_cls.vmName}' |
| 421 ]); |
389 } | 422 } |
390 return members; | 423 return members; |
391 } | 424 } |
392 | 425 |
393 List<Element> _createElements() { | 426 List<Element> _createElements() { |
394 final members = <Element>[]; | 427 final members = <Element>[]; |
395 if (_classFields != null && _classFields.isNotEmpty) { | 428 if (_classFields != null && _classFields.isNotEmpty) { |
396 final fields = _classFields.toList(); | 429 final fields = _classFields.toList(); |
397 _fieldsExpanded = _fieldsExpanded ?? (fields.length <= 8); | 430 _fieldsExpanded = _fieldsExpanded ?? (fields.length <= 8); |
398 members.add( | 431 members.add(new DivElement() |
399 new DivElement()..classes = ['memberItem'] | 432 ..classes = ['memberItem'] |
400 ..children = [ | 433 ..children = [ |
401 new DivElement()..classes = ['memberName'] | 434 new DivElement() |
402 ..text = 'fields ${fields.length}', | 435 ..classes = ['memberName'] |
403 new DivElement()..classes = ['memberValue'] | 436 ..text = 'fields ${fields.length}', |
404 ..children =[ | 437 new DivElement() |
405 new CurlyBlockElement(expanded: _fieldsExpanded) | 438 ..classes = ['memberValue'] |
406 ..onToggle.listen((e) => _fieldsExpanded = e.control.expanded) | 439 ..children = [ |
407 ..content = [ | 440 new CurlyBlockElement(expanded: _fieldsExpanded) |
408 new DivElement()..classes = ['memberList'] | 441 ..onToggle.listen((e) => _fieldsExpanded = e.control.expanded) |
409 ..children = (fields.map((f) => | 442 ..content = [ |
410 new DivElement()..classes = ['memberItem'] | 443 new DivElement() |
| 444 ..classes = ['memberList'] |
| 445 ..children = (fields |
| 446 .map((f) => new DivElement() |
| 447 ..classes = ['memberItem'] |
411 ..children = [ | 448 ..children = [ |
412 new DivElement()..classes = ['memberName'] | 449 new DivElement() |
413 ..children =[ | 450 ..classes = ['memberName'] |
| 451 ..children = [ |
414 new FieldRefElement(_isolate, f, _instances, | 452 new FieldRefElement(_isolate, f, _instances, |
415 queue: _r.queue) | 453 queue: _r.queue) |
416 ], | 454 ], |
417 new DivElement()..classes = ['memberValue'] | 455 new DivElement() |
| 456 ..classes = ['memberValue'] |
418 ..children = f.staticValue == null | 457 ..children = f.staticValue == null |
419 ? const [] | 458 ? const [] |
420 : [ | 459 : [ |
421 anyRef(_isolate, f.staticValue, _instances, | 460 anyRef( |
422 queue: _r.queue) | 461 _isolate, f.staticValue, _instances, |
423 ] | 462 queue: _r.queue) |
424 ] | 463 ] |
425 ).toList()) | 464 ]) |
426 ] | 465 .toList()) |
427 ] | 466 ] |
428 ] | 467 ] |
429 ); | 468 ]); |
430 } | 469 } |
431 | 470 |
432 if (_cls.functions.isNotEmpty) { | 471 if (_cls.functions.isNotEmpty) { |
433 final functions = _cls.functions.toList(); | 472 final functions = _cls.functions.toList(); |
434 _functionsExpanded = _functionsExpanded ?? (functions.length <= 8); | 473 _functionsExpanded = _functionsExpanded ?? (functions.length <= 8); |
435 members.add( | 474 members.add(new DivElement() |
436 new DivElement()..classes = ['memberItem'] | 475 ..classes = ['memberItem'] |
437 ..children = [ | 476 ..children = [ |
438 new DivElement()..classes = ['memberName'] | 477 new DivElement() |
439 ..text = 'functions (${functions.length})', | 478 ..classes = ['memberName'] |
440 new DivElement()..classes = ['memberValue'] | 479 ..text = 'functions (${functions.length})', |
441 ..children =[ | 480 new DivElement() |
442 new CurlyBlockElement(expanded: _functionsExpanded) | 481 ..classes = ['memberValue'] |
443 ..onToggle.listen((e) => | 482 ..children = [ |
444 _functionsExpanded = e.control.expanded) | 483 new CurlyBlockElement(expanded: _functionsExpanded) |
445 ..content = (functions.map((f) => | 484 ..onToggle |
446 new DivElement()..classes = ['indent'] | 485 .listen((e) => _functionsExpanded = e.control.expanded) |
| 486 ..content = (functions |
| 487 .map((f) => new DivElement() |
| 488 ..classes = ['indent'] |
447 ..children = [ | 489 ..children = [ |
448 new FunctionRefElement(_isolate, f, queue: _r.queue) | 490 new FunctionRefElement(_isolate, f, queue: _r.queue) |
449 ] | 491 ]) |
450 ).toList()) | 492 .toList()) |
451 ] | 493 ] |
452 ] | 494 ]); |
453 ); | |
454 } | 495 } |
455 return members; | 496 return members; |
456 } | 497 } |
457 | 498 |
458 Future _refresh() async { | 499 Future _refresh() async { |
459 _cls = await _classes.get(_isolate, _cls.id); | 500 _cls = await _classes.get(_isolate, _cls.id); |
460 await _loadAdditionalData(); | 501 await _loadAdditionalData(); |
461 _r.dirty(); | 502 _r.dirty(); |
462 } | 503 } |
463 | 504 |
464 Future _loadAdditionalData() async { | 505 Future _loadAdditionalData() async { |
465 _classFields = await Future.wait(_cls.fields.map((f) | 506 _classFields = |
466 => _fields.get(_isolate, f.id))); | 507 await Future.wait(_cls.fields.map((f) => _fields.get(_isolate, f.id))); |
467 _r.dirty(); | 508 _r.dirty(); |
468 } | 509 } |
469 } | 510 } |
OLD | NEW |