| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 }, | 214 }, |
| 215 | 215 |
| 216 /** | 216 /** |
| 217 * @param {boolean=} includeCounters | 217 * @param {boolean=} includeCounters |
| 218 */ | 218 */ |
| 219 startRecording: function(includeCounters) | 219 startRecording: function(includeCounters) |
| 220 { | 220 { |
| 221 this._clientInitiatedRecording = true; | 221 this._clientInitiatedRecording = true; |
| 222 this.reset(); | 222 this.reset(); |
| 223 var maxStackFrames = WebInspector.settings.timelineCaptureStacks.get() ?
30 : 0; | 223 var maxStackFrames = WebInspector.settings.timelineCaptureStacks.get() ?
30 : 0; |
| 224 var bufferEvents = WebInspector.experimentsSettings.timelineNoLiveUpdate
.isEnabled() && !WebInspector.settings.timelineLiveUpdate.get(); |
| 224 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn
abled(); | 225 var includeGPUEvents = WebInspector.experimentsSettings.gpuTimeline.isEn
abled(); |
| 225 WebInspector.timelineManager.start(maxStackFrames, includeCounters, incl
udeGPUEvents, this._fireRecordingStarted.bind(this)); | 226 WebInspector.timelineManager.start(maxStackFrames, bufferEvents, include
Counters, includeGPUEvents, this._fireRecordingStarted.bind(this)); |
| 226 }, | 227 }, |
| 227 | 228 |
| 228 stopRecording: function() | 229 stopRecording: function() |
| 229 { | 230 { |
| 230 if (!this._clientInitiatedRecording) { | 231 if (!this._clientInitiatedRecording) { |
| 231 WebInspector.timelineManager.start(undefined, undefined, undefined,
stopTimeline.bind(this)); | 232 WebInspector.timelineManager.start(undefined, undefined, undefined,
undefined, stopTimeline.bind(this)); |
| 232 return; | 233 return; |
| 233 } | 234 } |
| 234 | 235 |
| 235 /** | 236 /** |
| 236 * Console started this one and we are just sniffing it. Initiate record
ing so that we | 237 * Console started this one and we are just sniffing it. Initiate record
ing so that we |
| 237 * could stop it. | 238 * could stop it. |
| 238 * @this {WebInspector.TimelineModel} | 239 * @this {WebInspector.TimelineModel} |
| 239 */ | 240 */ |
| 240 function stopTimeline() | 241 function stopTimeline() |
| 241 { | 242 { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 275 } |
| 275 }, | 276 }, |
| 276 | 277 |
| 277 /** | 278 /** |
| 278 * @param {!WebInspector.Event} event | 279 * @param {!WebInspector.Event} event |
| 279 */ | 280 */ |
| 280 _onStopped: function(event) | 281 _onStopped: function(event) |
| 281 { | 282 { |
| 282 if (event.data) { | 283 if (event.data) { |
| 283 // Stopped from console. | 284 // Stopped from console. |
| 284 this._fireRecordingStopped(); | 285 this._fireRecordingStopped(null); |
| 285 } | 286 } |
| 286 }, | 287 }, |
| 287 | 288 |
| 288 _fireRecordingStarted: function() | 289 _fireRecordingStarted: function() |
| 289 { | 290 { |
| 290 this._collectionEnabled = true; | 291 this._collectionEnabled = true; |
| 291 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin
gStarted); | 292 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin
gStarted); |
| 292 }, | 293 }, |
| 293 | 294 |
| 294 _fireRecordingStopped: function() | 295 /** |
| 296 * @param {?Protocol.Error} error |
| 297 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events |
| 298 */ |
| 299 _fireRecordingStopped: function(error, events) |
| 295 { | 300 { |
| 296 this._collectionEnabled = false; | 301 this._collectionEnabled = false; |
| 302 for (var i = 0; events && i < events.length; ++i) |
| 303 this._addRecord(events[i]); |
| 297 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin
gStopped); | 304 this.dispatchEventToListeners(WebInspector.TimelineModel.Events.Recordin
gStopped); |
| 298 }, | 305 }, |
| 299 | 306 |
| 300 /** | 307 /** |
| 301 * @param {!TimelineAgent.TimelineEvent} payload | 308 * @param {!TimelineAgent.TimelineEvent} payload |
| 302 */ | 309 */ |
| 303 _addRecord: function(payload) | 310 _addRecord: function(payload) |
| 304 { | 311 { |
| 305 this._internStrings(payload); | 312 this._internStrings(payload); |
| 306 this._payloads.push(payload); | 313 this._payloads.push(payload); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1160 WebInspector.TimelineModel._quadFromRectData = function(data) | 1167 WebInspector.TimelineModel._quadFromRectData = function(data) |
| 1161 { | 1168 { |
| 1162 if (typeof data["x"] === "undefined" || typeof data["y"] === "undefined") | 1169 if (typeof data["x"] === "undefined" || typeof data["y"] === "undefined") |
| 1163 return null; | 1170 return null; |
| 1164 var x0 = data["x"]; | 1171 var x0 = data["x"]; |
| 1165 var x1 = data["x"] + data["width"]; | 1172 var x1 = data["x"] + data["width"]; |
| 1166 var y0 = data["y"]; | 1173 var y0 = data["y"]; |
| 1167 var y1 = data["y"] + data["height"]; | 1174 var y1 = data["y"] + data["height"]; |
| 1168 return [x0, y0, x1, y0, x1, y1, x0, y1]; | 1175 return [x0, y0, x1, y0, x1, y1, x0, y1]; |
| 1169 } | 1176 } |
| OLD | NEW |