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

Unified 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: 'updating heap snapshot view on title change' 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
index 5829c1f0d1e738c46d11cda9b30fb668c5441a3a..2988c4c7a628c0e13b8b7c004072029aae3fb2e3 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
@@ -295,6 +295,7 @@ Profiler.ProfilesPanel = class extends UI.PanelWithSidebar {
profileType.addEventListener(Profiler.ProfileType.Events.RemoveProfileHeader, onRemoveProfileHeader, this);
profileType.addEventListener(Profiler.ProfileType.Events.ProfileComplete, profileComplete, this);
+
alph 2017/07/07 22:37:25 nuke the extra line.
var profiles = profileType.getProfiles();
for (var i = 0; i < profiles.length; i++)
this._addProfileHeader(profiles[i]);
@@ -612,6 +613,7 @@ Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement {
this._dataDisplayDelegate = dataDisplayDelegate;
this.profile = profile;
profile.addEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this);
+ profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateTitle, this);
if (profile.canSaveToFile())
this._createSaveLink();
else
@@ -641,9 +643,55 @@ Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement {
this.listItemElement.classList.toggle('wait', statusUpdate.wait);
}
+ /**
+ * @override
+ * @return {boolean}
+ */
+ ondblclick(event) {
alph 2017/07/07 22:37:25 annotate event plz
+ if (this._editing)
alph 2017/07/07 22:37:25 if (!this._editing) this._startEditing(); return
+ return false;
+ this._startEditing(/** @type {!Element} */ (event.target));
+ return false;
+ }
+
+ /**
+ * @param {!Element} eventTarget
+ */
+ _startEditing(eventTarget) {
+ var container = eventTarget.enclosingNodeOrSelfWithClass('title-container');
alph 2017/07/07 22:37:25 Can you create the editor on 'title' element, not
+ if (!container)
+ return;
+ container.textContent = this.profile.title;
+ var config = new UI.InplaceEditor.Config(this._editingCommitted.bind(this), this._editingCancelled.bind(this));
+ this._editing = UI.InplaceEditor.startEditing(container, config);
+ }
+
+ /**
+ * @param {!Element} container
+ * @param {string} newTitle
+ * @param {string} oldTitle
+ */
+ _editingCommitted(container, newTitle, oldTitle) {
alph 2017/07/07 22:37:25 nit: just drop oldTitle if it's not used.
+ delete this._editing;
+
+ this.profile.setTitle(newTitle);
+ }
+
+ _editingCancelled() {
+ delete this._editing;
+ this._updateTitle();
+ }
+
+ _updateTitle() {
+ if (this._titleContainer.getElementsByClassName('save-link').length === 0)
+ this._createSaveLink();
+ this._titleElement.textContent = this.profile.title;
+ }
+
dispose() {
this.profile.removeEventListener(Profiler.ProfileHeader.Events.UpdateStatus, this._updateStatus, this);
this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileReceived, this._onProfileReceived, this);
+ this.profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateTitle, this);
}
/**

Powered by Google App Engine
This is Rietveld 408576698