Chromium Code Reviews| 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]; |
| } |
| } |