Commit 27e3e53b authored by caseq@chromium.org's avatar caseq@chromium.org

DevTools: remove most convenience wrappers from WI.TimelineModel.Record

These were mostly for the convenience of layout tests, rarely used in the
prod code. Let's keep TimelineModel.Record() a thin wrapper that just adds
hierarchy to trace events and keep timeline-specific logic away from it,
since it has to work for bare trace events most of the time.

BUG=

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

git-svn-id: svn://svn.chromium.org/blink/trunk@202020 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent f1367b31
...@@ -283,18 +283,24 @@ InspectorTest.dumpTimelineRecords = function(timelineRecords) ...@@ -283,18 +283,24 @@ InspectorTest.dumpTimelineRecords = function(timelineRecords)
InspectorTest.printTimelineRecordProperties = function(record) InspectorTest.printTimelineRecordProperties = function(record)
{ {
InspectorTest.addResult(record.type() + " Properties:"); InspectorTest.addResult(record.type() + " Properties:");
var object = {}; var traceEvent = record.traceEvent();
var names = ["data", "endTime", "frameId", "stackTrace", "startTime", "thread", "type"]; var data = traceEvent.args["beginData"] || traceEvent.args["data"];
for (var i = 0; i < names.length; i++) { var frameId = data && data["frame"];
var name = names[i]; var object = {
var value = record[name].call(record); data: traceEvent.args["data"] || traceEvent.args,
if (value) endTime: record.endTime(),
object[name] = value; frameId: frameId,
stackTrace: traceEvent.stackTrace,
startTime: record.startTime(),
thread: record.thread(),
type: record.type()
};
for (var field in object) {
if (object[field] === null || object[field] === undefined)
delete object[field];
} }
if (record.children().length) if (record.children().length)
object["children"] = []; object["children"] = [];
if (!record.data())
object["data"] = record.traceEvent().args;
InspectorTest.addObject(object, InspectorTest.timelinePropertyFormatters); InspectorTest.addObject(object, InspectorTest.timelinePropertyFormatters);
}; };
......
...@@ -12,13 +12,14 @@ InspectorTest.dumpStats = function(presentationRecord) ...@@ -12,13 +12,14 @@ InspectorTest.dumpStats = function(presentationRecord)
if (!presentationRecord.presentationParent()) if (!presentationRecord.presentationParent())
return ""; return "";
var model = InspectorTest.timelineModel();
var aggregatedStats = {}; var aggregatedStats = {};
if (presentationRecord.coalesced()) { if (presentationRecord.coalesced()) {
var presentationChildren = presentationRecord.presentationChildren(); var presentationChildren = presentationRecord.presentationChildren();
for (var i = 0; i < presentationChildren.length; ++i) for (var i = 0; i < presentationChildren.length; ++i)
WebInspector.TimelineUIUtils.aggregateTimeForRecord(aggregatedStats, presentationChildren[i].record()); WebInspector.TimelineUIUtils.aggregateTimeForRecord(aggregatedStats, model, presentationChildren[i].record());
} else { } else {
WebInspector.TimelineUIUtils.aggregateTimeForRecord(aggregatedStats, presentationRecord.record()); WebInspector.TimelineUIUtils.aggregateTimeForRecord(aggregatedStats, model, presentationRecord.record());
} }
var timeByCategory = ""; var timeByCategory = "";
......
...@@ -64,7 +64,7 @@ function test() ...@@ -64,7 +64,7 @@ function test()
prefix.push(" "); prefix.push(" ");
} }
var mark = record.expandable() ? (record.collapsed() ? "+" : "-") : " "; var mark = record.expandable() ? (record.collapsed() ? "+" : "-") : " ";
InspectorTest.addResult(prefix.join("") + mark + record.record().data().message); InspectorTest.addResult(prefix.join("") + mark + record.record().traceEvent().args["data"].message);
} }
function dumpRecords() function dumpRecords()
...@@ -87,7 +87,7 @@ function test() ...@@ -87,7 +87,7 @@ function test()
var collapseList = {"bar04":true, "foo13": true}; var collapseList = {"bar04":true, "foo13": true};
for (var i = 0; i < records.length; ++i) { for (var i = 0; i < records.length; ++i) {
var record = records[i]; var record = records[i];
if (collapseList[record.record().data().message]) if (collapseList[record.record().traceEvent().args["data"].message])
record.setCollapsed(true); record.setCollapsed(true);
} }
model.invalidateFilteredRecords(); model.invalidateFilteredRecords();
......
...@@ -31,8 +31,8 @@ function test() ...@@ -31,8 +31,8 @@ function test()
function onTimelineRecorded() function onTimelineRecorded()
{ {
var layoutRecord = InspectorTest.findFirstTimelineRecord("Layout"); var layoutRecord = InspectorTest.findFirstTimelineRecord("Layout");
InspectorTest.addResult("layout invalidated: " + layoutRecord.callSiteStackTrace()[0].functionName); InspectorTest.addResult("layout invalidated: " + layoutRecord.traceEvent().initiator.args["data"]["stackTrace"][0].functionName);
InspectorTest.addResult("layout forced: " + layoutRecord.stackTrace()[0].functionName); InspectorTest.addResult("layout forced: " + layoutRecord.traceEvent().args["beginData"]["stackTrace"][0].functionName);
InspectorTest.completeTest(); InspectorTest.completeTest();
} }
} }
......
...@@ -39,7 +39,8 @@ function test() ...@@ -39,7 +39,8 @@ function test()
InspectorTest.addResult("Script evaluated."); InspectorTest.addResult("Script evaluated.");
var record = InspectorTest.findFirstTimelineRecord("ResourceReceivedData"); var record = InspectorTest.findFirstTimelineRecord("ResourceReceivedData");
if (record) { if (record) {
if (record.data() && typeof record.data().encodedDataLength === "number") var data = record.traceEvent().args["data"];
if (data && typeof data.encodedDataLength === "number")
InspectorTest.addResult("Resource received data has length, test passed."); InspectorTest.addResult("Resource received data has length, test passed.");
} }
InspectorTest.completeTest(); InspectorTest.completeTest();
......
...@@ -59,28 +59,31 @@ function test() ...@@ -59,28 +59,31 @@ function test()
function printSend(record) function printSend(record)
{ {
printRecord(record); printRecord(record);
requestId = record.data().requestId; var data = record.traceEvent().args["data"];
if (record.data().url === undefined) requestId = data.requestId;
if (data.url === undefined)
InspectorTest.addResult("* No 'url' property in record"); InspectorTest.addResult("* No 'url' property in record");
else if (record.data().url.indexOf(scriptUrl) === -1) else if (data.url.indexOf(scriptUrl) === -1)
InspectorTest.addResult("* Didn't find URL: " + scriptUrl); InspectorTest.addResult("* Didn't find URL: " + scriptUrl);
} }
function printReceive(record) function printReceive(record)
{ {
printRecord(record); printRecord(record);
if (requestId !== record.data().requestId) var data = record.traceEvent().args["data"];
if (requestId !== data.requestId)
InspectorTest.addResult("Didn't find matching requestId: " + requestId); InspectorTest.addResult("Didn't find matching requestId: " + requestId);
if (record.data().statusCode !== 0) if (data.statusCode !== 0)
InspectorTest.addResult("Response received status: " + record.data().statusCode); InspectorTest.addResult("Response received status: " + data.statusCode);
} }
function printFinish(record) function printFinish(record)
{ {
printRecord(record); printRecord(record);
if (requestId !== record.data().requestId) var data = record.traceEvent().args["data"];
if (requestId !== data.requestId)
InspectorTest.addResult("Didn't find matching requestId: " + requestId); InspectorTest.addResult("Didn't find matching requestId: " + requestId);
if (record.data().didFail) if (data.didFail)
InspectorTest.addResult("Request failed."); InspectorTest.addResult("Request failed.");
} }
} }
......
...@@ -40,9 +40,9 @@ function test() ...@@ -40,9 +40,9 @@ function test()
{ {
var paintRecord = InspectorTest.findFirstTimelineRecord(WebInspector.TimelineModel.RecordType.Paint); var paintRecord = InspectorTest.findFirstTimelineRecord(WebInspector.TimelineModel.RecordType.Paint);
InspectorTest.assertTrue(paintRecord, "Paint record with subframe paint not found"); InspectorTest.assertTrue(paintRecord, "Paint record with subframe paint not found");
var topQuad = paintRecord.data().clip; var topQuad = paintRecord.traceEvent().args["data"].clip;
var subframePaint = paintRecord.children()[0]; var subframePaint = paintRecord.children()[0];
var subframeQuad = subframePaint.data().clip; var subframeQuad = subframePaint.traceEvent().args["data"].clip;
InspectorTest.assertEquals(8, topQuad.length); InspectorTest.assertEquals(8, topQuad.length);
InspectorTest.assertEquals(8, subframeQuad.length); InspectorTest.assertEquals(8, subframeQuad.length);
InspectorTest.assertGreaterOrEqual(subframeQuad[0], topQuad[0]); InspectorTest.assertGreaterOrEqual(subframeQuad[0], topQuad[0]);
......
...@@ -15,6 +15,7 @@ ParseHTML Properties: ...@@ -15,6 +15,7 @@ ParseHTML Properties:
} }
} }
endTime : <number> endTime : <number>
frameId : <string>
stackTrace : <object> stackTrace : <object>
startTime : <number> startTime : <number>
thread : <string> thread : <string>
...@@ -34,6 +35,7 @@ ParseHTML Properties: ...@@ -34,6 +35,7 @@ ParseHTML Properties:
} }
} }
endTime : <number> endTime : <number>
frameId : <string>
stackTrace : <object> stackTrace : <object>
startTime : <number> startTime : <number>
thread : <string> thread : <string>
......
...@@ -34,7 +34,7 @@ function test() ...@@ -34,7 +34,7 @@ function test()
function formatter(record) function formatter(record)
{ {
if (record.type() === "TimerFire") { if (record.type() === "TimerFire") {
var fnCallSite = record.children()[0].data(); var fnCallSite = record.children()[0].traceEvent().args["data"];
InspectorTest.addResult(record.type() + " " + fnCallSite.scriptName + ":" + fnCallSite.scriptLine); InspectorTest.addResult(record.type() + " " + fnCallSite.scriptName + ":" + fnCallSite.scriptLine);
} }
} }
......
...@@ -47,6 +47,9 @@ WebInspector.TimelineModel = function(tracingModel, recordFilter) ...@@ -47,6 +47,9 @@ WebInspector.TimelineModel = function(tracingModel, recordFilter)
WebInspector.targetManager.observeTargets(this); WebInspector.targetManager.observeTargets(this);
} }
/**
* @enum {string}
*/
WebInspector.TimelineModel.RecordType = { WebInspector.TimelineModel.RecordType = {
Task: "Task", Task: "Task",
Program: "Program", Program: "Program",
...@@ -254,14 +257,11 @@ WebInspector.TimelineModel.VirtualThread.prototype = { ...@@ -254,14 +257,11 @@ WebInspector.TimelineModel.VirtualThread.prototype = {
/** /**
* @constructor * @constructor
* @param {!WebInspector.TimelineModel} model
* @param {!WebInspector.TracingModel.Event} traceEvent * @param {!WebInspector.TracingModel.Event} traceEvent
*/ */
WebInspector.TimelineModel.Record = function(model, traceEvent) WebInspector.TimelineModel.Record = function(traceEvent)
{ {
this._model = model;
this._event = traceEvent; this._event = traceEvent;
traceEvent._timelineRecord = this;
this._children = []; this._children = [];
} }
...@@ -277,24 +277,6 @@ WebInspector.TimelineModel.Record._compareStartTime = function(a, b) ...@@ -277,24 +277,6 @@ WebInspector.TimelineModel.Record._compareStartTime = function(a, b)
} }
WebInspector.TimelineModel.Record.prototype = { WebInspector.TimelineModel.Record.prototype = {
/**
* @return {?Array.<!ConsoleAgent.CallFrame>}
*/
callSiteStackTrace: function()
{
var initiator = this._event.initiator;
return initiator ? initiator.stackTrace : null;
},
/**
* @return {?WebInspector.TimelineModel.Record}
*/
initiator: function()
{
var initiator = this._event.initiator;
return initiator ? initiator._timelineRecord : null;
},
/** /**
* @return {?WebInspector.Target} * @return {?WebInspector.Target}
*/ */
...@@ -305,14 +287,6 @@ WebInspector.TimelineModel.Record.prototype = { ...@@ -305,14 +287,6 @@ WebInspector.TimelineModel.Record.prototype = {
return threadName === WebInspector.TimelineModel.RendererMainThreadName ? WebInspector.targetManager.targets()[0] || null : null; return threadName === WebInspector.TimelineModel.RendererMainThreadName ? WebInspector.targetManager.targets()[0] || null : null;
}, },
/**
* @return {number}
*/
selfTime: function()
{
return this._event.selfTime;
},
/** /**
* @return {!Array.<!WebInspector.TimelineModel.Record>} * @return {!Array.<!WebInspector.TimelineModel.Record>}
*/ */
...@@ -329,72 +303,32 @@ WebInspector.TimelineModel.Record.prototype = { ...@@ -329,72 +303,32 @@ WebInspector.TimelineModel.Record.prototype = {
return this._event.startTime; return this._event.startTime;
}, },
/**
* @return {string}
*/
thread: function()
{
if (this._event.thread.name() === WebInspector.TimelineModel.RendererMainThreadName)
return WebInspector.TimelineModel.MainThreadName;
return this._event.thread.name();
},
/** /**
* @return {number} * @return {number}
*/ */
endTime: function() endTime: function()
{ {
return this._endTime || this._event.endTime || this._event.startTime; return this._event.endTime || this._event.startTime;
},
/**
* @param {number} endTime
*/
setEndTime: function(endTime)
{
this._endTime = endTime;
}, },
/** /**
* @return {!Object} * @return {string}
*/ */
data: function() thread: function()
{ {
return this._event.args["data"]; if (this._event.thread.name() === WebInspector.TimelineModel.RendererMainThreadName)
return WebInspector.TimelineModel.MainThreadName;
return this._event.thread.name();
}, },
/** /**
* @return {string} * @return {!WebInspector.TimelineModel.RecordType}
*/ */
type: function() type: function()
{ {
if (this._event.hasCategory(WebInspector.TracingModel.ConsoleEventCategory)) if (this._event.hasCategory(WebInspector.TracingModel.ConsoleEventCategory))
return WebInspector.TimelineModel.RecordType.ConsoleTime; return WebInspector.TimelineModel.RecordType.ConsoleTime;
return this._event.name; return /** @type !WebInspector.TimelineModel.RecordType */ (this._event.name);
},
/**
* @return {string}
*/
frameId: function()
{
switch (this._event.name) {
case WebInspector.TimelineModel.RecordType.UpdateLayoutTree:
case WebInspector.TimelineModel.RecordType.RecalculateStyles:
case WebInspector.TimelineModel.RecordType.Layout:
return this._event.args["beginData"]["frame"];
default:
var data = this._event.args["data"];
return (data && data["frame"]) || "";
}
},
/**
* @return {?Array.<!ConsoleAgent.CallFrame>}
*/
stackTrace: function()
{
return this._event.stackTrace;
}, },
/** /**
...@@ -419,16 +353,6 @@ WebInspector.TimelineModel.Record.prototype = { ...@@ -419,16 +353,6 @@ WebInspector.TimelineModel.Record.prototype = {
this._event.previewElement = /** @type {?Element} */ (value); this._event.previewElement = /** @type {?Element} */ (value);
}, },
/**
* @return {?Array.<string>}
*/
warnings: function()
{
if (this._event.warning)
return [this._event.warning];
return null;
},
/** /**
* @return {!WebInspector.TracingModel.Event} * @return {!WebInspector.TracingModel.Event}
*/ */
...@@ -445,14 +369,6 @@ WebInspector.TimelineModel.Record.prototype = { ...@@ -445,14 +369,6 @@ WebInspector.TimelineModel.Record.prototype = {
this._children.push(child); this._children.push(child);
child.parent = this; child.parent = this;
}, },
/**
* @return {!WebInspector.TimelineModel}
*/
timelineModel: function()
{
return this._model;
}
} }
/** @typedef {!{page: !Array<!WebInspector.TracingModel.Event>, workers: !Array<!WebInspector.TracingModel.Event>}} */ /** @typedef {!{page: !Array<!WebInspector.TracingModel.Event>, workers: !Array<!WebInspector.TracingModel.Event>}} */
...@@ -937,7 +853,7 @@ WebInspector.TimelineModel.prototype = { ...@@ -937,7 +853,7 @@ WebInspector.TimelineModel.prototype = {
var drawFrameEvent = this._inspectedTargetEvents[i]; var drawFrameEvent = this._inspectedTargetEvents[i];
var firstPaintEvent = new WebInspector.TracingModel.Event(drawFrameEvent.categoriesString, recordTypes.MarkFirstPaint, WebInspector.TracingModel.Phase.Instant, drawFrameEvent.startTime, drawFrameEvent.thread); var firstPaintEvent = new WebInspector.TracingModel.Event(drawFrameEvent.categoriesString, recordTypes.MarkFirstPaint, WebInspector.TracingModel.Phase.Instant, drawFrameEvent.startTime, drawFrameEvent.thread);
this._mainThreadEvents.splice(insertionIndexForObjectInListSortedByFunction(firstPaintEvent, this._mainThreadEvents, WebInspector.TracingModel.Event.compareStartTime), 0, firstPaintEvent); this._mainThreadEvents.splice(insertionIndexForObjectInListSortedByFunction(firstPaintEvent, this._mainThreadEvents, WebInspector.TracingModel.Event.compareStartTime), 0, firstPaintEvent);
var firstPaintRecord = new WebInspector.TimelineModel.Record(this, firstPaintEvent); var firstPaintRecord = new WebInspector.TimelineModel.Record(firstPaintEvent);
this._eventDividerRecords.splice(insertionIndexForObjectInListSortedByFunction(firstPaintRecord, this._eventDividerRecords, WebInspector.TimelineModel.Record._compareStartTime), 0, firstPaintRecord); this._eventDividerRecords.splice(insertionIndexForObjectInListSortedByFunction(firstPaintRecord, this._eventDividerRecords, WebInspector.TimelineModel.Record._compareStartTime), 0, firstPaintRecord);
}, },
...@@ -975,7 +891,7 @@ WebInspector.TimelineModel.prototype = { ...@@ -975,7 +891,7 @@ WebInspector.TimelineModel.prototype = {
var recordTypes = WebInspector.TimelineModel.RecordType; var recordTypes = WebInspector.TimelineModel.RecordType;
for (var i = 0; i < events.length; ++i) { for (var i = 0; i < events.length; ++i) {
if (events[i].name === recordTypes.GPUTask) if (events[i].name === recordTypes.GPUTask)
this._gpuTasks.push(new WebInspector.TimelineModel.Record(this, events[i])); this._gpuTasks.push(new WebInspector.TimelineModel.Record(events[i]));
} }
}, },
...@@ -998,7 +914,7 @@ WebInspector.TimelineModel.prototype = { ...@@ -998,7 +914,7 @@ WebInspector.TimelineModel.prototype = {
// Maintain the back-end logic of old timeline, skip console.time() / console.timeEnd() that are not properly nested. // Maintain the back-end logic of old timeline, skip console.time() / console.timeEnd() that are not properly nested.
if (WebInspector.TracingModel.isAsyncBeginPhase(event.phase) && parentRecord && event.endTime > parentRecord._event.endTime) if (WebInspector.TracingModel.isAsyncBeginPhase(event.phase) && parentRecord && event.endTime > parentRecord._event.endTime)
continue; continue;
var record = new WebInspector.TimelineModel.Record(this, event); var record = new WebInspector.TimelineModel.Record(event);
if (WebInspector.TimelineUIUtils.isMarkerEvent(event)) if (WebInspector.TimelineUIUtils.isMarkerEvent(event))
this._eventDividerRecords.push(record); this._eventDividerRecords.push(record);
if (!this._recordFilter.accept(record) && !WebInspector.TracingModel.isTopLevelEvent(event)) if (!this._recordFilter.accept(record) && !WebInspector.TracingModel.isTopLevelEvent(event))
......
...@@ -877,10 +877,11 @@ WebInspector.TimelinePanel.prototype = { ...@@ -877,10 +877,11 @@ WebInspector.TimelinePanel.prototype = {
{ {
var markers = new Map(); var markers = new Map();
var recordTypes = WebInspector.TimelineModel.RecordType; var recordTypes = WebInspector.TimelineModel.RecordType;
var zeroTime = this._model.minimumRecordTime();
for (var record of this._model.eventDividerRecords()) { for (var record of this._model.eventDividerRecords()) {
if (record.type() === recordTypes.TimeStamp || record.type() === recordTypes.ConsoleTime) if (record.type() === recordTypes.TimeStamp || record.type() === recordTypes.ConsoleTime)
continue; continue;
markers.set(record.startTime(), WebInspector.TimelineUIUtils.createDividerForRecord(record, 0)); markers.set(record.startTime(), WebInspector.TimelineUIUtils.createDividerForRecord(record, zeroTime, 0));
} }
this._overviewPane.setMarkers(markers); this._overviewPane.setMarkers(markers);
}, },
......
...@@ -477,7 +477,7 @@ WebInspector.TimelinePresentationModel.ActualRecord.prototype = { ...@@ -477,7 +477,7 @@ WebInspector.TimelinePresentationModel.ActualRecord.prototype = {
*/ */
selfTime: function() selfTime: function()
{ {
return this._record.selfTime(); return this._record.traceEvent().selfTime;
}, },
/** /**
...@@ -495,7 +495,7 @@ WebInspector.TimelinePresentationModel.ActualRecord.prototype = { ...@@ -495,7 +495,7 @@ WebInspector.TimelinePresentationModel.ActualRecord.prototype = {
*/ */
hasWarnings: function() hasWarnings: function()
{ {
return !!this._record.warnings(); return !!this._record.traceEvent().warning;
}, },
__proto__: WebInspector.TimelinePresentationModel.Record.prototype __proto__: WebInspector.TimelinePresentationModel.Record.prototype
......
...@@ -1134,13 +1134,12 @@ WebInspector.TimelineUIUtils.InvalidationsGroupElement.prototype = { ...@@ -1134,13 +1134,12 @@ WebInspector.TimelineUIUtils.InvalidationsGroupElement.prototype = {
/** /**
* @param {!Object} total * @param {!Object} total
* @param {!WebInspector.TimelineModel} model
* @param {!WebInspector.TimelineModel.Record} record * @param {!WebInspector.TimelineModel.Record} record
*/ */
WebInspector.TimelineUIUtils.aggregateTimeForRecord = function(total, record) WebInspector.TimelineUIUtils.aggregateTimeForRecord = function(total, model, record)
{ {
var traceEvent = record.traceEvent(); WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent(total, model, record.traceEvent());
var model = record.timelineModel();
WebInspector.TimelineUIUtils._aggregatedStatsForTraceEvent(total, model, traceEvent);
} }
/** /**
...@@ -1243,7 +1242,7 @@ WebInspector.TimelineUIUtils.buildPicturePreviewContent = function(event, target ...@@ -1243,7 +1242,7 @@ WebInspector.TimelineUIUtils.buildPicturePreviewContent = function(event, target
} }
/** /**
* @param {string} recordType * @param {!WebInspector.TimelineModel.RecordType} recordType
* @param {?string} title * @param {?string} title
* @param {number} position * @param {number} position
* @return {!Element} * @return {!Element}
...@@ -1273,12 +1272,13 @@ WebInspector.TimelineUIUtils.createEventDivider = function(recordType, title, po ...@@ -1273,12 +1272,13 @@ WebInspector.TimelineUIUtils.createEventDivider = function(recordType, title, po
/** /**
* @param {!WebInspector.TimelineModel.Record} record * @param {!WebInspector.TimelineModel.Record} record
* @param {number} zeroTime
* @param {number} position * @param {number} position
* @return {!Element} * @return {!Element}
*/ */
WebInspector.TimelineUIUtils.createDividerForRecord = function(record, position) WebInspector.TimelineUIUtils.createDividerForRecord = function(record, zeroTime, position)
{ {
var startTime = Number.millisToString(record.startTime() - record.timelineModel().minimumRecordTime()); var startTime = Number.millisToString(record.startTime() - zeroTime);
var title = WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.eventTitle(record.traceEvent()), startTime); var title = WebInspector.UIString("%s at %s", WebInspector.TimelineUIUtils.eventTitle(record.traceEvent()), startTime);
return WebInspector.TimelineUIUtils.createEventDivider(record.type(), title, position); return WebInspector.TimelineUIUtils.createEventDivider(record.type(), title, position);
} }
......
...@@ -139,7 +139,7 @@ WebInspector.TimelineView.prototype = { ...@@ -139,7 +139,7 @@ WebInspector.TimelineView.prototype = {
var dividerPosition = Math.round(position); var dividerPosition = Math.round(position);
if (dividerPosition < 0 || dividerPosition >= clientWidth || dividers.has(dividerPosition)) if (dividerPosition < 0 || dividerPosition >= clientWidth || dividers.has(dividerPosition))
continue; continue;
dividers.set(dividerPosition, WebInspector.TimelineUIUtils.createDividerForRecord(record, dividerPosition)); dividers.set(dividerPosition, WebInspector.TimelineUIUtils.createDividerForRecord(record, this._calculator.zeroTime(), dividerPosition));
} }
this._timelineGrid.addEventDividers(dividers.valuesArray()); this._timelineGrid.addEventDividers(dividers.valuesArray());
}, },
...@@ -333,7 +333,7 @@ WebInspector.TimelineView.prototype = { ...@@ -333,7 +333,7 @@ WebInspector.TimelineView.prototype = {
var aggregatedStats = {}; var aggregatedStats = {};
var presentationChildren = presentationRecord.presentationChildren(); var presentationChildren = presentationRecord.presentationChildren();
for (var i = 0; i < presentationChildren.length; ++i) for (var i = 0; i < presentationChildren.length; ++i)
WebInspector.TimelineUIUtils.aggregateTimeForRecord(aggregatedStats, presentationChildren[i].record()); WebInspector.TimelineUIUtils.aggregateTimeForRecord(aggregatedStats, this._model, presentationChildren[i].record());
var idle = presentationRecord.endTime() - presentationRecord.startTime(); var idle = presentationRecord.endTime() - presentationRecord.startTime();
for (var category in aggregatedStats) for (var category in aggregatedStats)
idle -= aggregatedStats[category]; idle -= aggregatedStats[category];
...@@ -658,13 +658,15 @@ WebInspector.TimelineView.prototype = { ...@@ -658,13 +658,15 @@ WebInspector.TimelineView.prototype = {
if (task.startTime() > endTime) if (task.startTime() > endTime)
break; break;
var data = task.traceEvent().args["data"];
var foreign = data && data["foreign"];
var left = Math.max(0, this._calculator.computePosition(task.startTime()) + barOffset - widthAdjustment); var left = Math.max(0, this._calculator.computePosition(task.startTime()) + barOffset - widthAdjustment);
var right = Math.min(width, this._calculator.computePosition(task.endTime() || 0) + barOffset + widthAdjustment); var right = Math.min(width, this._calculator.computePosition(task.endTime() || 0) + barOffset + widthAdjustment);
if (lastElement) { if (lastElement) {
var gap = Math.floor(left) - Math.ceil(lastRight); var gap = Math.floor(left) - Math.ceil(lastRight);
if (gap < minGap) { if (gap < minGap) {
if (!task.data["foreign"]) if (!foreign)
lastElement.classList.remove(foreignStyle); lastElement.classList.remove(foreignStyle);
lastRight = right; lastRight = right;
lastElement._tasksInfo.lastTaskIndex = taskIndex; lastElement._tasksInfo.lastTaskIndex = taskIndex;
...@@ -677,7 +679,7 @@ WebInspector.TimelineView.prototype = { ...@@ -677,7 +679,7 @@ WebInspector.TimelineView.prototype = {
element = container.createChild("div", "timeline-graph-bar"); element = container.createChild("div", "timeline-graph-bar");
element.style.left = left + "px"; element.style.left = left + "px";
element._tasksInfo = {name: name, tasks: tasks, firstTaskIndex: taskIndex, lastTaskIndex: taskIndex}; element._tasksInfo = {name: name, tasks: tasks, firstTaskIndex: taskIndex, lastTaskIndex: taskIndex};
if (task.data["foreign"]) if (foreign)
element.classList.add(foreignStyle); element.classList.add(foreignStyle);
lastLeft = left; lastLeft = left;
lastRight = right; lastRight = right;
......
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