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

Unified Diff: third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js

Issue 2954973002: DevTools -> Memory Tab -> Allowing to edit a title of a heap snapshot (Closed)
Patch Set: just removing extra line 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/HeapSnapshotView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
index 04707a96a1fca6a2e5cf762c9aca6a7cdc027a35..c612fa56655eeb9b3218393e5986c718a58fbea7 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
@@ -251,6 +251,7 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
if (this._profile.profileType() !== Profiler.ProfileTypeRegistry.instance.trackingHeapSnapshotProfileType)
result.push(this._baseSelect, this._filterSelect);
result.push(this._selectedSizeText);
+ 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
return result;
}
@@ -607,33 +608,30 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
_updateBaseOptions() {
var list = this._profiles();
- // We're assuming that snapshots can only be added.
- if (this._baseSelect.size() === list.length)
- return;
+ var selectedIndex = this._baseSelect.selectedIndex();
- for (var i = this._baseSelect.size(), n = list.length; i < n; ++i) {
- var title = list[i].title;
+ this._baseSelect.removeOptions();
+ for (var item of list) {
+ var title = item.title;
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.
}
+ if (selectedIndex > -1)
+ this._baseSelect.setSelectedIndex(selectedIndex);
}
_updateFilterOptions() {
var list = this._profiles();
- // We're assuming that snapshots can only be added.
- if (this._filterSelect.size() - 1 === list.length)
- return;
+ var selectedIndex = this._filterSelect.selectedIndex();
- if (!this._filterSelect.size())
- this._filterSelect.createOption(Common.UIString('All objects'));
-
- for (var i = this._filterSelect.size() - 1, n = list.length; i < n; ++i) {
+ this._filterSelect.removeOptions();
+ this._filterSelect.createOption(Common.UIString('All objects'));
+ 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
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!
- if (!i)
- title = Common.UIString('Objects allocated before %s', title);
- else
- title = Common.UIString('Objects allocated between %s and %s', list[i - 1].title, title);
+ title = Common.UIString('Objects allocated between %s and %s', list[i - 1].title, title);
this._filterSelect.createOption(title);
}
+ if (selectedIndex > -1)
+ this._filterSelect.setSelectedIndex(selectedIndex);
}
_updateControls() {
@@ -647,6 +645,8 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
*/
_onReceiveSnapshot(event) {
this._updateControls();
+ var profile = event.data;
+ profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
}
/**
@@ -654,6 +654,8 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
*/
_onProfileHeaderRemoved(event) {
var profile = event.data;
+ profile.removeEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
+
if (this._profile === profile) {
this.detach();
this._profile.profileType().removeEventListener(

Powered by Google App Engine
This is Rietveld 408576698