Commit 05c2944f authored by yurys@chromium.org's avatar yurys@chromium.org

Use isProgram method to detect Program events

The method allows to avoid direct access to implementation specific RecordType enum.

BUG=361045
R=loislo@chromium.org

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

git-svn-id: svn://svn.chromium.org/blink/trunk@176314 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 833b511d
......@@ -415,6 +415,11 @@ WebInspector.TimelineModel.Record.prototype = {
*/
counters: function() { },
/**
* @return {boolean}
*/
isProgram: function() { },
/**
* @return {string}
*/
......
......@@ -487,6 +487,14 @@ WebInspector.TimelineModel.RecordImpl.prototype = {
return this.type() === WebInspector.TimelineModel.RecordType.UpdateCounters ? this.data() : null;
},
/**
* @return {boolean}
*/
isProgram: function()
{
return this.type() === WebInspector.TimelineModel.RecordType.Program;
},
/**
* @return {?Object}
*/
......
......@@ -88,14 +88,13 @@ WebInspector.TimelinePresentationModel.prototype = {
*/
addRecord: function(record)
{
var records;
if (record.type() === WebInspector.TimelineModel.RecordType.Program)
records = record.children();
else
records = [record];
for (var i = 0; i < records.length; ++i)
this._innerAddRecord(this._rootRecord, records[i]);
if (record.isProgram()) {
var records = record.children();
for (var i = 0; i < records.length; ++i)
this._innerAddRecord(this._rootRecord, records[i]);
} else {
this._innerAddRecord(this._rootRecord, record);
}
},
/**
......
......@@ -612,6 +612,14 @@ WebInspector.TracingTimelineModel.TraceEventRecord.prototype = {
return this.type() === WebInspector.TracingTimelineModel.RecordType.UpdateCounters ? this._event.args.data : null;
},
/**
* @return {boolean}
*/
isProgram: function()
{
return this.type() === WebInspector.TracingTimelineModel.RecordType.Program;
},
/**
* @return {?Object}
*/
......
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