Commit 29010da6 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

DevTools: remove color generator from timeline flame chart.

R=loislo@chromium.org

Review URL: https://codereview.chromium.org/187473005

git-svn-id: svn://svn.chromium.org/blink/trunk@168483 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 007d2d1f
......@@ -47,7 +47,7 @@ WebInspector.TimelineEventOverview = function(model)
}
this._disabledCategoryFillStyle = WebInspector.TimelineUIUtils.createFillStyle(this._context, 0, WebInspector.TimelineEventOverview._stripGradientHeight,
"rgb(218, 218, 218)", "rgb(170, 170, 170)", "rgb(143, 143, 143)");
"hsl(0, 0%, 85%)", "hsl(0, 0%, 67%)", "hsl(0, 0%, 56%)");
this._disabledCategoryBorderStyle = "rgb(143, 143, 143)";
}
......
......@@ -42,13 +42,6 @@ WebInspector.TimelineFlameChartDataProvider = function(model, frameModel, mainTh
this._frameModel = frameModel;
this._mainThread = mainThread;
this._font = "bold 12px " + WebInspector.fontFamily();
this._colorGenerator = new WebInspector.FlameChart.ColorGenerator();
var categories = WebInspector.TimelineUIUtils.categories();
for (var category in categories) {
this._colorGenerator.setColorForID(category, categories[category].fillColorStop1);
this._colorGenerator.setColorForID(category + " child", categories[category].fillColorStop0);
}
}
WebInspector.TimelineFlameChartDataProvider.prototype = {
......@@ -91,7 +84,7 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
*/
entryTitle: function(entryIndex)
{
return this._entryTitles[entryIndex];
return this._isSelfSegment[entryIndex] ? this._records[entryIndex].title() : null;
},
/**
......@@ -123,14 +116,6 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
this._appendRecord(record, 0);
},
/**
* @return {!WebInspector.FlameChart.ColorGenerator}
*/
colorGenerator: function()
{
return this._colorGenerator;
},
/**
* @return {!WebInspector.FlameChart.TimelineData}
*/
......@@ -187,11 +172,8 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
entryOffsets: [],
};
/** @type {!Array.<string>} */
this._entryTitles = [];
/** @type {!Array.<string>} */
this._entryColors = [];
this._records = [];
this._isSelfSegment = [];
},
/**
......@@ -216,41 +198,38 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
return;
}
var color = this._colorGenerator.colorForID(WebInspector.TimelineUIUtils.categoryForRecord(record).name);
var colorChild = this._colorGenerator.colorForID(WebInspector.TimelineUIUtils.categoryForRecord(record).name + " child");
var currentTime = record.startTime;
for (var i = 0; i < record.children.length; ++i) {
var childRecord = record.children[i];
var childStartTime = childRecord.startTime;
if (currentTime !== childStartTime)
this._pushRecord(record, level, color, currentTime, childStartTime);
this._pushRecord(record, true, level, currentTime, childStartTime);
var childEndTime = childRecord.endTime || childRecord.startTime;
this._pushRecord(record, level, colorChild, childStartTime, childEndTime);
this._pushRecord(record, false, level, childStartTime, childEndTime);
this._appendRecord(childRecord, level + 1);
currentTime = childEndTime;
}
if (recordEndTime !== currentTime || record.children.length === 0)
this._pushRecord(record, level, color, currentTime, recordEndTime);
this._pushRecord(record, true, level, currentTime, recordEndTime);
this._maxStackDepth = Math.max(this._maxStackDepth, level + 2);
},
/**
* @param {!WebInspector.TimelineModel.Record} record
* @param {boolean} isSelfSegment
* @param {number} level
* @param {string} color
* @param {number} startTime
* @param {number} endTime
*/
_pushRecord: function(record, level, color, startTime, endTime)
_pushRecord: function(record, isSelfSegment, level, startTime, endTime)
{
var index = this._entryTitles.length;
this._entryTitles[index] = record.type;
var index = this._records.length;
this._records.push(record);
this._timelineData.entryOffsets[index] = startTime - this._zeroTime;
this._timelineData.entryLevels[index] = level;
this._timelineData.entryTotalTimes[index] = endTime - startTime;
this._entryColors[index] = color;
this._isSelfSegment[index] = isSelfSegment;
},
/**
......@@ -286,7 +265,8 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
*/
entryColor: function(entryIndex)
{
return this._entryColors[entryIndex];
var category = WebInspector.TimelineUIUtils.categoryForRecord(this._records[entryIndex]);
return this._isSelfSegment[entryIndex] ? category.fillColorStop1 : category.backgroundColor;
},
/**
......
......@@ -38,12 +38,12 @@ WebInspector.TimelineUIUtils.categories = function()
if (WebInspector.TimelineUIUtils._categories)
return WebInspector.TimelineUIUtils._categories;
WebInspector.TimelineUIUtils._categories = {
loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), 0, "#5A8BCC", "#8EB6E9", "#70A2E3"),
scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), 1, "#D8AA34", "#F3D07A", "#F1C453"),
rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), 2, "#8266CC", "#AF9AEB", "#9A7EE6"),
painting: new WebInspector.TimelineCategory("painting", WebInspector.UIString("Painting"), 2, "#5FA050", "#8DC286", "#71B363"),
other: new WebInspector.TimelineCategory("other", WebInspector.UIString("Other"), -1, "#BBBBBB", "#DDDDDD", "#DDDDDD"),
idle: new WebInspector.TimelineCategory("idle", WebInspector.UIString("Idle"), -1, "#DDDDDD", "#FFFFFF", "#FFFFFF")
loading: new WebInspector.TimelineCategory("loading", WebInspector.UIString("Loading"), 0, "hsl(214, 53%, 58%)", "hsl(214, 67%, 90%)", "hsl(214, 67%, 74%)", "hsl(214, 67%, 66%)"),
scripting: new WebInspector.TimelineCategory("scripting", WebInspector.UIString("Scripting"), 1, "hsl(43, 68%, 53%)", "hsl(43, 83%, 90%)", "hsl(43, 83%, 72%)", "hsl(43, 83%, 64%) "),
rendering: new WebInspector.TimelineCategory("rendering", WebInspector.UIString("Rendering"), 2, "hsl(256, 50%, 60%)", "hsl(256, 67%, 90%)", "hsl(256, 67%, 76%)", "hsl(256, 67%, 70%)"),
painting: new WebInspector.TimelineCategory("painting", WebInspector.UIString("Painting"), 2, "hsl(109, 33%, 47%)", "hsl(109, 33%, 90%)", "hsl(109, 33%, 64%)", "hsl(109, 33%, 55%)"),
other: new WebInspector.TimelineCategory("other", WebInspector.UIString("Other"), -1, "hsl(0, 0%, 73%)", "hsl(0, 0%, 90%)", "hsl(0, 0%, 87%)", "hsl(0, 0%, 79%)"),
idle: new WebInspector.TimelineCategory("idle", WebInspector.UIString("Idle"), -1, "hsl(0, 0%, 87%)", "hsl(0, 100%, 100%)", "hsl(0, 100%, 100%)", "hsl(0, 100%, 100%)")
};
return WebInspector.TimelineUIUtils._categories;
};
......@@ -804,15 +804,17 @@ WebInspector.TimelineUIUtils.buildDetailsNode = function(record, linkifier)
* @param {string} title
* @param {number} overviewStripGroupIndex
* @param {string} borderColor
* @param {string} backgroundColor
* @param {string} fillColorStop0
* @param {string} fillColorStop1
*/
WebInspector.TimelineCategory = function(name, title, overviewStripGroupIndex, borderColor, fillColorStop0, fillColorStop1)
WebInspector.TimelineCategory = function(name, title, overviewStripGroupIndex, borderColor, backgroundColor, fillColorStop0, fillColorStop1)
{
this.name = name;
this.title = title;
this.overviewStripGroupIndex = overviewStripGroupIndex;
this.borderColor = borderColor;
this.backgroundColor = backgroundColor;
this.fillColorStop0 = fillColorStop0;
this.fillColorStop1 = fillColorStop1;
this.hidden = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment