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 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) ? '▼' : '►'; |
464 element.children[3].text = '${item.instances} instances of '; | 464 element.children[3].text = '${item.instances} instances of '; |
465 element.children[4] = new ClassRefElement(_isolate, item.clazz, | 465 element.children[4] = |
466 queue: _r.queue)..classes = ['name']; | 466 new ClassRefElement(_isolate, item.clazz, queue: _r.queue) |
| 467 ..classes = ['name']; |
467 } else if (item is Iterable) { | 468 } else if (item is Iterable) { |
468 element.children[0].text = ''; | 469 element.children[0].text = ''; |
469 if (item.isNotEmpty) { | 470 if (item.isNotEmpty) { |
470 element.children[2].text = _tree.isExpanded(item) ? '▼' : '►'; | 471 element.children[2].text = _tree.isExpanded(item) ? '▼' : '►'; |
471 } else { | 472 } else { |
472 element.children[2].text = ''; | 473 element.children[2].text = ''; |
473 } | 474 } |
474 element.children[3].text = ''; | 475 element.children[3].text = ''; |
475 int references = 0; | 476 int references = 0; |
476 for (var referenceGroup in item) { | 477 for (var referenceGroup in item) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 } | 527 } |
527 | 528 |
528 List<Element> _createRootsSelect() { | 529 List<Element> _createRootsSelect() { |
529 var s; | 530 var s; |
530 return [ | 531 return [ |
531 s = new SelectElement() | 532 s = new SelectElement() |
532 ..classes = ['roots-select'] | 533 ..classes = ['roots-select'] |
533 ..value = rootsToString(_roots) | 534 ..value = rootsToString(_roots) |
534 ..children = M.HeapSnapshotRoots.values.map((roots) { | 535 ..children = M.HeapSnapshotRoots.values.map((roots) { |
535 return new OptionElement( | 536 return new OptionElement( |
536 value: rootsToString(roots), | 537 value: rootsToString(roots), selected: _roots == roots) |
537 selected: _roots == roots)..text = rootsToString(roots); | 538 ..text = rootsToString(roots); |
538 }).toList(growable: false) | 539 }).toList(growable: false) |
539 ..onChange.listen((_) { | 540 ..onChange.listen((_) { |
540 _roots = M.HeapSnapshotRoots.values[s.selectedIndex]; | 541 _roots = M.HeapSnapshotRoots.values[s.selectedIndex]; |
541 _refresh(); | 542 _refresh(); |
542 }) | 543 }) |
543 ]; | 544 ]; |
544 } | 545 } |
545 | 546 |
546 static String modeToString(HeapSnapshotTreeMode mode) { | 547 static String modeToString(HeapSnapshotTreeMode mode) { |
547 switch (mode) { | 548 switch (mode) { |
548 case HeapSnapshotTreeMode.dominatorTree: | 549 case HeapSnapshotTreeMode.dominatorTree: |
549 return 'Dominator tree'; | 550 return 'Dominator tree'; |
550 case HeapSnapshotTreeMode.mergedDominatorTree: | 551 case HeapSnapshotTreeMode.mergedDominatorTree: |
551 return 'Dominator tree (merged siblings by class)'; | 552 return 'Dominator tree (merged siblings by class)'; |
552 case HeapSnapshotTreeMode.groupByClass: | 553 case HeapSnapshotTreeMode.groupByClass: |
553 return 'Group by class'; | 554 return 'Group by class'; |
554 } | 555 } |
555 throw new Exception('Unknown HeapSnapshotTreeMode'); | 556 throw new Exception('Unknown HeapSnapshotTreeMode'); |
556 } | 557 } |
557 | 558 |
558 List<Element> _createModeSelect() { | 559 List<Element> _createModeSelect() { |
559 var s; | 560 var s; |
560 return [ | 561 return [ |
561 s = new SelectElement() | 562 s = new SelectElement() |
562 ..classes = ['analysis-select'] | 563 ..classes = ['analysis-select'] |
563 ..value = modeToString(_mode) | 564 ..value = modeToString(_mode) |
564 ..children = HeapSnapshotTreeMode.values.map((mode) { | 565 ..children = HeapSnapshotTreeMode.values.map((mode) { |
565 return new OptionElement( | 566 return new OptionElement( |
566 value: modeToString(mode), | 567 value: modeToString(mode), selected: _mode == mode) |
567 selected: _mode == mode)..text = modeToString(mode); | 568 ..text = modeToString(mode); |
568 }).toList(growable: false) | 569 }).toList(growable: false) |
569 ..onChange.listen((_) { | 570 ..onChange.listen((_) { |
570 _mode = HeapSnapshotTreeMode.values[s.selectedIndex]; | 571 _mode = HeapSnapshotTreeMode.values[s.selectedIndex]; |
571 _r.dirty(); | 572 _r.dirty(); |
572 }) | 573 }) |
573 ]; | 574 ]; |
574 } | 575 } |
575 } | 576 } |
OLD | NEW |