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

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: '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/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 b4ba48f64db4e33b110111cb8495c92c07e18421..effc4c0955db080763f55fd5e86f9a8a5b113203 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotView.js
@@ -607,11 +607,9 @@ 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;
+ this._baseSelect.removeOptions();
- for (var i = this._baseSelect.size(), n = list.length; i < n; ++i) {
+ for (var i = 0; i < list.length; ++i) {
alph 2017/07/07 22:37:25 nit: for (var item of list)
var title = list[i].title;
this._baseSelect.createOption(title);
}
@@ -619,14 +617,11 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
_updateFilterOptions() {
var list = this._profiles();
- // We're assuming that snapshots can only be added.
- if (this._filterSelect.size() - 1 === list.length)
- return;
+ this._filterSelect.removeOptions();
alph 2017/07/07 22:37:25 This will kill the current selection, so the view
- if (!this._filterSelect.size())
- this._filterSelect.createOption(Common.UIString('All objects'));
+ this._filterSelect.createOption(Common.UIString('All objects'));
- for (var i = this._filterSelect.size() - 1, n = list.length; i < n; ++i) {
+ for (var i = 0; i < list.length; ++i) {
var title = list[i].title;
if (!i)
title = Common.UIString('Objects allocated before %s', title);
alph 2017/07/07 22:37:25 nit: You can now move the custom 0-th item out of
@@ -647,6 +642,8 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
*/
_onReceiveSnapshot(event) {
this._updateControls();
+ var profile = event.data;
+ profile.addEventListener(Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
}
/**
@@ -660,6 +657,8 @@ Profiler.HeapSnapshotView = class extends UI.SimpleView {
Profiler.HeapSnapshotProfileType.SnapshotReceived, this._onReceiveSnapshot, this);
this._profile.profileType().removeEventListener(
Profiler.ProfileType.Events.RemoveProfileHeader, this._onProfileHeaderRemoved, this);
+ this._profile.profileType().removeEventListener(
alph 2017/07/07 22:37:25 The listener had been set on the profile instance,
+ Profiler.ProfileHeader.Events.ProfileTitleChanged, this._updateControls, this);
this.dispose();
} else {
this._updateControls();

Powered by Google App Engine
This is Rietveld 408576698