OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
600 const multipleSnapshots = this._profiles().length > 1; | 600 const multipleSnapshots = this._profiles().length > 1; |
601 this._perspectiveSelect.removeOptions(); | 601 this._perspectiveSelect.removeOptions(); |
602 this._perspectives.forEach((perspective, index) => { | 602 this._perspectives.forEach((perspective, index) => { |
603 if (multipleSnapshots || perspective !== this._comparisonPerspective) | 603 if (multipleSnapshots || perspective !== this._comparisonPerspective) |
604 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex)); | 604 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex)); |
605 }); | 605 }); |
606 } | 606 } |
607 | 607 |
608 _updateBaseOptions() { | 608 _updateBaseOptions() { |
609 var list = this._profiles(); | 609 var list = this._profiles(); |
610 // We're assuming that snapshots can only be added. | 610 this._baseSelect.removeOptions(); |
611 if (this._baseSelect.size() === list.length) | |
612 return; | |
613 | 611 |
614 for (var i = this._baseSelect.size(), n = list.length; i < n; ++i) { | 612 for (var i = 0; i < list.length; ++i) { |
alph
2017/07/07 22:37:25
nit: for (var item of list)
| |
615 var title = list[i].title; | 613 var title = list[i].title; |
616 this._baseSelect.createOption(title); | 614 this._baseSelect.createOption(title); |
617 } | 615 } |
618 } | 616 } |
619 | 617 |
620 _updateFilterOptions() { | 618 _updateFilterOptions() { |
621 var list = this._profiles(); | 619 var list = this._profiles(); |
622 // We're assuming that snapshots can only be added. | 620 this._filterSelect.removeOptions(); |
alph
2017/07/07 22:37:25
This will kill the current selection, so the view
| |
623 if (this._filterSelect.size() - 1 === list.length) | |
624 return; | |
625 | 621 |
626 if (!this._filterSelect.size()) | 622 this._filterSelect.createOption(Common.UIString('All objects')); |
627 this._filterSelect.createOption(Common.UIString('All objects')); | |
628 | 623 |
629 for (var i = this._filterSelect.size() - 1, n = list.length; i < n; ++i) { | 624 for (var i = 0; i < list.length; ++i) { |
630 var title = list[i].title; | 625 var title = list[i].title; |
631 if (!i) | 626 if (!i) |
632 title = Common.UIString('Objects allocated before %s', title); | 627 title = Common.UIString('Objects allocated before %s', title); |
alph
2017/07/07 22:37:25
nit: You can now move the custom 0-th item out of
| |
633 else | 628 else |
634 title = Common.UIString('Objects allocated between %s and %s', list[i - 1].title, title); | 629 title = Common.UIString('Objects allocated between %s and %s', list[i - 1].title, title); |
635 this._filterSelect.createOption(title); | 630 this._filterSelect.createOption(title); |
636 } | 631 } |
637 } | 632 } |
638 | 633 |
639 _updateControls() { | 634 _updateControls() { |
640 this._updatePerspectiveOptions(); | 635 this._updatePerspectiveOptions(); |
641 this._updateBaseOptions(); | 636 this._updateBaseOptions(); |
642 this._updateFilterOptions(); | 637 this._updateFilterOptions(); |
643 } | 638 } |
644 | 639 |
645 /** | 640 /** |
646 * @param {!Common.Event} event | 641 * @param {!Common.Event} event |
647 */ | 642 */ |
648 _onReceiveSnapshot(event) { | 643 _onReceiveSnapshot(event) { |
649 this._updateControls(); | 644 this._updateControls(); |
645 var profile = event.data; | |
646 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this); | |
650 } | 647 } |
651 | 648 |
652 /** | 649 /** |
653 * @param {!Common.Event} event | 650 * @param {!Common.Event} event |
654 */ | 651 */ |
655 _onProfileHeaderRemoved(event) { | 652 _onProfileHeaderRemoved(event) { |
656 var profile = event.data; | 653 var profile = event.data; |
657 if (this._profile === profile) { | 654 if (this._profile === profile) { |
658 this.detach(); | 655 this.detach(); |
659 this._profile.profileType().removeEventListener( | 656 this._profile.profileType().removeEventListener( |
660 Profiler.HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnap shot, this); | 657 Profiler.HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnap shot, this); |
661 this._profile.profileType().removeEventListener( | 658 this._profile.profileType().removeEventListener( |
662 Profiler.ProfileType.Events.RemoveProfileHeader, this._onProfileHeader Removed, this); | 659 Profiler.ProfileType.Events.RemoveProfileHeader, this._onProfileHeader Removed, this); |
660 this._profile.profileType().removeEventListener( | |
alph
2017/07/07 22:37:25
The listener had been set on the profile instance,
| |
661 Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControl s, this); | |
663 this.dispose(); | 662 this.dispose(); |
664 } else { | 663 } else { |
665 this._updateControls(); | 664 this._updateControls(); |
666 } | 665 } |
667 } | 666 } |
668 | 667 |
669 dispose() { | 668 dispose() { |
670 if (this._allocationStackView) { | 669 if (this._allocationStackView) { |
671 this._allocationStackView.clear(); | 670 this._allocationStackView.clear(); |
672 this._allocationDataGrid.dispose(); | 671 this._allocationDataGrid.dispose(); |
(...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2061 frame.line - 1, frame.column - 1); | 2060 frame.line - 1, frame.column - 1); |
2062 frameDiv.appendChild(urlElement); | 2061 frameDiv.appendChild(urlElement); |
2063 } | 2062 } |
2064 } | 2063 } |
2065 | 2064 |
2066 clear() { | 2065 clear() { |
2067 this.element.removeChildren(); | 2066 this.element.removeChildren(); |
2068 this._linkifier.reset(); | 2067 this._linkifier.reset(); |
2069 } | 2068 } |
2070 }; | 2069 }; |
OLD | NEW |