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 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 5 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
6 // for details. All rights reserved. Use of this source code is governed by a | 6 // for details. All rights reserved. Use of this source code is governed by a |
7 // BSD-style license that can be found in the LICENSE file. | 7 // BSD-style license that can be found in the LICENSE file. |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'dart:html'; | 10 import 'dart:html'; |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 RenderingScheduler<HeapSnapshotElement> _r; | 42 RenderingScheduler<HeapSnapshotElement> _r; |
43 | 43 |
44 Stream<RenderedEvent<HeapSnapshotElement>> get onRendered => _r.onRendered; | 44 Stream<RenderedEvent<HeapSnapshotElement>> get onRendered => _r.onRendered; |
45 | 45 |
46 M.VM _vm; | 46 M.VM _vm; |
47 M.IsolateRef _isolate; | 47 M.IsolateRef _isolate; |
48 M.EventRepository _events; | 48 M.EventRepository _events; |
49 M.NotificationRepository _notifications; | 49 M.NotificationRepository _notifications; |
50 M.HeapSnapshotRepository _snapshots; | 50 M.HeapSnapshotRepository _snapshots; |
51 M.InstanceRepository _instances; | 51 M.ObjectRepository _objects; |
52 M.HeapSnapshot _snapshot; | 52 M.HeapSnapshot _snapshot; |
53 Stream<M.HeapSnapshotLoadingProgressEvent> _progressStream; | 53 Stream<M.HeapSnapshotLoadingProgressEvent> _progressStream; |
54 M.HeapSnapshotLoadingProgress _progress; | 54 M.HeapSnapshotLoadingProgress _progress; |
55 M.HeapSnapshotRoots _roots = M.HeapSnapshotRoots.user; | 55 M.HeapSnapshotRoots _roots = M.HeapSnapshotRoots.user; |
56 HeapSnapshotTreeMode _mode = HeapSnapshotTreeMode.dominatorTree; | 56 HeapSnapshotTreeMode _mode = HeapSnapshotTreeMode.dominatorTree; |
57 | 57 |
58 M.IsolateRef get isolate => _isolate; | 58 M.IsolateRef get isolate => _isolate; |
59 M.NotificationRepository get notifications => _notifications; | 59 M.NotificationRepository get notifications => _notifications; |
60 M.HeapSnapshotRepository get profiles => _snapshots; | 60 M.HeapSnapshotRepository get profiles => _snapshots; |
61 M.VMRef get vm => _vm; | 61 M.VMRef get vm => _vm; |
62 | 62 |
63 factory HeapSnapshotElement( | 63 factory HeapSnapshotElement( |
64 M.VM vm, | 64 M.VM vm, |
65 M.IsolateRef isolate, | 65 M.IsolateRef isolate, |
66 M.EventRepository events, | 66 M.EventRepository events, |
67 M.NotificationRepository notifications, | 67 M.NotificationRepository notifications, |
68 M.HeapSnapshotRepository snapshots, | 68 M.HeapSnapshotRepository snapshots, |
69 M.InstanceRepository instances, | 69 M.ObjectRepository objects, |
70 {RenderingQueue queue}) { | 70 {RenderingQueue queue}) { |
71 assert(vm != null); | 71 assert(vm != null); |
72 assert(isolate != null); | 72 assert(isolate != null); |
73 assert(events != null); | 73 assert(events != null); |
74 assert(notifications != null); | 74 assert(notifications != null); |
75 assert(snapshots != null); | 75 assert(snapshots != null); |
76 assert(instances != null); | 76 assert(objects != null); |
77 HeapSnapshotElement e = document.createElement(tag.name); | 77 HeapSnapshotElement e = document.createElement(tag.name); |
78 e._r = new RenderingScheduler(e, queue: queue); | 78 e._r = new RenderingScheduler(e, queue: queue); |
79 e._vm = vm; | 79 e._vm = vm; |
80 e._isolate = isolate; | 80 e._isolate = isolate; |
81 e._events = events; | 81 e._events = events; |
82 e._notifications = notifications; | 82 e._notifications = notifications; |
83 e._snapshots = snapshots; | 83 e._snapshots = snapshots; |
84 e._instances = instances; | 84 e._objects = objects; |
85 return e; | 85 return e; |
86 } | 86 } |
87 | 87 |
88 HeapSnapshotElement.created() : super.created(); | 88 HeapSnapshotElement.created() : super.created(); |
89 | 89 |
90 @override | 90 @override |
91 attached() { | 91 attached() { |
92 super.attached(); | 92 super.attached(); |
93 _r.enable(); | 93 _r.enable(); |
94 _refresh(); | 94 _refresh(); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 if (node.isStack) { | 411 if (node.isStack) { |
412 wrapper | 412 wrapper |
413 ..text = '' | 413 ..text = '' |
414 ..children = [ | 414 ..children = [ |
415 new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames' | 415 new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames' |
416 ]; | 416 ]; |
417 } else { | 417 } else { |
418 node.object.then((object) { | 418 node.object.then((object) { |
419 wrapper | 419 wrapper |
420 ..text = '' | 420 ..text = '' |
421 ..children = [anyRef(_isolate, object, _instances, queue: _r.queue)]; | 421 ..children = [anyRef(_isolate, object, _objects, queue: _r.queue)]; |
422 }); | 422 }); |
423 } | 423 } |
424 } | 424 } |
425 | 425 |
426 void _updateMergedDominator( | 426 void _updateMergedDominator( |
427 HtmlElement element, M.HeapSnapshotMergedDominatorNode node, int depth) { | 427 HtmlElement element, M.HeapSnapshotMergedDominatorNode node, int depth) { |
428 element.children[0].text = Utils.formatSize(node.retainedSize); | 428 element.children[0].text = Utils.formatSize(node.retainedSize); |
429 _updateLines(element.children[1].children, depth); | 429 _updateLines(element.children[1].children, depth); |
430 if (_getChildrenMergedDominator(node).isNotEmpty) { | 430 if (_getChildrenMergedDominator(node).isNotEmpty) { |
431 element.children[2].text = _tree.isExpanded(node) ? '▼' : '►'; | 431 element.children[2].text = _tree.isExpanded(node) ? '▼' : '►'; |
(...skipping 11 matching lines...) Expand all Loading... |
443 ..text = '' | 443 ..text = '' |
444 ..children = [ | 444 ..children = [ |
445 new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames' | 445 new AnchorElement(href: Uris.debugger(isolate))..text = 'stack frames' |
446 ]; | 446 ]; |
447 } else { | 447 } else { |
448 node.klass.then((klass) { | 448 node.klass.then((klass) { |
449 wrapper | 449 wrapper |
450 ..text = '' | 450 ..text = '' |
451 ..children = [ | 451 ..children = [ |
452 new SpanElement()..text = '${node.instanceCount} instances of ', | 452 new SpanElement()..text = '${node.instanceCount} instances of ', |
453 anyRef(_isolate, klass, _instances, queue: _r.queue) | 453 anyRef(_isolate, klass, _objects, queue: _r.queue) |
454 ]; | 454 ]; |
455 }); | 455 }); |
456 } | 456 } |
457 } | 457 } |
458 | 458 |
459 void _updateGroup(HtmlElement element, item, int depth) { | 459 void _updateGroup(HtmlElement element, item, int depth) { |
460 _updateLines(element.children[1].children, depth); | 460 _updateLines(element.children[1].children, depth); |
461 if (item is M.HeapSnapshotClassReferences) { | 461 if (item is M.HeapSnapshotClassReferences) { |
462 element.children[0].text = Utils.formatSize(item.shallowSize); | 462 element.children[0].text = Utils.formatSize(item.shallowSize); |
463 element.children[2].text = _tree.isExpanded(item) ? '▼' : '►'; | 463 element.children[2].text = _tree.isExpanded(item) ? '▼' : '►'; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 value: modeToString(mode), selected: _mode == mode) | 567 value: modeToString(mode), selected: _mode == mode) |
568 ..text = modeToString(mode); | 568 ..text = modeToString(mode); |
569 }).toList(growable: false) | 569 }).toList(growable: false) |
570 ..onChange.listen((_) { | 570 ..onChange.listen((_) { |
571 _mode = HeapSnapshotTreeMode.values[s.selectedIndex]; | 571 _mode = HeapSnapshotTreeMode.values[s.selectedIndex]; |
572 _r.dirty(); | 572 _r.dirty(); |
573 }) | 573 }) |
574 ]; | 574 ]; |
575 } | 575 } |
576 } | 576 } |
OLD | NEW |