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

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

Issue 2450663004: DevTools: do not allow using 'this' before call into super. (Closed)
Patch Set: rebaselined Created 4 years, 2 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/ProfileView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
index 0d739ab4a8996c78a81261be07b1d18e7a73db8d..6c0f189a27795feb8e4839a4d8365baec1eaf0d6 100644
--- a/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
+++ b/third_party/WebKit/Source/devtools/front_end/profiler/ProfileView.js
@@ -6,10 +6,8 @@
* @constructor
* @implements {WebInspector.Searchable}
* @extends {WebInspector.SimpleView}
- * @param {!WebInspector.ProfileDataGridNode.Formatter} nodeFormatter
- * @param {!Array<string>=} viewTypes
*/
-WebInspector.ProfileView = function(nodeFormatter, viewTypes)
+WebInspector.ProfileView = function()
{
WebInspector.SimpleView.call(this, WebInspector.UIString("Profile"));
@@ -17,14 +15,6 @@ WebInspector.ProfileView = function(nodeFormatter, viewTypes)
this._searchableView.setPlaceholder(WebInspector.UIString("Find by cost (>50ms), name or file"));
this._searchableView.show(this.element);
- viewTypes = viewTypes || [
- WebInspector.ProfileView.ViewTypes.Flame,
- WebInspector.ProfileView.ViewTypes.Heavy,
- WebInspector.ProfileView.ViewTypes.Tree
- ];
- this._viewType = WebInspector.settings.createSetting("profileView", WebInspector.ProfileView.ViewTypes.Heavy);
- this._nodeFormatter = nodeFormatter;
-
var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([]);
columns.push({id: "self", title: this.columnHeader("self"), width: "120px", fixedWidth: true, sortable: true, sort: WebInspector.DataGrid.Order.Descending});
columns.push({id: "total", title: this.columnHeader("total"), width: "120px", fixedWidth: true, sortable: true});
@@ -36,15 +26,6 @@ WebInspector.ProfileView = function(nodeFormatter, viewTypes)
this.dataGrid.addEventListener(WebInspector.DataGrid.Events.DeselectedNode, this._nodeSelected.bind(this, false));
this.viewSelectComboBox = new WebInspector.ToolbarComboBox(this._changeView.bind(this));
- var optionNames = new Map([
- [WebInspector.ProfileView.ViewTypes.Flame, WebInspector.UIString("Chart")],
- [WebInspector.ProfileView.ViewTypes.Heavy, WebInspector.UIString("Heavy (Bottom Up)")],
- [WebInspector.ProfileView.ViewTypes.Tree, WebInspector.UIString("Tree (Top Down)")],
- ]);
- var options = new Map(viewTypes.map(type => [type, this.viewSelectComboBox.createOption(optionNames.get(type), "", type)]));
- var optionName = this._viewType.get() || viewTypes[0];
- var option = options.get(optionName) || options.get(viewTypes[0]);
- this.viewSelectComboBox.select(option);
this.focusButton = new WebInspector.ToolbarButton(WebInspector.UIString("Focus selected function"), "visibility-toolbar-item");
this.focusButton.setEnabled(false);
@@ -59,10 +40,6 @@ WebInspector.ProfileView = function(nodeFormatter, viewTypes)
this.resetButton.addEventListener("click", this._resetClicked, this);
this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));
-
- this._changeView();
- if (this._flameChart)
- this._flameChart.update();
};
/** @enum {string} */
@@ -88,6 +65,38 @@ WebInspector.ProfileView.buildPopoverTable = function(entryInfo)
};
WebInspector.ProfileView.prototype = {
+ /**
+ * @param {!WebInspector.ProfileDataGridNode.Formatter} nodeFormatter
+ * @param {!Array<string>=} viewTypes
+ * @protected
+ */
+ initialize: function(nodeFormatter, viewTypes)
+ {
+ this._nodeFormatter = nodeFormatter;
+
+ this._viewType = WebInspector.settings.createSetting("profileView", WebInspector.ProfileView.ViewTypes.Heavy);
+ viewTypes = viewTypes || [
+ WebInspector.ProfileView.ViewTypes.Flame,
+ WebInspector.ProfileView.ViewTypes.Heavy,
+ WebInspector.ProfileView.ViewTypes.Tree
+ ];
+
+ var optionNames = new Map([
+ [WebInspector.ProfileView.ViewTypes.Flame, WebInspector.UIString("Chart")],
+ [WebInspector.ProfileView.ViewTypes.Heavy, WebInspector.UIString("Heavy (Bottom Up)")],
+ [WebInspector.ProfileView.ViewTypes.Tree, WebInspector.UIString("Tree (Top Down)")],
+ ]);
+
+ var options = new Map(viewTypes.map(type => [type, this.viewSelectComboBox.createOption(optionNames.get(type), "", type)]));
+ var optionName = this._viewType.get() || viewTypes[0];
+ var option = options.get(optionName) || options.get(viewTypes[0]);
+ this.viewSelectComboBox.select(option);
+
+ this._changeView();
+ if (this._flameChart)
+ this._flameChart.update();
+ },
+
focus: function()
{
if (this._flameChart)

Powered by Google App Engine
This is Rietveld 408576698