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

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: 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 29059af4b4d6c24729cc230f164bb6f5b32662df..0934eb58d46c425d2262986b249cd814dea0f0a0 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfilesPanel.js
@@ -612,6 +612,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 +642,49 @@ Profiler.ProfileSidebarTreeElement = class extends UI.TreeElement {
this.listItemElement.classList.toggle('wait', statusUpdate.wait);
}
+ /**
+ * @override
+ * @param {!Event} event
+ * @return {boolean}
+ */
+ ondblclick(event) {
+ if (!this._editing)
+ this._startEditing(/** @type {!Element} */ (event.target));
+ return false;
+ }
+
+ /**
+ * @param {!Element} eventTarget
+ */
+ _startEditing(eventTarget) {
+ var container = eventTarget.enclosingNodeOrSelfWithClass('title');
+ if (!container)
+ return;
+ 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
+ */
+ _editingCommitted(container, newTitle) {
+ delete this._editing;
+ this.profile.setTitle(newTitle);
+ }
+
+ _editingCancelled() {
+ delete this._editing;
+ }
+
+ _updateTitle() {
+ 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
+ }
+
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);
}
/**
« 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