OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 */ | 288 */ |
289 function profileComplete(event) { | 289 function profileComplete(event) { |
290 this.showProfile(/** @type {!Profiler.ProfileHeader} */ (event.data)); | 290 this.showProfile(/** @type {!Profiler.ProfileHeader} */ (event.data)); |
291 } | 291 } |
292 | 292 |
293 profileType.addEventListener(Profiler.ProfileType.Events.ViewUpdated, this._ updateProfileTypeSpecificUI, this); | 293 profileType.addEventListener(Profiler.ProfileType.Events.ViewUpdated, this._ updateProfileTypeSpecificUI, this); |
294 profileType.addEventListener(Profiler.ProfileType.Events.AddProfileHeader, o nAddProfileHeader, this); | 294 profileType.addEventListener(Profiler.ProfileType.Events.AddProfileHeader, o nAddProfileHeader, this); |
295 profileType.addEventListener(Profiler.ProfileType.Events.RemoveProfileHeader , onRemoveProfileHeader, this); | 295 profileType.addEventListener(Profiler.ProfileType.Events.RemoveProfileHeader , onRemoveProfileHeader, this); |
296 profileType.addEventListener(Profiler.ProfileType.Events.ProfileComplete, pr ofileComplete, this); | 296 profileType.addEventListener(Profiler.ProfileType.Events.ProfileComplete, pr ofileComplete, this); |
297 | 297 |
298 | |
alph
2017/07/07 22:37:25
nuke the extra line.
| |
298 var profiles = profileType.getProfiles(); | 299 var profiles = profileType.getProfiles(); |
299 for (var i = 0; i < profiles.length; i++) | 300 for (var i = 0; i < profiles.length; i++) |
300 this._addProfileHeader(profiles[i]); | 301 this._addProfileHeader(profiles[i]); |
301 } | 302 } |
302 | 303 |
303 /** | 304 /** |
304 * @param {!Event} event | 305 * @param {!Event} event |
305 */ | 306 */ |
306 _handleContextMenuEvent(event) { | 307 _handleContextMenuEvent(event) { |
307 var contextMenu = new UI.ContextMenu(event); | 308 var contextMenu = new UI.ContextMenu(event); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
605 this._titleContainer = this._titlesElement.createChild('span', 'title-contai ner'); | 606 this._titleContainer = this._titlesElement.createChild('span', 'title-contai ner'); |
606 this._titleElement = this._titleContainer.createChild('span', 'title'); | 607 this._titleElement = this._titleContainer.createChild('span', 'title'); |
607 this._subtitleElement = this._titlesElement.createChild('span', 'subtitle'); | 608 this._subtitleElement = this._titlesElement.createChild('span', 'subtitle'); |
608 | 609 |
609 this._titleElement.textContent = profile.title; | 610 this._titleElement.textContent = profile.title; |
610 this._className = className; | 611 this._className = className; |
611 this._small = false; | 612 this._small = false; |
612 this._dataDisplayDelegate = dataDisplayDelegate; | 613 this._dataDisplayDelegate = dataDisplayDelegate; |
613 this.profile = profile; | 614 this.profile = profile; |
614 profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._u pdateStatus, this); | 615 profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._u pdateStatus, this); |
616 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateTitle, this); | |
615 if (profile.canSaveToFile()) | 617 if (profile.canSaveToFile()) |
616 this._createSaveLink(); | 618 this._createSaveLink(); |
617 else | 619 else |
618 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileReceived, th is._onProfileReceived, this); | 620 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileReceived, th is._onProfileReceived, this); |
619 } | 621 } |
620 | 622 |
621 _createSaveLink() { | 623 _createSaveLink() { |
622 this._saveLinkElement = this._titleContainer.createChild('span', 'save-link' ); | 624 this._saveLinkElement = this._titleContainer.createChild('span', 'save-link' ); |
623 this._saveLinkElement.textContent = Common.UIString('Save'); | 625 this._saveLinkElement.textContent = Common.UIString('Save'); |
624 this._saveLinkElement.addEventListener('click', this._saveProfile.bind(this) , false); | 626 this._saveLinkElement.addEventListener('click', this._saveProfile.bind(this) , false); |
625 } | 627 } |
626 | 628 |
627 _onProfileReceived(event) { | 629 _onProfileReceived(event) { |
628 this._createSaveLink(); | 630 this._createSaveLink(); |
629 } | 631 } |
630 | 632 |
631 /** | 633 /** |
632 * @param {!Common.Event} event | 634 * @param {!Common.Event} event |
633 */ | 635 */ |
634 _updateStatus(event) { | 636 _updateStatus(event) { |
635 var statusUpdate = event.data; | 637 var statusUpdate = event.data; |
636 if (statusUpdate.subtitle !== null) { | 638 if (statusUpdate.subtitle !== null) { |
637 this._subtitleElement.textContent = statusUpdate.subtitle || ''; | 639 this._subtitleElement.textContent = statusUpdate.subtitle || ''; |
638 this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle ); | 640 this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle ); |
639 } | 641 } |
640 if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) | 642 if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) |
641 this.listItemElement.classList.toggle('wait', statusUpdate.wait); | 643 this.listItemElement.classList.toggle('wait', statusUpdate.wait); |
642 } | 644 } |
643 | 645 |
646 /** | |
647 * @override | |
648 * @return {boolean} | |
649 */ | |
650 ondblclick(event) { | |
alph
2017/07/07 22:37:25
annotate event plz
| |
651 if (this._editing) | |
alph
2017/07/07 22:37:25
if (!this._editing)
this._startEditing();
return
| |
652 return false; | |
653 this._startEditing(/** @type {!Element} */ (event.target)); | |
654 return false; | |
655 } | |
656 | |
657 /** | |
658 * @param {!Element} eventTarget | |
659 */ | |
660 _startEditing(eventTarget) { | |
661 var container = eventTarget.enclosingNodeOrSelfWithClass('title-container'); | |
alph
2017/07/07 22:37:25
Can you create the editor on 'title' element, not
| |
662 if (!container) | |
663 return; | |
664 container.textContent = this.profile.title; | |
665 var config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this), this._editingCancelled.bind(this)); | |
666 this._editing = UI.InplaceEditor.startEditing(container, config); | |
667 } | |
668 | |
669 /** | |
670 * @param {!Element} container | |
671 * @param {string} newTitle | |
672 * @param {string} oldTitle | |
673 */ | |
674 _editingCommitted(container, newTitle, oldTitle) { | |
alph
2017/07/07 22:37:25
nit: just drop oldTitle if it's not used.
| |
675 delete this._editing; | |
676 | |
677 this.profile.setTitle(newTitle); | |
678 } | |
679 | |
680 _editingCancelled() { | |
681 delete this._editing; | |
682 this._updateTitle(); | |
683 } | |
684 | |
685 _updateTitle() { | |
686 if (this._titleContainer.getElementsByClassName('save-link').length === 0) | |
687 this._createSaveLink(); | |
688 this._titleElement.textContent = this.profile.title; | |
689 } | |
690 | |
644 dispose() { | 691 dispose() { |
645 this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this); | 692 this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this); |
646 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceiv ed, this._onProfileReceived, this); | 693 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceiv ed, this._onProfileReceived, this); |
694 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleC hanged, this._updateTitle, this); | |
647 } | 695 } |
648 | 696 |
649 /** | 697 /** |
650 * @override | 698 * @override |
651 * @return {boolean} | 699 * @return {boolean} |
652 */ | 700 */ |
653 onselect() { | 701 onselect() { |
654 this._dataDisplayDelegate.showProfile(this.profile); | 702 this._dataDisplayDelegate.showProfile(this.profile); |
655 return true; | 703 return true; |
656 } | 704 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
815 * @param {string} actionId | 863 * @param {string} actionId |
816 * @return {boolean} | 864 * @return {boolean} |
817 */ | 865 */ |
818 handleAction(context, actionId) { | 866 handleAction(context, actionId) { |
819 var panel = UI.context.flavor(Profiler.JSProfilerPanel); | 867 var panel = UI.context.flavor(Profiler.JSProfilerPanel); |
820 console.assert(panel && panel instanceof Profiler.JSProfilerPanel); | 868 console.assert(panel && panel instanceof Profiler.JSProfilerPanel); |
821 panel.toggleRecord(); | 869 panel.toggleRecord(); |
822 return true; | 870 return true; |
823 } | 871 } |
824 }; | 872 }; |
OLD | NEW |