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

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

Issue 402653002: Delete TimelineTracingView (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated TestExpectations to include virtual/ Created 6 years, 5 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/devtools.gypi ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/timeline/TimelineFlameChart.js
diff --git a/Source/devtools/front_end/timeline/TimelineFlameChart.js b/Source/devtools/front_end/timeline/TimelineFlameChart.js
index cf1cac10ebb82c1f789d4c464bbae0180fb8125c..3f03e83a35a66ed0c370adf13d4f88f0b7606492 100644
--- a/Source/devtools/front_end/timeline/TimelineFlameChart.js
+++ b/Source/devtools/front_end/timeline/TimelineFlameChart.js
@@ -31,417 +31,6 @@
/**
* @constructor
* @implements {WebInspector.FlameChartDataProvider}
- * @implements {WebInspector.TimelineFlameChart.SelectionProvider}
- * @param {!WebInspector.TimelineModelImpl} model
- * @param {!WebInspector.TimelineFrameModelBase} frameModel
- * @param {!WebInspector.TimelineUIUtils} uiUtils
- */
-WebInspector.TimelineFlameChartDataProvider = function(model, frameModel, uiUtils)
-{
- WebInspector.FlameChartDataProvider.call(this);
- this._model = model;
- this._frameModel = frameModel;
- this._uiUtils = uiUtils;
- this._font = "12px " + WebInspector.fontFamily();
- this._linkifier = new WebInspector.Linkifier();
-}
-
-WebInspector.TimelineFlameChartDataProvider.prototype = {
- /**
- * @return {number}
- */
- barHeight: function()
- {
- return 20;
- },
-
- /**
- * @return {number}
- */
- textBaseline: function()
- {
- return 6;
- },
-
- /**
- * @return {number}
- */
- textPadding: function()
- {
- return 5;
- },
-
- /**
- * @param {number} entryIndex
- * @return {string}
- */
- entryFont: function(entryIndex)
- {
- return this._font;
- },
-
- /**
- * @param {number} entryIndex
- * @return {?string}
- */
- entryTitle: function(entryIndex)
- {
- var record = this._records[entryIndex];
- if (record === this._cpuThreadRecord)
- return WebInspector.UIString("CPU");
- else if (record === this._gpuThreadRecord)
- return WebInspector.UIString("GPU");
- var details = this._uiUtils.buildDetailsNode(record, this._linkifier, this._model.loadedFromFile());
- var title = this._uiUtils.titleForRecord(record);
- return details ? WebInspector.UIString("%s (%s)", title, details.textContent) : title;
- },
-
- /**
- * @param {number} startTime
- * @param {number} endTime
- * @return {?Array.<number>}
- */
- dividerOffsets: function(startTime, endTime)
- {
- // While we have tracing and timeline flame chart on screen at a time,
- // we don't want to render frame-based grid.
- return null;
- },
-
- reset: function()
- {
- this._timelineData = null;
- },
-
- /**
- * @return {!WebInspector.FlameChart.TimelineData}
- */
- timelineData: function()
- {
- if (this._timelineData)
- return this._timelineData;
-
- this._linkifier.reset();
-
- /**
- * @type {?WebInspector.FlameChart.TimelineData}
- */
- this._timelineData = {
- entryLevels: [],
- entryTotalTimes: [],
- entryStartTimes: []
- };
-
- this._records = [];
- this._entryThreadDepths = {};
- this._minimumBoundary = this._model.minimumRecordTime();
-
- this._cpuThreadRecord = this._uiUtils.createProgramRecord(this._model);
- this._pushRecord(this._cpuThreadRecord, 0, this.minimumBoundary(), Math.max(this._model.maximumRecordTime(), this.totalTime() + this.minimumBoundary()));
-
- this._gpuThreadRecord = null;
-
- var records = this._model.records();
- for (var i = 0; i < records.length; ++i) {
- var record = records[i];
- var thread = record.thread();
- if (thread === "gpu")
- continue;
- if (thread === WebInspector.TimelineModel.MainThreadName) {
- for (var j = 0; j < record.children().length; ++j)
- this._appendRecord(record.children()[j], 1);
- } else {
- var visible = this._appendRecord(records[i], 1);
- if (visible && !this._gpuThreadRecord) {
- this._gpuThreadRecord = this._uiUtils.createProgramRecord(this._model);
- this._pushRecord(this._gpuThreadRecord, 0, this.minimumBoundary(), Math.max(this._model.maximumRecordTime(), this.totalTime() + this.minimumBoundary()));
- }
- }
- }
-
- var cpuStackDepth = Math.max(4, this._entryThreadDepths[WebInspector.TimelineModel.MainThreadName]);
- delete this._entryThreadDepths[WebInspector.TimelineModel.MainThreadName];
- this._maxStackDepth = cpuStackDepth;
-
- if (this._gpuThreadRecord) {
- // We have multiple threads, update levels.
- var threadBaselines = {};
- var threadBaseline = cpuStackDepth + 2;
-
- for (var thread in this._entryThreadDepths) {
- threadBaselines[thread] = threadBaseline;
- threadBaseline += this._entryThreadDepths[thread];
- }
- this._maxStackDepth = threadBaseline;
-
- for (var i = 0; i < this._records.length; ++i) {
- var record = this._records[i];
- var level = this._timelineData.entryLevels[i];
- if (record === this._cpuThreadRecord)
- level = 0;
- else if (record === this._gpuThreadRecord)
- level = cpuStackDepth + 2;
- else if (record.thread() !== WebInspector.TimelineModel.MainThreadName)
- level += threadBaselines[record.thread()];
- this._timelineData.entryLevels[i] = level;
- }
- }
-
- return this._timelineData;
- },
-
- /**
- * @return {number}
- */
- minimumBoundary: function()
- {
- return this._minimumBoundary;
- },
-
- /**
- * @return {number}
- */
- totalTime: function()
- {
- return Math.max(1000, this._model.maximumRecordTime() - this._model.minimumRecordTime());
- },
-
- /**
- * @return {number}
- */
- maxStackDepth: function()
- {
- return this._maxStackDepth;
- },
-
- /**
- * @param {!WebInspector.TimelineModel.Record} record
- * @param {number} level
- * @return {boolean}
- */
- _appendRecord: function(record, level)
- {
- var result = false;
- if (!this._model.isVisible(record)) {
- for (var i = 0; i < record.children().length; ++i)
- result = this._appendRecord(record.children()[i], level) || result;
- return result;
- }
-
- this._pushRecord(record, level, record.startTime(), record.endTime());
- for (var i = 0; i < record.children().length; ++i)
- this._appendRecord(record.children()[i], level + 1);
- return true;
- },
-
- /**
- * @param {!WebInspector.TimelineModel.Record} record
- * @param {number} level
- * @param {number} startTime
- * @param {number} endTime
- * @return {number}
- */
- _pushRecord: function(record, level, startTime, endTime)
- {
- var index = this._records.length;
- this._records.push(record);
- this._timelineData.entryStartTimes[index] = startTime;
- this._timelineData.entryLevels[index] = level;
- this._timelineData.entryTotalTimes[index] = endTime - startTime;
- this._entryThreadDepths[record.thread()] = Math.max(level, this._entryThreadDepths[record.thread()] || 0);
- return index;
- },
-
- /**
- * @param {number} entryIndex
- * @return {?Array.<!{title: string, text: string}>}
- */
- prepareHighlightedEntryInfo: function(entryIndex)
- {
- return null;
- },
-
- /**
- * @param {number} entryIndex
- * @return {boolean}
- */
- canJumpToEntry: function(entryIndex)
- {
- return false;
- },
-
- /**
- * @param {number} entryIndex
- * @return {string}
- */
- entryColor: function(entryIndex)
- {
- var record = this._records[entryIndex];
- if (record === this._cpuThreadRecord || record === this._gpuThreadRecord)
- return "#555";
-
- if (record.type() === WebInspector.TimelineModel.RecordType.JSFrame)
- return WebInspector.TimelineFlameChartDataProvider.jsFrameColorGenerator().colorForID(record.data()["functionName"]);
-
- return this._uiUtils.categoryForRecord(record).fillColorStop1;
- },
-
-
- /**
- * @param {number} entryIndex
- * @param {!CanvasRenderingContext2D} context
- * @param {?string} text
- * @param {number} barX
- * @param {number} barY
- * @param {number} barWidth
- * @param {number} barHeight
- * @param {function(number):number} offsetToPosition
- * @return {boolean}
- */
- decorateEntry: function(entryIndex, context, text, barX, barY, barWidth, barHeight, offsetToPosition)
- {
- if (barWidth < 5)
- return false;
-
- var record = this._records[entryIndex];
- var timelineData = this._timelineData;
-
- var category = this._uiUtils.categoryForRecord(record);
- // Paint text using white color on dark background.
- if (text) {
- context.save();
- context.fillStyle = "white";
- context.shadowColor = "rgba(0, 0, 0, 0.1)";
- context.shadowOffsetX = 1;
- context.shadowOffsetY = 1;
- context.font = this._font;
- context.fillText(text, barX + this.textPadding(), barY + barHeight - this.textBaseline());
- context.restore();
- }
-
- if (record.children().length) {
- var entryStartTime = timelineData.entryStartTimes[entryIndex];
- var barSelf = offsetToPosition(entryStartTime + record.selfTime())
-
- context.beginPath();
- context.fillStyle = category.backgroundColor;
- context.rect(barSelf, barY, barX + barWidth - barSelf, barHeight);
- context.fill();
-
- // Paint text using dark color on light background.
- if (text) {
- context.save();
- context.clip();
- context.fillStyle = category.borderColor;
- context.shadowColor = "rgba(0, 0, 0, 0.1)";
- context.shadowOffsetX = 1;
- context.shadowOffsetY = 1;
- context.fillText(text, barX + this.textPadding(), barY + barHeight - this.textBaseline());
- context.restore();
- }
- }
-
- if (record.warnings()) {
- context.save();
-
- context.rect(barX, barY, barWidth, this.barHeight());
- context.clip();
-
- context.beginPath();
- context.fillStyle = record.warnings() ? "red" : "rgba(255, 0, 0, 0.5)";
- context.moveTo(barX + barWidth - 15, barY + 1);
- context.lineTo(barX + barWidth - 1, barY + 1);
- context.lineTo(barX + barWidth - 1, barY + 15);
- context.fill();
-
- context.restore();
- }
-
- return true;
- },
-
- /**
- * @param {number} entryIndex
- * @return {boolean}
- */
- forceDecoration: function(entryIndex)
- {
- var record = this._records[entryIndex];
- return !!record.warnings();
- },
-
- /**
- * @param {number} entryIndex
- * @return {?{startTime: number, endTime: number}}
- */
- highlightTimeRange: function(entryIndex)
- {
- var record = this._records[entryIndex];
- if (record === this._cpuThreadRecord || record === this._gpuThreadRecord)
- return null;
- return {
- startTime: record.startTime(),
- endTime: record.endTime()
- };
- },
-
- /**
- * @return {number}
- */
- paddingLeft: function()
- {
- return 0;
- },
-
- /**
- * @param {number} entryIndex
- * @return {string}
- */
- textColor: function(entryIndex)
- {
- return "white";
- },
-
- /**
- * @param {number} entryIndex
- * @return {?WebInspector.TimelineSelection}
- */
- createSelection: function(entryIndex)
- {
- var record = this._records[entryIndex];
- if (record instanceof WebInspector.TimelineModel.RecordImpl) {
- this._lastSelection = new WebInspector.TimelineFlameChart.Selection(WebInspector.TimelineSelection.fromRecord(record), entryIndex);
- return this._lastSelection.timelineSelection;
- }
- return null;
- },
-
- /**
- * @param {?WebInspector.TimelineSelection} selection
- * @return {number}
- */
- entryIndexForSelection: function(selection)
- {
- if (!selection || selection.type() !== WebInspector.TimelineSelection.Type.Record)
- return -1;
- var record = /** @type{!WebInspector.TimelineModel.Record} */ (selection.object());
- if (this._lastSelection && this._lastSelection.timelineSelection.object() === record)
- return this._lastSelection.entryIndex;
- var entryRecords = this._records;
- for (var entryIndex = 0; entryIndex < entryRecords.length; ++entryIndex) {
- if (entryRecords[entryIndex] === record) {
- this._lastSelection = new WebInspector.TimelineFlameChart.Selection(WebInspector.TimelineSelection.fromRecord(record), entryIndex);
- return entryIndex;
- }
- }
- return -1;
- }
-}
-
-/**
- * @constructor
- * @implements {WebInspector.FlameChartDataProvider}
- * @implements {WebInspector.TimelineFlameChart.SelectionProvider}
* @param {!WebInspector.TracingTimelineModel} model
* @param {!WebInspector.TimelineFrameModelBase} frameModel
* @param {!WebInspector.Target} target
@@ -454,7 +43,6 @@ WebInspector.TracingBasedTimelineFlameChartDataProvider = function(model, frameM
this._target = target;
this._font = "12px " + WebInspector.fontFamily();
this._linkifier = new WebInspector.Linkifier();
- this._palette = new WebInspector.TraceViewPalette();
this._entryIndexToTitle = {};
this._filters = [];
this.addFilter(WebInspector.TracingTimelineUIUtils.hiddenEventsFilter());
@@ -701,7 +289,7 @@ WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = {
if (!event)
return "#555";
if (event.name === WebInspector.TracingTimelineModel.RecordType.JSFrame)
- return WebInspector.TimelineFlameChartDataProvider.jsFrameColorGenerator().colorForID(event.args.data["functionName"]);
+ return WebInspector.TracingBasedTimelineFlameChartDataProvider.jsFrameColorGenerator().colorForID(event.args.data["functionName"]);
var style = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event.name);
return style.category.fillColorStop1;
},
@@ -865,18 +453,18 @@ WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = {
/**
* @return {!WebInspector.FlameChart.ColorGenerator}
*/
-WebInspector.TimelineFlameChartDataProvider.jsFrameColorGenerator = function()
+WebInspector.TracingBasedTimelineFlameChartDataProvider.jsFrameColorGenerator = function()
{
- if (!WebInspector.TimelineFlameChartDataProvider._jsFrameColorGenerator) {
+ if (!WebInspector.TracingBasedTimelineFlameChartDataProvider._jsFrameColorGenerator) {
var hueSpace = { min: 30, max: 55, count: 5 };
var satSpace = { min: 70, max: 100, count: 6 };
var colorGenerator = new WebInspector.FlameChart.ColorGenerator(hueSpace, satSpace, 50);
colorGenerator.setColorForID("(idle)", "hsl(0, 0%, 60%)");
colorGenerator.setColorForID("(program)", "hsl(0, 0%, 60%)");
colorGenerator.setColorForID("(garbage collector)", "hsl(0, 0%, 60%)");
- WebInspector.TimelineFlameChartDataProvider._jsFrameColorGenerator = colorGenerator;
+ WebInspector.TracingBasedTimelineFlameChartDataProvider._jsFrameColorGenerator = colorGenerator;
}
- return WebInspector.TimelineFlameChartDataProvider._jsFrameColorGenerator;
+ return WebInspector.TracingBasedTimelineFlameChartDataProvider._jsFrameColorGenerator;
}
/**
@@ -885,21 +473,17 @@ WebInspector.TimelineFlameChartDataProvider.jsFrameColorGenerator = function()
* @implements {WebInspector.TimelineModeView}
* @implements {WebInspector.FlameChartDelegate}
* @param {!WebInspector.TimelineModeViewDelegate} delegate
- * @param {!WebInspector.TimelineModel} model
- * @param {?WebInspector.TracingTimelineModel} tracingModel
+ * @param {!WebInspector.TracingTimelineModel} tracingModel
* @param {!WebInspector.TimelineFrameModelBase} frameModel
- * @param {!WebInspector.TimelineUIUtils} uiUtils
*/
-WebInspector.TimelineFlameChart = function(delegate, model, tracingModel, frameModel, uiUtils)
+WebInspector.TimelineFlameChart = function(delegate, tracingModel, frameModel)
{
WebInspector.VBox.call(this);
this.element.classList.add("timeline-flamechart");
this.registerRequiredCSS("flameChart.css");
this._delegate = delegate;
- this._model = model;
- this._dataProvider = tracingModel
- ? new WebInspector.TracingBasedTimelineFlameChartDataProvider(tracingModel, frameModel, model.target())
- : new WebInspector.TimelineFlameChartDataProvider(/** @type {!WebInspector.TimelineModelImpl} */(model), frameModel, uiUtils);
+ this._model = tracingModel;
+ this._dataProvider = new WebInspector.TracingBasedTimelineFlameChartDataProvider(tracingModel, frameModel, tracingModel.target())
this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true);
this._mainView.show(this.element);
this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStarted, this._onRecordingStarted, this);
@@ -1043,21 +627,3 @@ WebInspector.TimelineFlameChart.Selection = function(selection, entryIndex)
this.timelineSelection = selection;
this.entryIndex = entryIndex;
}
-
-/**
- * @interface
- */
-WebInspector.TimelineFlameChart.SelectionProvider = function() { }
-
-WebInspector.TimelineFlameChart.SelectionProvider.prototype = {
- /**
- * @param {number} entryIndex
- * @return {?WebInspector.TimelineSelection}
- */
- createSelection: function(entryIndex) { },
- /**
- * @param {?WebInspector.TimelineSelection} selection
- * @return {number}
- */
- entryIndexForSelection: function(selection) { }
-}
« no previous file with comments | « Source/devtools/devtools.gypi ('k') | Source/devtools/front_end/timeline/TimelinePanel.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698