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

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js

Issue 2444223002: [Devtools] Cleanup DataGrid's typecast and identifier naming (Closed)
Patch Set: changes 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/timeline/TimelineTreeView.js
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
index 1c3ca5bed65cd3e522f21c4a4fc5bbd9c09356db..3321a832b63a78bc953f470d15d9b6af5a4124c4 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
@@ -18,7 +18,7 @@ WebInspector.TimelineTreeView = function(model, filters)
this._filters = filters.slice();
- var columns = [];
+ var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([]);
this._populateColumns(columns);
var mainView = new WebInspector.VBox();
@@ -167,11 +167,11 @@ WebInspector.TimelineTreeView.prototype = {
_sortingChanged: function()
{
- var columnIdentifier = this._dataGrid.sortColumnIdentifier();
- if (!columnIdentifier)
+ var columnId = this._dataGrid.sortColumnId();
+ if (!columnId)
return;
var sortFunction;
- switch (columnIdentifier) {
+ switch (columnId) {
case "startTime":
sortFunction = compareStartTime;
break;
@@ -185,7 +185,7 @@ WebInspector.TimelineTreeView.prototype = {
sortFunction = compareName;
break;
default:
- console.assert(false, "Unknown sort field: " + columnIdentifier);
+ console.assert(false, "Unknown sort field: " + columnId);
return;
}
this._dataGrid.sortNodes(sortFunction, !this._dataGrid.isSortOrderAscending());
@@ -316,23 +316,23 @@ WebInspector.TimelineTreeView.GridNode = function(profileNode, grandTotalTime, m
WebInspector.TimelineTreeView.GridNode.prototype = {
/**
* @override
- * @param {string} columnIdentifier
+ * @param {string} columnId
* @return {!Element}
*/
- createCell: function(columnIdentifier)
+ createCell: function(columnId)
{
- if (columnIdentifier === "activity")
- return this._createNameCell(columnIdentifier);
- return this._createValueCell(columnIdentifier) || WebInspector.DataGridNode.prototype.createCell.call(this, columnIdentifier);
+ if (columnId === "activity")
+ return this._createNameCell(columnId);
+ return this._createValueCell(columnId) || WebInspector.DataGridNode.prototype.createCell.call(this, columnId);
},
/**
- * @param {string} columnIdentifier
+ * @param {string} columnId
* @return {!Element}
*/
- _createNameCell: function(columnIdentifier)
+ _createNameCell: function(columnId)
{
- var cell = this.createTD(columnIdentifier);
+ var cell = this.createTD(columnId);
var container = cell.createChild("div", "name-container");
var icon = container.createChild("div", "activity-icon");
var name = container.createChild("div", "activity-name");
@@ -359,18 +359,18 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
},
/**
- * @param {string} columnIdentifier
+ * @param {string} columnId
* @return {?Element}
*/
- _createValueCell: function(columnIdentifier)
+ _createValueCell: function(columnId)
{
- if (columnIdentifier !== "self" && columnIdentifier !== "total" && columnIdentifier !== "startTime")
+ if (columnId !== "self" && columnId !== "total" && columnId !== "startTime")
return null;
var showPercents = false;
var value;
var maxTime;
- switch (columnIdentifier) {
+ switch (columnId) {
case "startTime":
value = this._profileNode.event.startTime - this._treeView._model.minimumRecordTime();
break;
@@ -387,7 +387,7 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
default:
return null;
}
- var cell = this.createTD(columnIdentifier);
+ var cell = this.createTD(columnId);
cell.className = "numeric-column";
var textDiv = cell.createChild("div");
textDiv.createChild("span").textContent = WebInspector.UIString("%.1f\u2009ms", value);
@@ -835,10 +835,10 @@ WebInspector.TimelineStackView = function(treeView)
var header = this.element.createChild("div", "timeline-stack-view-header");
header.textContent = WebInspector.UIString("Heaviest stack");
this._treeView = treeView;
- var columns = [
+ var columns = /** @type {!Array<!WebInspector.DataGrid.ColumnDescriptor>} */ ([
{id: "total", title: WebInspector.UIString("Total Time"), fixedWidth: true, width: "110px"},
{id: "activity", title: WebInspector.UIString("Activity")}
- ];
+ ]);
this._dataGrid = new WebInspector.ViewportDataGrid(columns);
this._dataGrid.setResizeMethod(WebInspector.DataGrid.ResizeMethod.Last);
this._dataGrid.addEventListener(WebInspector.DataGrid.Events.SelectedNode, this._onSelectionChanged, this);

Powered by Google App Engine
This is Rietveld 408576698