Commit db488e87 authored by yurys@chromium.org's avatar yurys@chromium.org

Parametrize TimelinePresentationModel with coalescable record types

This CL removes dependency on WebInspector.TimelineModel.RecordType as underlying implementation may use tracing events in which case coalescable types should be from  WebInspector.TracingTimelineModel.

BUG=361045

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176306 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3834a861
......@@ -273,8 +273,10 @@ WebInspector.TimelinePanel.prototype = {
*/
_timelineView: function()
{
if (!this._lazyTimelineView)
this._lazyTimelineView = new WebInspector.TimelineView(this, this._model);
if (!this._lazyTimelineView) {
var coalescableRecordTypes = this._tracingTimelineModel ? WebInspector.TracingTimelineUIUtils.coalescableRecordTypes : WebInspector.TimelineUIUtils.coalescableRecordTypes;
this._lazyTimelineView = new WebInspector.TimelineView(this, this._model, coalescableRecordTypes);
}
return this._lazyTimelineView;
},
......
......@@ -33,10 +33,12 @@
* @constructor
* @extends {WebInspector.Object}
* @param {!WebInspector.TimelineModel} model
* @param {!Object.<string, number>} coalescableRecordTypes
*/
WebInspector.TimelinePresentationModel = function(model)
WebInspector.TimelinePresentationModel = function(model, coalescableRecordTypes)
{
this._model = model;
this._coalescableRecordTypes = coalescableRecordTypes;
this._filters = [];
/**
* @type {!Map.<!WebInspector.TimelineModel.Record, !WebInspector.TimelinePresentationModel.Record>}
......@@ -45,13 +47,6 @@ WebInspector.TimelinePresentationModel = function(model)
this.reset();
}
WebInspector.TimelinePresentationModel._coalescingRecords = { };
WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineModel.RecordType.Layout] = 1;
WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineModel.RecordType.Paint] = 1;
WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineModel.RecordType.Rasterize] = 1;
WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineModel.RecordType.DecodeImage] = 1;
WebInspector.TimelinePresentationModel._coalescingRecords[WebInspector.TimelineModel.RecordType.ResizeImage] = 1;
WebInspector.TimelinePresentationModel.prototype = {
/**
* @param {number} startTime
......@@ -151,7 +146,7 @@ WebInspector.TimelinePresentationModel.prototype = {
return null;
if (lastRecord.record().type() !== record.type())
return null;
if (!WebInspector.TimelinePresentationModel._coalescingRecords[record.type()])
if (!this._coalescableRecordTypes[record.type()])
return null;
if (lastRecord.record().endTime() + coalescingThresholdMillis < startTime)
return null;
......
......@@ -108,6 +108,13 @@ WebInspector.TimelineUIUtils._initRecordStyles = function()
return recordStyles;
}
WebInspector.TimelineUIUtils.coalescableRecordTypes = {};
WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.RecordType.Layout] = 1;
WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.RecordType.Paint] = 1;
WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.RecordType.Rasterize] = 1;
WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.RecordType.DecodeImage] = 1;
WebInspector.TimelineUIUtils.coalescableRecordTypes[WebInspector.TimelineModel.RecordType.ResizeImage] = 1;
/**
* @param {!WebInspector.TimelineModel.Record} record
* @return {!{title: string, category: !WebInspector.TimelineCategory}}
......
......@@ -35,15 +35,16 @@
* @implements {WebInspector.TimelineModeView}
* @param {!WebInspector.TimelineModeViewDelegate} delegate
* @param {!WebInspector.TimelineModel} model
* @param {!Object.<string, number>} coalescableRecordTypes
*/
WebInspector.TimelineView = function(delegate, model)
WebInspector.TimelineView = function(delegate, model, coalescableRecordTypes)
{
WebInspector.HBox.call(this);
this.element.classList.add("timeline-view");
this._delegate = delegate;
this._model = model;
this._presentationModel = new WebInspector.TimelinePresentationModel(model);
this._presentationModel = new WebInspector.TimelinePresentationModel(model, coalescableRecordTypes);
this._calculator = new WebInspector.TimelineCalculator(model);
this._linkifier = new WebInspector.Linkifier();
this._frameStripByFrame = new Map();
......
......@@ -80,6 +80,13 @@ WebInspector.TracingTimelineUIUtils._initEventStyles = function()
return eventStyles;
}
WebInspector.TracingTimelineUIUtils.coalescableRecordTypes = {};
WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingTimelineModel.RecordType.Layout] = 1;
WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingTimelineModel.RecordType.Paint] = 1;
WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingTimelineModel.RecordType.Rasterize] = 1;
WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingTimelineModel.RecordType.DecodeImage] = 1;
WebInspector.TracingTimelineUIUtils.coalescableRecordTypes[WebInspector.TracingTimelineModel.RecordType.ResizeImage] = 1;
/**
* @param {!WebInspector.TracingModel.Event} event
* @return {!{title: string, category: !WebInspector.TimelineCategory}}
......
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