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 = { ...@@ -415,6 +415,11 @@ WebInspector.TimelineModel.Record.prototype = {
*/ */
counters: function() { }, counters: function() { },
/**
* @return {boolean}
*/
isProgram: function() { },
/** /**
* @return {string} * @return {string}
*/ */
......
...@@ -487,6 +487,14 @@ WebInspector.TimelineModel.RecordImpl.prototype = { ...@@ -487,6 +487,14 @@ WebInspector.TimelineModel.RecordImpl.prototype = {
return this.type() === WebInspector.TimelineModel.RecordType.UpdateCounters ? this.data() : null; return this.type() === WebInspector.TimelineModel.RecordType.UpdateCounters ? this.data() : null;
}, },
/**
* @return {boolean}
*/
isProgram: function()
{
return this.type() === WebInspector.TimelineModel.RecordType.Program;
},
/** /**
* @return {?Object} * @return {?Object}
*/ */
......
...@@ -88,14 +88,13 @@ WebInspector.TimelinePresentationModel.prototype = { ...@@ -88,14 +88,13 @@ WebInspector.TimelinePresentationModel.prototype = {
*/ */
addRecord: function(record) addRecord: function(record)
{ {
var records; if (record.isProgram()) {
if (record.type() === WebInspector.TimelineModel.RecordType.Program) var records = record.children();
records = record.children(); for (var i = 0; i < records.length; ++i)
else this._innerAddRecord(this._rootRecord, records[i]);
records = [record]; } else {
this._innerAddRecord(this._rootRecord, record);
for (var i = 0; i < records.length; ++i) }
this._innerAddRecord(this._rootRecord, records[i]);
}, },
/** /**
......
...@@ -612,6 +612,14 @@ WebInspector.TracingTimelineModel.TraceEventRecord.prototype = { ...@@ -612,6 +612,14 @@ WebInspector.TracingTimelineModel.TraceEventRecord.prototype = {
return this.type() === WebInspector.TracingTimelineModel.RecordType.UpdateCounters ? this._event.args.data : null; 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} * @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