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

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: editing only title. bringing back objects allocated before 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..16120b8d8337b30d1f09d61665d80d91632ea414 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/11 18:44:23 Oh, got it. Thanks! So the title updates for olde
diana.suvorova 2017/07/11 19:19:53 I see. This makes sense. I went with option #2.
return result;
}
@@ -607,33 +608,33 @@ 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.createOption(title);
- }
+ this._baseSelect.removeOptions();
+ for (var item of list)
+ this._baseSelect.createOption(item.title);
+
+ 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) {
- var title = list[i].title;
+ this._filterSelect.removeOptions();
+ this._filterSelect.createOption(Common.UIString('All objects'));
+ for (var i = 0; i < list.length; ++i) {
+ var title;
if (!i)
- title = Common.UIString('Objects allocated before %s', title);
+ title = Common.UIString('Objects allocated before %s', list[i].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, list[i].title);
this._filterSelect.createOption(title);
}
+
+ if (selectedIndex > -1)
+ this._filterSelect.setSelectedIndex(selectedIndex);
}
_updateControls() {
@@ -647,6 +648,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 +657,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