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

Unified Diff: Source/devtools/front_end/TimelineFlameChart.js

Issue 185533004: FlameChart: convert colors magic into dataProvider.entryColor getter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: minor changes Created 6 years, 10 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 | « Source/devtools/front_end/FlameChart.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/TimelineFlameChart.js
diff --git a/Source/devtools/front_end/TimelineFlameChart.js b/Source/devtools/front_end/TimelineFlameChart.js
index cd7e675d4e2fe8418132dd003b976519ee86cbcb..b1e6921683864fb4fd6b837bb43333ac6686a322 100644
--- a/Source/devtools/front_end/TimelineFlameChart.js
+++ b/Source/devtools/front_end/TimelineFlameChart.js
@@ -128,7 +128,7 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
WebInspector.TimelinePresentationModel.forAllRecords(this._model.records, this._appendRecord.bind(this));
this._zeroTime = this._model.minimumRecordTime();
}
- return this._timelineData;
+ return /** @type {!WebInspector.FlameChart.TimelineData} */(this._timelineData);
},
/**
@@ -163,13 +163,20 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
this._totalTime = 1000;
this._zeroTime = 0;
+ /**
+ * @type {?WebInspector.FlameChart.TimelineData}
+ */
this._timelineData = {
entryLevels: [],
entryTotalTimes: [],
entryOffsets: [],
- colorEntryIndexes: []
};
- this._entryTitles = [];
+
+ /** @type {!Array.<string>} */
+ this._entryTitles = [];
+
+ /** @type {!Array.<string>} */
+ this._entryColors = [];
},
_appendRecord: function(record, depth)
@@ -195,13 +202,7 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
timelineData.entryOffsets[index] = record.startTime - startTime;
timelineData.entryLevels[index] = depth - 1;
timelineData.entryTotalTimes[index] = endTime - record.startTime;
-
- var color = this._colorGenerator.colorForID(WebInspector.TimelineUIUtils.categoryForRecord(record).name);
- var indexesForColor = timelineData.colorEntryIndexes[color.index];
- if (!indexesForColor)
- indexesForColor = timelineData.colorEntryIndexes[color.index] = [];
- indexesForColor.push(index);
-
+ this._entryColors[index] = this._colorGenerator.colorForID(WebInspector.TimelineUIUtils.categoryForRecord(record).name);
this._maxStackDepth = Math.max(this._maxStackDepth, depth + 1);
},
@@ -230,6 +231,15 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
entryData: function(entryIndex)
{
return null;
+ },
+
+ /**
+ * @param {number} entryIndex
+ * @return {!string}
+ */
+ entryColor: function(entryIndex)
+ {
+ return this._entryColors[entryIndex];
}
}
« no previous file with comments | « Source/devtools/front_end/FlameChart.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698