| Index: Source/devtools/front_end/TimelineModel.js
|
| diff --git a/Source/devtools/front_end/TimelineModel.js b/Source/devtools/front_end/TimelineModel.js
|
| index bc2821265295df0a39afdc8afa9dfb072d32c958..7a0b98dfb8037fbbd3d375a98279ae44a5934236 100644
|
| --- a/Source/devtools/front_end/TimelineModel.js
|
| +++ b/Source/devtools/front_end/TimelineModel.js
|
| @@ -38,9 +38,10 @@ WebInspector.TimelineModel = function()
|
| this._stringPool = new StringPool();
|
| this._minimumRecordTime = -1;
|
| this._maximumRecordTime = -1;
|
| - this._collectionEnabled = false;
|
|
|
| WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, this._onRecordAdded, this);
|
| + WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStarted, this._onStarted, this);
|
| + WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineStopped, this._onStopped, this);
|
| }
|
|
|
| WebInspector.TimelineModel.TransferChunkLengthBytes = 5000000;
|
| @@ -101,7 +102,9 @@ WebInspector.TimelineModel.RecordType = {
|
|
|
| WebInspector.TimelineModel.Events = {
|
| RecordAdded: "RecordAdded",
|
| - RecordsCleared: "RecordsCleared"
|
| + RecordsCleared: "RecordsCleared",
|
| + RecordingStarted: "RecordingStarted",
|
| + RecordingStopped: "RecordingStopped"
|
| }
|
|
|
| WebInspector.TimelineModel.startTimeInSeconds = function(record)
|
| @@ -150,21 +153,21 @@ WebInspector.TimelineModel.prototype = {
|
| /**
|
| * @param {boolean=} includeDomCounters
|
| */
|
| - startRecord: function(includeDomCounters)
|
| + startRecording: function(includeDomCounters)
|
| {
|
| if (this._collectionEnabled)
|
| return;
|
| this.reset();
|
| var maxStackFrames = WebInspector.settings.timelineLimitStackFramesFlag.get() ? WebInspector.settings.timelineStackFramesToCapture.get() : 30;
|
| - WebInspector.timelineManager.start(maxStackFrames, includeDomCounters);
|
| + WebInspector.timelineManager.start(maxStackFrames, includeDomCounters, false, this._fireRecordingStarted.bind(this));
|
| this._collectionEnabled = true;
|
| },
|
|
|
| - stopRecord: function()
|
| + stopRecording: function()
|
| {
|
| if (!this._collectionEnabled)
|
| return;
|
| - WebInspector.timelineManager.stop();
|
| + WebInspector.timelineManager.stop(this._fireRecordingStopped.bind(this));
|
| this._collectionEnabled = false;
|
| },
|
|
|
| @@ -173,12 +176,51 @@ WebInspector.TimelineModel.prototype = {
|
| return this._records;
|
| },
|
|
|
| + /**
|
| + * @param {WebInspector.Event} event
|
| + */
|
| _onRecordAdded: function(event)
|
| {
|
| if (this._collectionEnabled)
|
| - this._addRecord(event.data);
|
| + this._addRecord(/** @type {TimelineAgent.TimelineEvent} */(event.data));
|
| + },
|
| +
|
| + /**
|
| + * @param {WebInspector.Event} event
|
| + */
|
| + _onStarted: function(event)
|
| + {
|
| + if (event.data) {
|
| + // Started from console
|
| + this._collectionEnabled = true;
|
| + this._fireRecordingStarted();
|
| + }
|
| + },
|
| +
|
| + /**
|
| + * @param {WebInspector.Event} event
|
| + */
|
| + _onStopped: function(event)
|
| + {
|
| + if (event.data) {
|
| + this._collectionEnabled = false;
|
| + this._fireRecordingStopped();
|
| + }
|
| + },
|
| +
|
| + _fireRecordingStarted: function()
|
| + {
|
| + this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStarted);
|
| + },
|
| +
|
| + _fireRecordingStopped: function()
|
| + {
|
| + this.dispatchEventToListeners(WebInspector.TimelineModel.Events.RecordingStopped);
|
| },
|
|
|
| + /**
|
| + * @param {TimelineAgent.TimelineEvent} record
|
| + */
|
| _addRecord: function(record)
|
| {
|
| this._stringPool.internObjectStrings(record);
|
| @@ -252,6 +294,9 @@ WebInspector.TimelineModel.prototype = {
|
| return this._maximumRecordTime;
|
| },
|
|
|
| + /**
|
| + * @param {TimelineAgent.TimelineEvent} record
|
| + */
|
| _updateBoundaries: function(record)
|
| {
|
| var startTime = WebInspector.TimelineModel.startTimeInSeconds(record);
|
|
|