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

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: comments addressed 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
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..58078b22a1446fb0db38038b1bad363aa91766f0 100644
--- a/Source/devtools/front_end/TimelineFlameChart.js
+++ b/Source/devtools/front_end/TimelineFlameChart.js
@@ -164,12 +164,16 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
this._zeroTime = 0;
this._timelineData = {
- entryLevels: [],
- entryTotalTimes: [],
- entryOffsets: [],
- colorEntryIndexes: []
+ entryLevels: /** @type {!Array.<number>} */ ([]),
pfeldman 2014/03/03 12:20:54 You should annotate _timelineData instead.
loislo 2014/03/03 14:29:26 Done.
+ entryTotalTimes: /** @type {!Array.<number>} */ ([]),
+ entryOffsets: /** @type {!Array.<number>} */ ([]),
};
- this._entryTitles = [];
+
+ /** @type {!Array.<string>} */
+ this._entryTitles = [];
+
+ /** @type {!Array.<string>} */
+ this._entryColors = [];
},
_appendRecord: function(record, depth)
@@ -195,13 +199,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 +228,15 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
entryData: function(entryIndex)
{
return null;
+ },
+
+ /**
+ * @param {number} entryIndex
+ * @return {!string}
+ */
+ entryColor: function(entryIndex)
+ {
+ return this._entryColors[entryIndex];
}
}
« Source/devtools/front_end/FlameChart.js ('K') | « Source/devtools/front_end/FlameChart.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698