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

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

Issue 1298283002: DevTools: [timeline tree view] render visual of percent in the background. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: addressing comments Created 5 years, 4 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 | « no previous file | Source/devtools/front_end/timeline/timelinePanel.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TimelineTreeView.js
diff --git a/Source/devtools/front_end/timeline/TimelineTreeView.js b/Source/devtools/front_end/timeline/TimelineTreeView.js
index 7fa6ed61dccdb0a72ef331ae0352861c6a2197dd..c8d8f1c369694cb21a57ea3271c8bd6338ac8306 100644
--- a/Source/devtools/front_end/timeline/TimelineTreeView.js
+++ b/Source/devtools/front_end/timeline/TimelineTreeView.js
@@ -118,9 +118,15 @@ WebInspector.TimelineTreeView.prototype = {
var tree = this._modeCombobox.selectedOption().value === WebInspector.TimelineTreeView.Mode.TopDown
? this._preformTopDownTreeGrouping(topDown)
: this._buildBottomUpTree(topDown);
+ var maxSelfTime = 0;
+ var maxTotalTime = 0;
+ for (var child of tree.children.values()) {
+ maxSelfTime = Math.max(maxSelfTime, child.selfTime);
+ maxTotalTime = Math.max(maxTotalTime, child.totalTime);
+ }
for (var child of tree.children.values()) {
// Exclude the idle time off the total calculation.
- var gridNode = new WebInspector.TimelineTreeView.GridNode(child, topDown.totalTime);
+ var gridNode = new WebInspector.TimelineTreeView.GridNode(child, topDown.totalTime, maxSelfTime, maxTotalTime);
this.dataGrid.insertChild(gridNode);
}
this._sortingChanged();
@@ -288,10 +294,12 @@ WebInspector.TimelineTreeView.eventURL = function(event)
/**
* @constructor
* @extends {WebInspector.SortableDataGridNode}
- * @param {?} profileNode
+ * @param {!WebInspector.TimelineModel.ProfileTreeNode} profileNode
* @param {number} grandTotalTime
+ * @param {number} maxSelfTime
+ * @param {number} maxTotalTime
*/
-WebInspector.TimelineTreeView.GridNode = function(profileNode, grandTotalTime)
+WebInspector.TimelineTreeView.GridNode = function(profileNode, grandTotalTime, maxSelfTime, maxTotalTime)
{
/**
* @param {number} time
@@ -313,6 +321,7 @@ WebInspector.TimelineTreeView.GridNode = function(profileNode, grandTotalTime)
this._populated = false;
this._profileNode = profileNode;
this._totalTime = grandTotalTime;
+ this._maxTimes = { self: maxSelfTime, total: maxTotalTime };
var selfTime = profileNode.selfTime;
var selfPercent = selfTime / grandTotalTime * 100;
var totalTime = profileNode.totalTime;
@@ -377,22 +386,16 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
{
if (columnIdentifier !== "self" && columnIdentifier !== "total")
return null;
-
var cell = this.createTD(columnIdentifier);
cell.className = "numeric-column";
- var div = createElement("div");
- var valueSpan = createElement("span");
- valueSpan.textContent = this.data[columnIdentifier];
- div.appendChild(valueSpan);
+ var textDiv = cell.createChild("div");
+ textDiv.createChild("span").textContent = this.data[columnIdentifier];
var percentColumn = columnIdentifier + "-percent";
if (percentColumn in this.data) {
- var percentSpan = createElement("span");
- percentSpan.className = "percent-column";
- percentSpan.textContent = this.data[percentColumn];
- div.appendChild(percentSpan);
- div.classList.add("profile-multiple-values");
+ textDiv.createChild("span", "percent-column").textContent = this.data[percentColumn];
+ textDiv.classList.add("profile-multiple-values");
}
- cell.appendChild(div);
+ cell.createChild("div", "background-bar").style.width = (this._profileNode[columnIdentifier + "Time"] * 100 / this._maxTimes[columnIdentifier]).toFixed(1) + "%";
return cell;
},
@@ -407,7 +410,7 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
if (!this._profileNode.children)
return;
for (var node of this._profileNode.children.values()) {
- var gridNode = new WebInspector.TimelineTreeView.GridNode(node, this._totalTime);
+ var gridNode = new WebInspector.TimelineTreeView.GridNode(node, this._totalTime, this._maxTimes.self, this._maxTimes.total);
this.insertChildOrdered(gridNode);
}
},
« no previous file with comments | « no previous file | Source/devtools/front_end/timeline/timelinePanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698