OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 * @extends {WebInspector.TimelineModel} | 7 * @extends {WebInspector.TimelineModel} |
8 * @implements {WebInspector.TargetManager.Observer} | 8 * @implements {WebInspector.TargetManager.Observer} |
9 */ | 9 */ |
10 WebInspector.TimelineModelImpl = function() | 10 WebInspector.TimelineModelImpl = function() |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 /** | 159 /** |
160 * @param {?Protocol.Error} error | 160 * @param {?Protocol.Error} error |
161 * @param {?ProfilerAgent.CPUProfile} cpuProfile | 161 * @param {?ProfilerAgent.CPUProfile} cpuProfile |
162 */ | 162 */ |
163 _fireRecordingStopped: function(error, cpuProfile) | 163 _fireRecordingStopped: function(error, cpuProfile) |
164 { | 164 { |
165 this._collectionEnabled = false; | 165 this._collectionEnabled = false; |
166 if (cpuProfile) | 166 if (cpuProfile) |
167 WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline(t
his, cpuProfile); | 167 WebInspector.TimelineJSProfileProcessor.mergeJSProfileIntoTimeline(t
his, cpuProfile); |
168 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin
gStopped); | 168 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin
gStopped); |
169 this._currentTarget = null; | |
170 }, | 169 }, |
171 | 170 |
172 /** | 171 /** |
173 * @param {!TimelineAgent.TimelineEvent} payload | 172 * @param {!TimelineAgent.TimelineEvent} payload |
174 */ | 173 */ |
175 _addRecord: function(payload) | 174 _addRecord: function(payload) |
176 { | 175 { |
177 this._internStrings(payload); | 176 this._internStrings(payload); |
178 this._payloads.push(payload); | 177 this._payloads.push(payload); |
179 | 178 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 if (!accepted) | 255 if (!accepted) |
257 return; | 256 return; |
258 var saver = new WebInspector.TimelineSaver(stream); | 257 var saver = new WebInspector.TimelineSaver(stream); |
259 saver.save(this._payloads, window.navigator.appVersion); | 258 saver.save(this._payloads, window.navigator.appVersion); |
260 } | 259 } |
261 stream.open(fileName, callback.bind(this)); | 260 stream.open(fileName, callback.bind(this)); |
262 }, | 261 }, |
263 | 262 |
264 reset: function() | 263 reset: function() |
265 { | 264 { |
| 265 if (!this._collectionEnabled) |
| 266 this._currentTarget = null; |
266 this._payloads = []; | 267 this._payloads = []; |
267 this._stringPool = {}; | 268 this._stringPool = {}; |
268 this._bindings._reset(); | 269 this._bindings._reset(); |
269 WebInspector.TimelineModel.prototype.reset.call(this); | 270 WebInspector.TimelineModel.prototype.reset.call(this); |
270 }, | 271 }, |
271 | 272 |
272 /** | 273 /** |
273 * @param {!TimelineAgent.TimelineEvent} record | 274 * @param {!TimelineAgent.TimelineEvent} record |
274 */ | 275 */ |
275 _internStrings: function(record) | 276 _internStrings: function(record) |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 break; | 728 break; |
728 length += itemLength; | 729 length += itemLength; |
729 data.push(item); | 730 data.push(item); |
730 ++this._recordIndex; | 731 ++this._recordIndex; |
731 } | 732 } |
732 if (this._recordIndex === this._payloads.length) | 733 if (this._recordIndex === this._payloads.length) |
733 data.push(data.pop() + "]"); | 734 data.push(data.pop() + "]"); |
734 stream.write(data.join(separator), this._writeNextChunk.bind(this)); | 735 stream.write(data.join(separator), this._writeNextChunk.bind(this)); |
735 } | 736 } |
736 } | 737 } |
OLD | NEW |