Commit 7d60ac92 authored by yurys@chromium.org's avatar yurys@chromium.org

Don't create TimelineModel.RecordImpl in TimelinePresentationModel.js

TimelinePresentationModel.Record now has three implementations: one for root record, one for coealesced record and one for representing actual TimelineModel.Record. This allows it to work fine with Timeline based on trace events.

BUG=361045
R=caseq@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176205 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent e09741d1
...@@ -207,7 +207,7 @@ InspectorTest.dumpTimelineRecord = function(record, detailsCallback, level, filt ...@@ -207,7 +207,7 @@ InspectorTest.dumpTimelineRecord = function(record, detailsCallback, level, filt
// Dump just the record name, indenting output on separate lines for subrecords // Dump just the record name, indenting output on separate lines for subrecords
InspectorTest.dumpPresentationRecord = function(presentationRecord, detailsCallback, level, filterTypes) InspectorTest.dumpPresentationRecord = function(presentationRecord, detailsCallback, level, filterTypes)
{ {
var record = presentationRecord.record(); var record = !presentationRecord.presentationParent() ? null : presentationRecord.record();
if (typeof level !== "number") if (typeof level !== "number")
level = 0; level = 0;
var prefix = ""; var prefix = "";
...@@ -218,13 +218,14 @@ InspectorTest.dumpPresentationRecord = function(presentationRecord, detailsCallb ...@@ -218,13 +218,14 @@ InspectorTest.dumpPresentationRecord = function(presentationRecord, detailsCallb
prefix = prefix + "> "; prefix = prefix + "> ";
if (presentationRecord.coalesced()) { if (presentationRecord.coalesced()) {
suffix = " x " + presentationRecord.presentationChildren().length; suffix = " x " + presentationRecord.presentationChildren().length;
} else if (record.type() === WebInspector.TimelineModel.RecordType.TimeStamp } else if (record && (record.type() === WebInspector.TimelineModel.RecordType.TimeStamp
|| record.type() === WebInspector.TimelineModel.RecordType.ConsoleTime) { || record.type() === WebInspector.TimelineModel.RecordType.ConsoleTime)) {
suffix = " : " + record.data().message; suffix = " : " + record.data().message;
} }
if (detailsCallback) if (detailsCallback)
suffix += " " + detailsCallback(record); suffix += " " + detailsCallback(presentationRecord);
InspectorTest.addResult(prefix + InspectorTest._timelineAgentTypeToString(record.type()) + suffix); var typeString = record ? InspectorTest._timelineAgentTypeToString(record.type()) : "Root";
InspectorTest.addResult(prefix + typeString + suffix);
var numChildren = presentationRecord.presentationChildren() ? presentationRecord.presentationChildren().length : 0; var numChildren = presentationRecord.presentationChildren() ? presentationRecord.presentationChildren().length : 0;
for (var i = 0; i < numChildren; ++i) { for (var i = 0; i < numChildren; ++i) {
......
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
function initialize_TimelineCoalescing() function initialize_TimelineCoalescing()
{ {
InspectorTest.dumpStats = function(record) InspectorTest.dumpStats = function(presentationRecord)
{ {
if (record.type() === "Root") if (!presentationRecord.presentationParent())
return ""; return "";
var aggregatedStats = record.aggregatedStats(); var aggregatedStats = presentationRecord.presentationAggregatedStats();
var timeByCategory = ""; var timeByCategory = "";
for (category in aggregatedStats) { for (category in aggregatedStats) {
...@@ -19,8 +19,8 @@ InspectorTest.dumpStats = function(record) ...@@ -19,8 +19,8 @@ InspectorTest.dumpStats = function(record)
timeByCategory += ", "; timeByCategory += ", ";
timeByCategory += category + ": " + aggregatedStats[category].toFixed(5); timeByCategory += category + ": " + aggregatedStats[category].toFixed(5);
} }
var duration = (record.endTime() - record.startTime()).toFixed(5); var duration = (presentationRecord.endTime() - presentationRecord.startTime()).toFixed(5);
var durationTillLastChild = (record.endTime() - record.startTime()).toFixed(5); var durationTillLastChild = (presentationRecord.endTime() - presentationRecord.startTime()).toFixed(5);
return "duration: " + duration + ":" + durationTillLastChild + (timeByCategory ? " (" + timeByCategory + ")" : ""); return "duration: " + duration + ":" + durationTillLastChild + (timeByCategory ? " (" + timeByCategory + ")" : "");
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
* @constructor * @constructor
* @implements {WebInspector.FlameChartDataProvider} * @implements {WebInspector.FlameChartDataProvider}
* @implements {WebInspector.TimelineFlameChart.SelectionProvider} * @implements {WebInspector.TimelineFlameChart.SelectionProvider}
* @param {!WebInspector.TimelineModel} model * @param {!WebInspector.TimelineModelImpl} model
* @param {!WebInspector.TimelineFrameModelBase} frameModel * @param {!WebInspector.TimelineFrameModelBase} frameModel
*/ */
WebInspector.TimelineFlameChartDataProvider = function(model, frameModel) WebInspector.TimelineFlameChartDataProvider = function(model, frameModel)
...@@ -816,7 +816,7 @@ WebInspector.TimelineFlameChart = function(delegate, model, tracingModel, frameM ...@@ -816,7 +816,7 @@ WebInspector.TimelineFlameChart = function(delegate, model, tracingModel, frameM
this._model = model; this._model = model;
this._dataProvider = tracingModel this._dataProvider = tracingModel
? new WebInspector.TracingBasedTimelineFlameChartDataProvider(tracingModel, frameModel, model.target()) ? new WebInspector.TracingBasedTimelineFlameChartDataProvider(tracingModel, frameModel, model.target())
: new WebInspector.TimelineFlameChartDataProvider(model, frameModel); : new WebInspector.TimelineFlameChartDataProvider(/** @type {!WebInspector.TimelineModelImpl} */(model), frameModel);
this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true); this._mainView = new WebInspector.FlameChart(this._dataProvider, this, true);
this._mainView.show(this.element); this._mainView.show(this.element);
this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStarted, this._onRecordingStarted, this); this._model.addEventListener(WebInspector.TimelineModel.Events.RecordingStarted, this._onRecordingStarted, this);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
WebInspector.TimelineJSProfileProcessor = { }; WebInspector.TimelineJSProfileProcessor = { };
/** /**
* @param {!WebInspector.TimelineModel} timelineModel * @param {!WebInspector.TimelineModelImpl} timelineModel
* @param {!ProfilerAgent.CPUProfile} jsProfile * @param {!ProfilerAgent.CPUProfile} jsProfile
*/ */
WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline = function(timelineModel, jsProfile) WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline = function(timelineModel, jsProfile)
......
...@@ -164,7 +164,6 @@ WebInspector.TimelineModelImpl.prototype = { ...@@ -164,7 +164,6 @@ WebInspector.TimelineModelImpl.prototype = {
* @param {!TimelineAgent.TimelineEvent} payload * @param {!TimelineAgent.TimelineEvent} payload
* @param {?WebInspector.TimelineModel.Record} parentRecord * @param {?WebInspector.TimelineModel.Record} parentRecord
* @return {!WebInspector.TimelineModel.Record} * @return {!WebInspector.TimelineModel.Record}
* @this {!WebInspector.TimelineModel}
*/ */
_innerAddRecord: function(payload, parentRecord) _innerAddRecord: function(payload, parentRecord)
{ {
...@@ -292,7 +291,7 @@ WebInspector.TimelineModelImpl.InterRecordBindings.prototype = { ...@@ -292,7 +291,7 @@ WebInspector.TimelineModelImpl.InterRecordBindings.prototype = {
/** /**
* @constructor * @constructor
* @implements {WebInspector.TimelineModel.Record} * @implements {WebInspector.TimelineModel.Record}
* @param {!WebInspector.TimelineModel} model * @param {!WebInspector.TimelineModelImpl} model
* @param {!TimelineAgent.TimelineEvent} timelineEvent * @param {!TimelineAgent.TimelineEvent} timelineEvent
* @param {?WebInspector.TimelineModel.Record} parentRecord * @param {?WebInspector.TimelineModel.Record} parentRecord
*/ */
......
...@@ -83,9 +83,7 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -83,9 +83,7 @@ WebInspector.TimelinePresentationModel.prototype = {
reset: function() reset: function()
{ {
this._recordToPresentationRecord.clear(); this._recordToPresentationRecord.clear();
var rootPayload = { type: WebInspector.TimelineModel.RecordType.Root }; this._rootRecord = new WebInspector.TimelinePresentationModel.RootRecord();
var rootRecord = new WebInspector.TimelineModel.RecordImpl(this._model, /** @type {!TimelineAgent.TimelineEvent} */ (rootPayload), null);
this._rootRecord = new WebInspector.TimelinePresentationModel.Record(rootRecord, null);
/** @type {!Object.<string, !WebInspector.TimelinePresentationModel.Record>} */ /** @type {!Object.<string, !WebInspector.TimelinePresentationModel.Record>} */
this._coalescingBuckets = {}; this._coalescingBuckets = {};
}, },
...@@ -120,7 +118,7 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -120,7 +118,7 @@ WebInspector.TimelinePresentationModel.prototype = {
if (coalescedRecord) if (coalescedRecord)
parentRecord = coalescedRecord; parentRecord = coalescedRecord;
var formattedRecord = new WebInspector.TimelinePresentationModel.Record(record, parentRecord); var formattedRecord = new WebInspector.TimelinePresentationModel.ActualRecord(record, parentRecord);
this._recordToPresentationRecord.put(record, formattedRecord); this._recordToPresentationRecord.put(record, formattedRecord);
formattedRecord._collapsed = parentRecord === this._rootRecord; formattedRecord._collapsed = parentRecord === this._rootRecord;
...@@ -130,7 +128,7 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -130,7 +128,7 @@ WebInspector.TimelinePresentationModel.prototype = {
for (var i = 0; record.children() && i < record.children().length; ++i) for (var i = 0; record.children() && i < record.children().length; ++i)
this._innerAddRecord(formattedRecord, record.children()[i]); this._innerAddRecord(formattedRecord, record.children()[i]);
if (parentRecord._coalesced) if (parentRecord.coalesced())
this._updateCoalescingParent(formattedRecord); this._updateCoalescingParent(formattedRecord);
}, },
...@@ -145,7 +143,7 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -145,7 +143,7 @@ WebInspector.TimelinePresentationModel.prototype = {
const coalescingThresholdMillis = 5; const coalescingThresholdMillis = 5;
var lastRecord = bucket ? this._coalescingBuckets[bucket] : newParent._presentationChildren.peekLast(); var lastRecord = bucket ? this._coalescingBuckets[bucket] : newParent._presentationChildren.peekLast();
if (lastRecord && lastRecord._coalesced) if (lastRecord && lastRecord.coalesced())
lastRecord = lastRecord._presentationChildren.peekLast(); lastRecord = lastRecord._presentationChildren.peekLast();
var startTime = record.startTime(); var startTime = record.startTime();
var endTime = record.endTime(); var endTime = record.endTime();
...@@ -159,7 +157,7 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -159,7 +157,7 @@ WebInspector.TimelinePresentationModel.prototype = {
return null; return null;
if (endTime + coalescingThresholdMillis < lastRecord.record().startTime()) if (endTime + coalescingThresholdMillis < lastRecord.record().startTime())
return null; return null;
if (lastRecord.presentationParent()._coalesced) if (lastRecord.presentationParent().coalesced())
return lastRecord.presentationParent(); return lastRecord.presentationParent();
return this._replaceWithCoalescedRecord(lastRecord); return this._replaceWithCoalescedRecord(lastRecord);
}, },
...@@ -171,21 +169,9 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -171,21 +169,9 @@ WebInspector.TimelinePresentationModel.prototype = {
_replaceWithCoalescedRecord: function(presentationRecord) _replaceWithCoalescedRecord: function(presentationRecord)
{ {
var record = presentationRecord.record(); var record = presentationRecord.record();
var rawRecord = {
type: record.type(),
startTime: record.startTime(),
data: { }
};
if (record.thread())
rawRecord.thread = "aggregated";
if (record.type() === WebInspector.TimelineModel.RecordType.TimeStamp)
rawRecord.data["message"] = record.data().message;
var modelRecord = new WebInspector.TimelineModel.RecordImpl(this._model, /** @type {!TimelineAgent.TimelineEvent} */ (rawRecord), null);
var coalescedRecord = new WebInspector.TimelinePresentationModel.Record(modelRecord, null);
var parent = presentationRecord._presentationParent; var parent = presentationRecord._presentationParent;
var coalescedRecord = new WebInspector.TimelinePresentationModel.CoalescedRecord(record);
coalescedRecord._coalesced = true;
coalescedRecord._collapsed = true; coalescedRecord._collapsed = true;
coalescedRecord._presentationChildren.push(presentationRecord); coalescedRecord._presentationChildren.push(presentationRecord);
presentationRecord._presentationParent = coalescedRecord; presentationRecord._presentationParent = coalescedRecord;
...@@ -194,7 +180,7 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -194,7 +180,7 @@ WebInspector.TimelinePresentationModel.prototype = {
coalescedRecord._presentationParent = parent; coalescedRecord._presentationParent = parent;
parent._presentationChildren[parent._presentationChildren.indexOf(presentationRecord)] = coalescedRecord; parent._presentationChildren[parent._presentationChildren.indexOf(presentationRecord)] = coalescedRecord;
WebInspector.TimelineUIUtils.aggregateTimeByCategory(modelRecord.aggregatedStats(), record.aggregatedStats()); WebInspector.TimelineUIUtils.aggregateTimeByCategory(coalescedRecord.presentationAggregatedStats(), presentationRecord.presentationAggregatedStats());
return coalescedRecord; return coalescedRecord;
}, },
...@@ -204,11 +190,10 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -204,11 +190,10 @@ WebInspector.TimelinePresentationModel.prototype = {
*/ */
_updateCoalescingParent: function(presentationRecord) _updateCoalescingParent: function(presentationRecord)
{ {
var record = presentationRecord.record(); var parentRecord = presentationRecord._presentationParent;
var parentRecord = presentationRecord._presentationParent.record(); WebInspector.TimelineUIUtils.aggregateTimeByCategory(parentRecord.presentationAggregatedStats(), presentationRecord.presentationAggregatedStats());
WebInspector.TimelineUIUtils.aggregateTimeByCategory(parentRecord.aggregatedStats(), record.aggregatedStats()); if (parentRecord.endTime() < presentationRecord.endTime())
if (parentRecord.endTime() < record.endTime()) parentRecord._endTime = presentationRecord.endTime();
parentRecord.setEndTime(record.endTime());
}, },
/** /**
...@@ -257,9 +242,8 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -257,9 +242,8 @@ WebInspector.TimelinePresentationModel.prototype = {
if (records && entry.index < records.length) { if (records && entry.index < records.length) {
var record = records[entry.index]; var record = records[entry.index];
++entry.index; ++entry.index;
var rawRecord = record.record(); if (record.startTime() < this._windowEndTime && record.endTime() > this._windowStartTime) {
if (rawRecord.startTime() < this._windowEndTime && rawRecord.endTime() > this._windowStartTime) { if (this._model.isVisible(record.record())) {
if (this._model.isVisible(rawRecord)) {
record._presentationParent._expandable = true; record._presentationParent._expandable = true;
if (this._textFilter) if (this._textFilter)
revealRecordsInStack(); revealRecordsInStack();
...@@ -294,12 +278,10 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -294,12 +278,10 @@ WebInspector.TimelinePresentationModel.prototype = {
/** /**
* @constructor * @constructor
* @param {!WebInspector.TimelineModel.Record} record
* @param {?WebInspector.TimelinePresentationModel.Record} parentRecord * @param {?WebInspector.TimelinePresentationModel.Record} parentRecord
*/ */
WebInspector.TimelinePresentationModel.Record = function(record, parentRecord) WebInspector.TimelinePresentationModel.Record = function(parentRecord)
{ {
this._record = record;
/** /**
* @type {!Array.<!WebInspector.TimelinePresentationModel.Record>} * @type {!Array.<!WebInspector.TimelinePresentationModel.Record>}
*/ */
...@@ -309,20 +291,47 @@ WebInspector.TimelinePresentationModel.Record = function(record, parentRecord) ...@@ -309,20 +291,47 @@ WebInspector.TimelinePresentationModel.Record = function(record, parentRecord)
this._presentationParent = parentRecord; this._presentationParent = parentRecord;
parentRecord._presentationChildren.push(this); parentRecord._presentationChildren.push(this);
} }
if (this.hasWarnings()) {
for (var parent = this._presentationParent; parent && !parent._childHasWarnings; parent = parent._presentationParent)
parent._childHasWarnings = true;
}
} }
WebInspector.TimelinePresentationModel.Record.prototype = { WebInspector.TimelinePresentationModel.Record.prototype = {
/**
* @return {number}
*/
startTime: function()
{
throw new Error("Not implemented.");
},
/**
* @return {number}
*/
endTime: function()
{
throw new Error("Not implemented.");
},
/**
* @return {number}
*/
selfTime: function()
{
throw new Error("Not implemented.");
},
/** /**
* @return {!WebInspector.TimelineModel.Record} * @return {!WebInspector.TimelineModel.Record}
*/ */
record: function() record: function()
{ {
return this._record; throw new Error("Not implemented.");
},
/**
* @return {!Object.<string, number>}
*/
presentationAggregatedStats: function()
{
throw new Error("Not implemented.");
}, },
/** /**
...@@ -338,7 +347,7 @@ WebInspector.TimelinePresentationModel.Record.prototype = { ...@@ -338,7 +347,7 @@ WebInspector.TimelinePresentationModel.Record.prototype = {
*/ */
coalesced: function() coalesced: function()
{ {
return this._coalesced; return false;
}, },
/** /**
...@@ -387,7 +396,7 @@ WebInspector.TimelinePresentationModel.Record.prototype = { ...@@ -387,7 +396,7 @@ WebInspector.TimelinePresentationModel.Record.prototype = {
*/ */
hasWarnings: function() hasWarnings: function()
{ {
return !!this._record.warnings(); return false;
}, },
/** /**
...@@ -430,3 +439,175 @@ WebInspector.TimelinePresentationModel.Record.prototype = { ...@@ -430,3 +439,175 @@ WebInspector.TimelinePresentationModel.Record.prototype = {
this._graphRow = graphRow; this._graphRow = graphRow;
} }
} }
/**
* @constructor
* @extends {WebInspector.TimelinePresentationModel.Record}
* @param {!WebInspector.TimelineModel.Record} record
* @param {?WebInspector.TimelinePresentationModel.Record} parentRecord
*/
WebInspector.TimelinePresentationModel.ActualRecord = function(record, parentRecord)
{
WebInspector.TimelinePresentationModel.Record.call(this, parentRecord);
this._record = record;
if (this.hasWarnings()) {
for (var parent = this._presentationParent; parent && !parent._childHasWarnings; parent = parent._presentationParent)
parent._childHasWarnings = true;
}
}
WebInspector.TimelinePresentationModel.ActualRecord.prototype = {
/**
* @return {number}
*/
startTime: function()
{
return this._record.startTime();
},
/**
* @return {number}
*/
endTime: function()
{
return this._record.endTime();
},
/**
* @return {number}
*/
selfTime: function()
{
return this._record.selfTime();
},
/**
* @return {!WebInspector.TimelineModel.Record}
*/
record: function()
{
return this._record;
},
/**
* @return {!Object.<string, number>}
*/
presentationAggregatedStats: function()
{
return this._record.aggregatedStats();
},
/**
* @return {boolean}
*/
hasWarnings: function()
{
return !!this._record.warnings();
},
__proto__: WebInspector.TimelinePresentationModel.Record.prototype
}
/**
* @constructor
* @extends {WebInspector.TimelinePresentationModel.Record}
* @param {!WebInspector.TimelineModel.Record} record
*/
WebInspector.TimelinePresentationModel.CoalescedRecord = function(record)
{
WebInspector.TimelinePresentationModel.Record.call(this, null);
this._startTime = record.startTime();
this._endTime = record.endTime();
this._aggregatedStats = {};
}
WebInspector.TimelinePresentationModel.CoalescedRecord.prototype = {
/**
* @return {number}
*/
startTime: function()
{
return this._startTime;
},
/**
* @return {number}
*/
endTime: function()
{
return this._endTime;
},
/**
* @return {number}
*/
selfTime: function()
{
return 0;
},
/**
* @return {!WebInspector.TimelineModel.Record}
*/
record: function()
{
return this._presentationChildren[0].record();
},
/**
* @return {!Object.<string, number>}
*/
presentationAggregatedStats: function()
{
return this._aggregatedStats;
},
/**
* @return {boolean}
*/
coalesced: function()
{
return true;
},
/**
* @return {boolean}
*/
hasWarnings: function()
{
return false;
},
__proto__: WebInspector.TimelinePresentationModel.Record.prototype
}
/**
* @constructor
* @extends {WebInspector.TimelinePresentationModel.Record}
*/
WebInspector.TimelinePresentationModel.RootRecord = function()
{
WebInspector.TimelinePresentationModel.Record.call(this, null);
this._aggregatedStats = {};
}
WebInspector.TimelinePresentationModel.RootRecord.prototype = {
/**
* @return {!Object.<string, number>}
*/
presentationAggregatedStats: function()
{
return this._aggregatedStats;
},
/**
* @return {boolean}
*/
hasWarnings: function()
{
return false;
},
__proto__: WebInspector.TimelinePresentationModel.Record.prototype
}
...@@ -129,8 +129,8 @@ WebInspector.TimelineView.prototype = { ...@@ -129,8 +129,8 @@ WebInspector.TimelineView.prototype = {
for (var i = 0; i < eventDividerRecords.length; ++i) { for (var i = 0; i < eventDividerRecords.length; ++i) {
var record = eventDividerRecords[i]; var record = eventDividerRecords[i];
var positions = this._calculator.computeBarGraphWindowPosition(record); var position = this._calculator.computePosition(record.startTime());
var dividerPosition = Math.round(positions.left); var dividerPosition = Math.round(position);
if (dividerPosition < 0 || dividerPosition >= clientWidth || dividers[dividerPosition]) if (dividerPosition < 0 || dividerPosition >= clientWidth || dividers[dividerPosition])
continue; continue;
var divider = WebInspector.TimelineUIUtils.createEventDivider(record.type(), WebInspector.TimelineUIUtils.recordTitle(record, this._model)); var divider = WebInspector.TimelineUIUtils.createEventDivider(record.type(), WebInspector.TimelineUIUtils.recordTitle(record, this._model));
...@@ -531,8 +531,8 @@ WebInspector.TimelineView.prototype = { ...@@ -531,8 +531,8 @@ WebInspector.TimelineView.prototype = {
this._automaticallySizeWindow = false; this._automaticallySizeWindow = false;
this._clearSelection(); this._clearSelection();
// If we're at the top, always use real timeline start as a left window bound so that expansion arrow padding logic works. // If we're at the top, always use real timeline start as a left window bound so that expansion arrow padding logic works.
var windowStartTime = startIndex ? recordsInWindow[startIndex].record().startTime() : this._model.minimumRecordTime(); var windowStartTime = startIndex ? recordsInWindow[startIndex].startTime() : this._model.minimumRecordTime();
var windowEndTime = recordsInWindow[Math.max(0, lastVisibleLine - 1)].record().endTime(); var windowEndTime = recordsInWindow[Math.max(0, lastVisibleLine - 1)].endTime();
this._delegate.requestWindowTimes(windowStartTime, windowEndTime); this._delegate.requestWindowTimes(windowStartTime, windowEndTime);
recordsInWindow = this._presentationModel.filteredRecords(); recordsInWindow = this._presentationModel.filteredRecords();
endIndex = Math.min(recordsInWindow.length, lastVisibleLine); endIndex = Math.min(recordsInWindow.length, lastVisibleLine);
...@@ -566,7 +566,7 @@ WebInspector.TimelineView.prototype = { ...@@ -566,7 +566,7 @@ WebInspector.TimelineView.prototype = {
var lastChildIndex = i + record.visibleChildrenCount(); var lastChildIndex = i + record.visibleChildrenCount();
if (lastChildIndex >= startIndex && lastChildIndex < endIndex) { if (lastChildIndex >= startIndex && lastChildIndex < endIndex) {
var expandElement = new WebInspector.TimelineExpandableElement(this._expandElements); var expandElement = new WebInspector.TimelineExpandableElement(this._expandElements);
var positions = this._calculator.computeBarGraphWindowPosition(record.record()); var positions = this._calculator.computeBarGraphWindowPosition(record);
expandElement._update(record, i, positions.left - this._expandOffset, positions.width); expandElement._update(record, i, positions.left - this._expandOffset, positions.width);
} }
} else { } else {
...@@ -824,7 +824,10 @@ WebInspector.TimelineView.prototype = { ...@@ -824,7 +824,10 @@ WebInspector.TimelineView.prototype = {
{ {
if (!rowElement || !rowElement.row) if (!rowElement || !rowElement.row)
return false; return false;
var record = rowElement.row._record.record(); var presentationRecord = rowElement.row._record;
if (presentationRecord.collapsed())
return false;
var record = presentationRecord.record();
if (this._highlightedQuadRecord === record) if (this._highlightedQuadRecord === record)
return true; return true;
this._highlightedQuadRecord = record; this._highlightedQuadRecord = record;
...@@ -920,7 +923,7 @@ WebInspector.TimelineCalculator.prototype = { ...@@ -920,7 +923,7 @@ WebInspector.TimelineCalculator.prototype = {
}, },
/** /**
* @param {!WebInspector.TimelineModel.Record} record * @param {!WebInspector.TimelinePresentationModel.Record} record
* @return {!{start: number, end: number, cpuWidth: number}} * @return {!{start: number, end: number, cpuWidth: number}}
*/ */
computeBarGraphPercentages: function(record) computeBarGraphPercentages: function(record)
...@@ -932,7 +935,7 @@ WebInspector.TimelineCalculator.prototype = { ...@@ -932,7 +935,7 @@ WebInspector.TimelineCalculator.prototype = {
}, },
/** /**
* @param {!WebInspector.TimelineModel.Record} record * @param {!WebInspector.TimelinePresentationModel.Record} record
* @return {!{left: number, width: number, cpuWidth: number}} * @return {!{left: number, width: number, cpuWidth: number}}
*/ */
computeBarGraphWindowPosition: function(record) computeBarGraphWindowPosition: function(record)
...@@ -1193,7 +1196,7 @@ WebInspector.TimelineRecordGraphRow.prototype = { ...@@ -1193,7 +1196,7 @@ WebInspector.TimelineRecordGraphRow.prototype = {
if (record.thread()) if (record.thread())
this.element.classList.add("background"); this.element.classList.add("background");
var barPosition = calculator.computeBarGraphWindowPosition(record); var barPosition = calculator.computeBarGraphWindowPosition(presentationRecord);
this._barElement.style.left = barPosition.left + "px"; this._barElement.style.left = barPosition.left + "px";
this._barElement.style.width = barPosition.width + "px"; this._barElement.style.width = barPosition.width + "px";
this._barCpuElement.style.left = barPosition.left + "px"; this._barCpuElement.style.left = barPosition.left + "px";
......
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