Commit 712c322f authored by yurys@chromium.org's avatar yurys@chromium.org

Fix exception when selecting record in timeline based on trace events

BUG=361045
R=loislo@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175889 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 672d7acc
......@@ -964,13 +964,16 @@ WebInspector.TimelinePanel.prototype = {
switch (this._selection.type()) {
case WebInspector.TimelineSelection.Type.Record:
var record = /** @type {!WebInspector.TimelineModel.Record} */ (this._selection.object());
WebInspector.TimelineUIUtils.generatePopupContent(record, this._model, this._detailsLinkifier, this.showInDetails.bind(this, record.title()), this._model.loadedFromFile());
if (this._tracingTimelineModel) {
var event = this._tracingTimelineModel.traceEventFrom(record);
this._buildSelectionDetailsForTraceEvent(event);
} else {
WebInspector.TimelineUIUtils.generatePopupContent(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());
var title = WebInspector.TimelineUIUtils.styleForTimelineEvent(event.name).title;
var tracingModel = this._tracingTimelineModel;
WebInspector.TracingTimelineUIUtils.buildTraceEventDetails(event, tracingModel, this._detailsLinkifier, this.showInDetails.bind(this, title), false, this._model.target());
this._buildSelectionDetailsForTraceEvent(event);
break;
case WebInspector.TimelineSelection.Type.Frame:
var frame = /** @type {!WebInspector.TimelineFrame} */ (this._selection.object());
......@@ -985,6 +988,15 @@ 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)
......
......@@ -439,6 +439,17 @@ 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
}
......
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