Commit 3e4802b9 authored by yurys@chromium.org's avatar yurys@chromium.org

Move more methods into implementation specific timeline UI utils

BUG=361045
R=loislo@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176421 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4236a863
......@@ -29,7 +29,7 @@ function test()
function clickValueLink(record, row)
{
var helper = WebInspector.TimelineUIUtils.generateDetailsContent(record, record._model, new WebInspector.Linkifier(), onDetailsContentReady);
var helper = WebInspector.TimelineUIUtilsImpl.generateDetailsContent(record, record._model, new WebInspector.Linkifier(), onDetailsContentReady);
function onDetailsContentReady(element)
{
......
......@@ -38,7 +38,7 @@ function test()
if (recordTypes.indexOf(record.type()) === -1)
return;
var details = WebInspector.TimelineUIUtils.buildDetailsNode(record, linkifier, false);
var details = WebInspector.TimelineUIUtilsImpl.buildDetailsNode(record, linkifier, false);
if (details)
InspectorTest.addResult("details.textContent for " + record.type() + " event: '" + details.textContent + "'");
}
......
......@@ -89,7 +89,7 @@ WebInspector.TimelineFlameChartDataProvider.prototype = {
return WebInspector.UIString("CPU");
else if (record === this._gpuThreadRecord)
return WebInspector.UIString("GPU");
var details = WebInspector.TimelineUIUtils.buildDetailsNode(record, this._linkifier, this._model.loadedFromFile());
var details = WebInspector.TimelineUIUtilsImpl.buildDetailsNode(record, this._linkifier, this._model.loadedFromFile());
return details ? WebInspector.UIString("%s (%s)", record.title(), details.textContent) : record.title();
},
......@@ -499,7 +499,7 @@ WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = {
{
var event = this._entryEvents[entryIndex];
if (event) {
var name = WebInspector.TimelineUIUtils.styleForTimelineEvent(event.name).title;
var name = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event.name).title;
// TODO(yurys): support event dividers
var details = WebInspector.TracingTimelineUIUtils.buildDetailsNodeForTraceEvent(event, this._linkifier, false, this._target);
return details ? WebInspector.UIString("%s (%s)", name, details.textContent) : name;
......@@ -621,7 +621,7 @@ WebInspector.TracingBasedTimelineFlameChartDataProvider.prototype = {
var event = this._entryEvents[entryIndex];
if (!event)
return "#555";
var style = WebInspector.TimelineUIUtils.styleForTimelineEvent(event.name);
var style = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event.name);
return style.category.fillColorStop1;
},
......
......@@ -986,16 +986,12 @@ WebInspector.TimelinePanel.prototype = {
switch (this._selection.type()) {
case WebInspector.TimelineSelection.Type.Record:
var record = /** @type {!WebInspector.TimelineModel.Record} */ (this._selection.object());
if (this._tracingTimelineModel) {
var event = this._tracingTimelineModel.traceEventFrom(record);
this._buildSelectionDetailsForTraceEvent(event);
} else {
WebInspector.TimelineUIUtils.generateDetailsContent(record, this._model, this._detailsLinkifier, this.showInDetails.bind(this, record.title()), this._model.loadedFromFile());
}
this._uiUtils.generateDetailsContent(record, this._model, this._detailsLinkifier, this.showInDetails.bind(this, record.title()), this._model.loadedFromFile());
break;
case WebInspector.TimelineSelection.Type.TraceEvent:
var event = /** @type {!WebInspector.TracingModel.Event} */ (this._selection.object());
this._buildSelectionDetailsForTraceEvent(event);
var title = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(event.name).title;
WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, this._tracingTimelineModel, this._detailsLinkifier, this.showInDetails.bind(this, title), false, this._model.target());
break;
case WebInspector.TimelineSelection.Type.Frame:
var frame = /** @type {!WebInspector.TimelineFrame} */ (this._selection.object());
......@@ -1009,15 +1005,6 @@ WebInspector.TimelinePanel.prototype = {
}
},
/**
* @param {!WebInspector.TracingModel.Event} event
*/
_buildSelectionDetailsForTraceEvent: function(event)
{
var title = WebInspector.TimelineUIUtils.styleForTimelineEvent(event.name).title;
WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, this._tracingTimelineModel, this._detailsLinkifier, this.showInDetails.bind(this, title), false, this._model.target());
},
_updateSelectedRangeStats: function()
{
if (this._selection)
......
......@@ -581,7 +581,7 @@ WebInspector.TimelineView.prototype = {
this._graphRowsElement.appendChild(graphRowElement);
}
listRowElement.row.update(record, visibleTop, this._model.loadedFromFile());
listRowElement.row.update(record, visibleTop, this._model.loadedFromFile(), this._uiUtils);
graphRowElement.row.update(record, this._calculator, this._expandOffset, i);
if (this._lastSelectedRecord === record) {
listRowElement.row.renderAsSelected(true);
......@@ -1048,8 +1048,9 @@ WebInspector.TimelineRecordListRow.prototype = {
* @param {!WebInspector.TimelinePresentationModel.Record} presentationRecord
* @param {number} offset
* @param {boolean} loadedFromFile
* @param {!WebInspector.TimelineUIUtils} uiUtils
*/
update: function(presentationRecord, offset, loadedFromFile)
update: function(presentationRecord, offset, loadedFromFile, uiUtils)
{
this._record = presentationRecord;
var record = presentationRecord.record();
......@@ -1075,9 +1076,7 @@ WebInspector.TimelineRecordListRow.prototype = {
if (presentationRecord.coalesced()) {
this._dataElement.createTextChild(WebInspector.UIString("× %d", presentationRecord.presentationChildren().length));
} else {
var detailsNode = record instanceof WebInspector.TimelineModel.RecordImpl ?
WebInspector.TimelineUIUtils.buildDetailsNode(record, this._linkifier, loadedFromFile) :
WebInspector.TracingTimelineUIUtils.buildDetailsNodeForTraceEvent(record._event, this._linkifier, loadedFromFile, record.target());
var detailsNode = uiUtils.buildDetailsNode(record, this._linkifier, loadedFromFile);
if (detailsNode) {
this._dataElement.appendChild(document.createTextNode("("));
this._dataElement.appendChild(detailsNode);
......
......@@ -463,17 +463,6 @@ WebInspector.TracingTimelineModel.prototype = {
return null;
},
/**
* @param {!WebInspector.TimelineModel.Record} record
* @return {!WebInspector.TracingModel.Event}
*/
traceEventFrom: function(record)
{
if (!(record instanceof WebInspector.TracingTimelineModel.TraceEventRecord))
throw new Error("Illegal argument.");
return record._event;
},
__proto__: WebInspector.TimelineModel.prototype
}
......@@ -544,7 +533,7 @@ WebInspector.TracingTimelineModel.TraceEventRecord.prototype = {
*/
category: function()
{
var style = WebInspector.TimelineUIUtils.styleForTimelineEvent(this._event.name);
var style = WebInspector.TracingTimelineUIUtils.styleForTraceEvent(this._event.name);
return style.category;
},
......@@ -553,7 +542,7 @@ WebInspector.TracingTimelineModel.TraceEventRecord.prototype = {
*/
title: function()
{
return WebInspector.TimelineUIUtils.recordTitle(this, this._model);
return WebInspector.TracingTimelineUIUtils.styleForTraceEvent(this._event.name).title;
},
/**
......
......@@ -57,6 +57,32 @@ WebInspector.TracingTimelineUIUtils.prototype = {
return record.traceEvent().highlightQuad || null;
},
/**
* @param {!WebInspector.TimelineModel.Record} record
* @param {!WebInspector.Linkifier} linkifier
* @param {boolean} loadedFromFile
* @return {?Node}
*/
buildDetailsNode: function(record, linkifier, loadedFromFile)
{
return WebInspector.TracingTimelineUIUtils.buildDetailsNodeForTraceEvent(record.traceEvent(), linkifier, loadedFromFile, record.target());
},
/**
* @param {!WebInspector.TimelineModel.Record} record
* @param {!WebInspector.TimelineModel} model
* @param {!WebInspector.Linkifier} linkifier
* @param {function(!DocumentFragment)} callback
* @param {boolean} loadedFromFile
*/
generateDetailsContent: function(record, model, linkifier, callback, loadedFromFile)
{
if (!(model instanceof WebInspector.TracingTimelineModel))
throw new Error("Illegal argument.");
var tracingTimelineModel = /** @type {!WebInspector.TracingTimelineModel} */ (model);
WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(record.traceEvent(), tracingTimelineModel, linkifier, callback, loadedFromFile, record.target());
},
__proto__: WebInspector.TimelineUIUtils.prototype
}
......
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