OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 237 } |
238 | 238 |
239 /** | 239 /** |
240 * @param {?SDK.Target} target | 240 * @param {?SDK.Target} target |
241 * @param {!Array.<!SDK.TracingModel.Event>} events | 241 * @param {!Array.<!SDK.TracingModel.Event>} events |
242 * @param {string} sessionId | 242 * @param {string} sessionId |
243 */ | 243 */ |
244 addTraceEvents(target, events, sessionId) { | 244 addTraceEvents(target, events, sessionId) { |
245 this._target = target; | 245 this._target = target; |
246 this._sessionId = sessionId; | 246 this._sessionId = sessionId; |
247 if (!events.length) | |
248 return; | |
249 if (events[0].startTime < this._minimumRecordTime) | |
250 this._minimumRecordTime = events[0].startTime; | |
251 for (var i = 0; i < events.length; ++i) | 247 for (var i = 0; i < events.length; ++i) |
252 this._addTraceEvent(events[i]); | 248 this._addTraceEvent(events[i]); |
253 } | 249 } |
254 | 250 |
255 /** | 251 /** |
256 * @param {!SDK.TracingModel.Event} event | 252 * @param {!SDK.TracingModel.Event} event |
257 */ | 253 */ |
258 _addTraceEvent(event) { | 254 _addTraceEvent(event) { |
259 var eventNames = TimelineModel.TimelineModel.RecordType; | 255 var eventNames = TimelineModel.TimelineModel.RecordType; |
| 256 if (event.startTime && event.startTime < this._minimumRecordTime) |
| 257 this._minimumRecordTime = event.startTime; |
260 | 258 |
261 if (event.name === eventNames.SetLayerTreeId) { | 259 if (event.name === eventNames.SetLayerTreeId) { |
262 var sessionId = event.args['sessionId'] || event.args['data']['sessionId']
; | 260 var sessionId = event.args['sessionId'] || event.args['data']['sessionId']
; |
263 if (this._sessionId === sessionId) | 261 if (this._sessionId === sessionId) |
264 this._layerTreeId = event.args['layerTreeId'] || event.args['data']['lay
erTreeId']; | 262 this._layerTreeId = event.args['layerTreeId'] || event.args['data']['lay
erTreeId']; |
265 } else if (event.name === eventNames.TracingStartedInPage) { | 263 } else if (event.name === eventNames.TracingStartedInPage) { |
266 this._mainThread = event.thread; | 264 this._mainThread = event.thread; |
267 } else if ( | 265 } else if ( |
268 event.phase === SDK.TracingModel.Phase.SnapshotObject && event.name ===
eventNames.LayerTreeHostImplSnapshot && | 266 event.phase === SDK.TracingModel.Phase.SnapshotObject && event.name ===
eventNames.LayerTreeHostImplSnapshot && |
269 parseInt(event.id, 0) === this._layerTreeId) { | 267 parseInt(event.id, 0) === this._layerTreeId) { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 constructor(triggerTime, timeByCategory) { | 524 constructor(triggerTime, timeByCategory) { |
527 /** @type {!Object.<string, number>} */ | 525 /** @type {!Object.<string, number>} */ |
528 this.timeByCategory = timeByCategory; | 526 this.timeByCategory = timeByCategory; |
529 /** @type {!Array.<!TimelineModel.LayerPaintEvent>} */ | 527 /** @type {!Array.<!TimelineModel.LayerPaintEvent>} */ |
530 this.paints = []; | 528 this.paints = []; |
531 /** @type {number|undefined} */ | 529 /** @type {number|undefined} */ |
532 this.mainFrameId = undefined; | 530 this.mainFrameId = undefined; |
533 this.triggerTime = triggerTime; | 531 this.triggerTime = triggerTime; |
534 } | 532 } |
535 }; | 533 }; |
OLD | NEW |