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

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

Issue 1470783003: Timeline: do not show percent columns in Events tree view (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | third_party/WebKit/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: 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 63529f44c6e61e41fed52b44b6669ef31b9ca78f..f7764ac425e9cb7b7c9b974a543bee22bda59627 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
@@ -65,6 +65,14 @@ WebInspector.TimelineTreeView.prototype = {
},
/**
+ * @return {boolean}
+ */
+ _exposePercentages: function()
+ {
+ return false;
+ },
+
+ /**
* @param {!Element} parent
*/
_populateToolbar: function(parent) { },
@@ -333,25 +341,9 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
{
if (columnIdentifier !== "self" && columnIdentifier !== "total" && columnIdentifier !== "startTime")
return null;
- /**
- * @param {number} time
- * @return {string}
- */
- function formatMilliseconds(time)
- {
- return WebInspector.UIString("%.1f\u2009ms", time);
- }
- /**
- * @param {number} value
- * @return {string}
- */
- function formatPercent(value)
- {
- return WebInspector.UIString("%.1f\u2009%%", value);
- }
+ var showPercents = false;
var value;
- var percentText;
var maxTime;
switch (columnIdentifier) {
case "startTime":
@@ -359,13 +351,13 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
break;
case "self":
value = this._profileNode.selfTime;
- percentText = formatPercent(this._profileNode.selfTime / this._grandTotalTime * 100);
maxTime = this._maxSelfTime;
+ showPercents = true;
break;
case "total":
value = this._profileNode.totalTime;
- percentText = formatPercent(this._profileNode.totalTime / this._grandTotalTime * 100);
maxTime = this._maxTotalTime;
+ showPercents = true;
break;
default:
return null;
@@ -373,13 +365,14 @@ WebInspector.TimelineTreeView.GridNode.prototype = {
var cell = this.createTD(columnIdentifier);
cell.className = "numeric-column";
var textDiv = cell.createChild("div");
- textDiv.createChild("span").textContent = formatMilliseconds(value);
- if (percentText) {
- textDiv.createChild("span", "percent-column").textContent = percentText;
- textDiv.classList.add("profile-multiple-values");
- }
- if (maxTime)
+ textDiv.createChild("span").textContent = WebInspector.UIString("%.1f\u2009ms", value);
+
+ if (showPercents && this._treeView._exposePercentages())
+ textDiv.createChild("span", "percent-column").textContent = WebInspector.UIString("%.1f\u2009%%", value / this._grandTotalTime * 100);
+ if (maxTime) {
+ textDiv.classList.add("background-percent-bar");
cell.createChild("div", "background-bar-container").createChild("div", "background-bar").style.width = (value * 100 / maxTime).toFixed(1) + "%";
+ }
return cell;
},
@@ -472,6 +465,15 @@ WebInspector.AggregatedTimelineTreeView.prototype = {
panelToolbar.appendToolbarItem(this._groupByCombobox);
},
+ /**
+ * @override
+ * @return {boolean}
+ */
+ _exposePercentages: function()
+ {
+ return true;
+ },
+
_onGroupByChanged: function()
{
this._groupBySetting.set(this._groupByCombobox.selectedOption().value);
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/timeline/timelinePanel.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698