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

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: adding myself to authors 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 | « AUTHORS ('k') | third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js » ('j') | 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/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..aa2011b5ea59873cd50d1cb4dcf62ea86a73383d 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
@@ -166,6 +166,9 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
this._populate();
this._searchThrottler = new Common.Throttler(0);
+
+ for (var existingProfile of this._profiles())
+ existingProfile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
}
/**
@@ -607,33 +610,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 +650,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 +659,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(
« no previous file with comments | « AUTHORS ('k') | third_party/WebKit/Source/devtools/front_end/profiler/ProfileHeader.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698