Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js

Issue 2954973002: DevTools -> Memory Tab -> Allowing to edit a title of a heap snapshot (Closed)
Patch Set: adding listeners to existing profiles Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 this._titleContainer = this._titlesElement.createChild('span', 'title-contai ner'); 605 this._titleContainer = this._titlesElement.createChild('span', 'title-contai ner');
606 this._titleElement = this._titleContainer.createChild('span', 'title'); 606 this._titleElement = this._titleContainer.createChild('span', 'title');
607 this._subtitleElement = this._titlesElement.createChild('span', 'subtitle'); 607 this._subtitleElement = this._titlesElement.createChild('span', 'subtitle');
608 608
609 this._titleElement.textContent = profile.title; 609 this._titleElement.textContent = profile.title;
610 this._className = className; 610 this._className = className;
611 this._small = false; 611 this._small = false;
612 this._dataDisplayDelegate = dataDisplayDelegate; 612 this._dataDisplayDelegate = dataDisplayDelegate;
613 this.profile = profile; 613 this.profile = profile;
614 profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._u pdateStatus, this); 614 profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._u pdateStatus, this);
615 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateTitle, this);
615 if (profile.canSaveToFile()) 616 if (profile.canSaveToFile())
616 this._createSaveLink(); 617 this._createSaveLink();
617 else 618 else
618 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileReceived, th is._onProfileReceived, this); 619 profile.addEventListener(Profiler.ProfileHeader.Events.ProfileReceived, th is._onProfileReceived, this);
619 } 620 }
620 621
621 _createSaveLink() { 622 _createSaveLink() {
622 this._saveLinkElement = this._titleContainer.createChild('span', 'save-link' ); 623 this._saveLinkElement = this._titleContainer.createChild('span', 'save-link' );
623 this._saveLinkElement.textContent = Common.UIString('Save'); 624 this._saveLinkElement.textContent = Common.UIString('Save');
624 this._saveLinkElement.addEventListener('click', this._saveProfile.bind(this) , false); 625 this._saveLinkElement.addEventListener('click', this._saveProfile.bind(this) , false);
625 } 626 }
626 627
627 _onProfileReceived(event) { 628 _onProfileReceived(event) {
628 this._createSaveLink(); 629 this._createSaveLink();
629 } 630 }
630 631
631 /** 632 /**
632 * @param {!Common.Event} event 633 * @param {!Common.Event} event
633 */ 634 */
634 _updateStatus(event) { 635 _updateStatus(event) {
635 var statusUpdate = event.data; 636 var statusUpdate = event.data;
636 if (statusUpdate.subtitle !== null) { 637 if (statusUpdate.subtitle !== null) {
637 this._subtitleElement.textContent = statusUpdate.subtitle || ''; 638 this._subtitleElement.textContent = statusUpdate.subtitle || '';
638 this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle ); 639 this._titlesElement.classList.toggle('no-subtitle', !statusUpdate.subtitle );
639 } 640 }
640 if (typeof statusUpdate.wait === 'boolean' && this.listItemElement) 641 if (typeof statusUpdate.wait === 'boolean' && this.listItemElement)
641 this.listItemElement.classList.toggle('wait', statusUpdate.wait); 642 this.listItemElement.classList.toggle('wait', statusUpdate.wait);
642 } 643 }
643 644
645 /**
646 * @override
647 * @param {!Event} event
648 * @return {boolean}
649 */
650 ondblclick(event) {
651 if (!this._editing)
652 this._startEditing(/** @type {!Element} */ (event.target));
653 return false;
654 }
655
656 /**
657 * @param {!Element} eventTarget
658 */
659 _startEditing(eventTarget) {
660 var container = eventTarget.enclosingNodeOrSelfWithClass('title');
661 if (!container)
662 return;
663 var config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this), this._editingCancelled.bind(this));
664 this._editing = UI.InplaceEditor.startEditing(container, config);
665 }
666
667 /**
668 * @param {!Element} container
669 * @param {string} newTitle
670 */
671 _editingCommitted(container, newTitle) {
672 delete this._editing;
673 this.profile.setTitle(newTitle);
674 }
675
676 _editingCancelled() {
677 delete this._editing;
678 }
679
680 _updateTitle() {
681 this._titleElement.textContent = this.profile.title;
alph 2017/07/11 21:24:58 You still do not need this. The event is coming fr
diana.suvorova 2017/07/11 21:47:50 This is great! ProfileTitleChanged listener is gon
682 }
683
644 dispose() { 684 dispose() {
645 this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this); 685 this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this);
646 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceiv ed, this._onProfileReceived, this); 686 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceiv ed, this._onProfileReceived, this);
687 this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleC hanged, this._updateTitle, this);
647 } 688 }
648 689
649 /** 690 /**
650 * @override 691 * @override
651 * @return {boolean} 692 * @return {boolean}
652 */ 693 */
653 onselect() { 694 onselect() {
654 this._dataDisplayDelegate.showProfile(this.profile); 695 this._dataDisplayDelegate.showProfile(this.profile);
655 return true; 696 return true;
656 } 697 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 * @param {string} actionId 856 * @param {string} actionId
816 * @return {boolean} 857 * @return {boolean}
817 */ 858 */
818 handleAction(context, actionId) { 859 handleAction(context, actionId) {
819 var panel = UI.context.flavor(Profiler.JSProfilerPanel); 860 var panel = UI.context.flavor(Profiler.JSProfilerPanel);
820 console.assert(panel && panel instanceof Profiler.JSProfilerPanel); 861 console.assert(panel && panel instanceof Profiler.JSProfilerPanel);
821 panel.toggleRecord(); 862 panel.toggleRecord();
822 return true; 863 return true;
823 } 864 }
824 }; 865 };
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698