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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 | 244 |
245 /** | 245 /** |
246 * @override | 246 * @override |
247 * @return {!Array<!UI.ToolbarItem>} | 247 * @return {!Array<!UI.ToolbarItem>} |
248 */ | 248 */ |
249 syncToolbarItems() { | 249 syncToolbarItems() { |
250 var result = [this._perspectiveSelect, this._classNameFilter]; | 250 var result = [this._perspectiveSelect, this._classNameFilter]; |
251 if (this._profile.profileType() !== Profiler.ProfileTypeRegistry.instance.tr ackingHeapSnapshotProfileType) | 251 if (this._profile.profileType() !== Profiler.ProfileTypeRegistry.instance.tr ackingHeapSnapshotProfileType) |
252 result.push(this._baseSelect, this._filterSelect); | 252 result.push(this._baseSelect, this._filterSelect); |
253 result.push(this._selectedSizeText); | 253 result.push(this._selectedSizeText); |
254 this._updateControls(); | |
alph
2017/07/10 21:16:30
I wonder, why do you need this?
diana.suvorova
2017/07/11 16:54:26
Here is the scenario that I need it for:
- create
| |
254 return result; | 255 return result; |
255 } | 256 } |
256 | 257 |
257 /** | 258 /** |
258 * @override | 259 * @override |
259 */ | 260 */ |
260 willHide() { | 261 willHide() { |
261 this._currentSearchResultIndex = -1; | 262 this._currentSearchResultIndex = -1; |
262 this._popoverHelper.hidePopover(); | 263 this._popoverHelper.hidePopover(); |
263 } | 264 } |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
600 const multipleSnapshots = this._profiles().length > 1; | 601 const multipleSnapshots = this._profiles().length > 1; |
601 this._perspectiveSelect.removeOptions(); | 602 this._perspectiveSelect.removeOptions(); |
602 this._perspectives.forEach((perspective, index) => { | 603 this._perspectives.forEach((perspective, index) => { |
603 if (multipleSnapshots || perspective !== this._comparisonPerspective) | 604 if (multipleSnapshots || perspective !== this._comparisonPerspective) |
604 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex)); | 605 this._perspectiveSelect.createOption(perspective.title(), '', String(ind ex)); |
605 }); | 606 }); |
606 } | 607 } |
607 | 608 |
608 _updateBaseOptions() { | 609 _updateBaseOptions() { |
609 var list = this._profiles(); | 610 var list = this._profiles(); |
610 // We're assuming that snapshots can only be added. | 611 var selectedIndex = this._baseSelect.selectedIndex(); |
611 if (this._baseSelect.size() === list.length) | |
612 return; | |
613 | 612 |
614 for (var i = this._baseSelect.size(), n = list.length; i < n; ++i) { | 613 this._baseSelect.removeOptions(); |
615 var title = list[i].title; | 614 for (var item of list) { |
615 var title = item.title; | |
616 this._baseSelect.createOption(title); | 616 this._baseSelect.createOption(title); |
alph
2017/07/10 21:16:30
nit: Just inline the title: this._baseSelect.creat
diana.suvorova
2017/07/11 16:54:26
updated.
| |
617 } | 617 } |
618 if (selectedIndex > -1) | |
619 this._baseSelect.setSelectedIndex(selectedIndex); | |
618 } | 620 } |
619 | 621 |
620 _updateFilterOptions() { | 622 _updateFilterOptions() { |
621 var list = this._profiles(); | 623 var list = this._profiles(); |
622 // We're assuming that snapshots can only be added. | 624 var selectedIndex = this._filterSelect.selectedIndex(); |
623 if (this._filterSelect.size() - 1 === list.length) | |
624 return; | |
625 | 625 |
626 if (!this._filterSelect.size()) | 626 this._filterSelect.removeOptions(); |
627 this._filterSelect.createOption(Common.UIString('All objects')); | 627 this._filterSelect.createOption(Common.UIString('All objects')); |
628 | 628 for (var i = 1; i < list.length; ++i) { |
alph
2017/07/10 21:16:30
We lost "Objects allocated before ..." option.
diana.suvorova
2017/07/11 16:54:26
yes, thanks, should be back
| |
629 for (var i = this._filterSelect.size() - 1, n = list.length; i < n; ++i) { | |
630 var title = list[i].title; | 629 var title = list[i].title; |
alph
2017/07/10 21:16:30
nit: just inline the title into the line below.
diana.suvorova
2017/07/11 16:54:26
updated!
| |
631 if (!i) | 630 title = Common.UIString('Objects allocated between %s and %s', list[i - 1] .title, title); |
632 title = Common.UIString('Objects allocated before %s', title); | |
633 else | |
634 title = Common.UIString('Objects allocated between %s and %s', list[i - 1].title, title); | |
635 this._filterSelect.createOption(title); | 631 this._filterSelect.createOption(title); |
636 } | 632 } |
633 if (selectedIndex > -1) | |
634 this._filterSelect.setSelectedIndex(selectedIndex); | |
637 } | 635 } |
638 | 636 |
639 _updateControls() { | 637 _updateControls() { |
640 this._updatePerspectiveOptions(); | 638 this._updatePerspectiveOptions(); |
641 this._updateBaseOptions(); | 639 this._updateBaseOptions(); |
642 this._updateFilterOptions(); | 640 this._updateFilterOptions(); |
643 } | 641 } |
644 | 642 |
645 /** | 643 /** |
646 * @param {!Common.Event} event | 644 * @param {!Common.Event} event |
647 */ | 645 */ |
648 _onReceiveSnapshot(event) { | 646 _onReceiveSnapshot(event) { |
649 this._updateControls(); | 647 this._updateControls(); |
648 var profile = event.data; | |
649 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this); | |
650 } | 650 } |
651 | 651 |
652 /** | 652 /** |
653 * @param {!Common.Event} event | 653 * @param {!Common.Event} event |
654 */ | 654 */ |
655 _onProfileHeaderRemoved(event) { | 655 _onProfileHeaderRemoved(event) { |
656 var profile = event.data; | 656 var profile = event.data; |
657 profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleChange d, this._updateControls, this); | |
658 | |
657 if (this._profile === profile) { | 659 if (this._profile === profile) { |
658 this.detach(); | 660 this.detach(); |
659 this._profile.profileType().removeEventListener( | 661 this._profile.profileType().removeEventListener( |
660 Profiler.HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnap shot, this); | 662 Profiler.HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnap shot, this); |
661 this._profile.profileType().removeEventListener( | 663 this._profile.profileType().removeEventListener( |
662 Profiler.ProfileType.Events.RemoveProfileHeader, this._onProfileHeader Removed, this); | 664 Profiler.ProfileType.Events.RemoveProfileHeader, this._onProfileHeader Removed, this); |
663 this.dispose(); | 665 this.dispose(); |
664 } else { | 666 } else { |
665 this._updateControls(); | 667 this._updateControls(); |
666 } | 668 } |
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1974 frame.line - 1, frame.column - 1); | 1976 frame.line - 1, frame.column - 1); |
1975 frameDiv.appendChild(urlElement); | 1977 frameDiv.appendChild(urlElement); |
1976 } | 1978 } |
1977 } | 1979 } |
1978 | 1980 |
1979 clear() { | 1981 clear() { |
1980 this.element.removeChildren(); | 1982 this.element.removeChildren(); |
1981 this._linkifier.reset(); | 1983 this._linkifier.reset(); |
1982 } | 1984 } |
1983 }; | 1985 }; |
OLD | NEW |