| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 /** | 53 /** |
| 54 * @return {boolean} | 54 * @return {boolean} |
| 55 */ | 55 */ |
| 56 isStarted: function() | 56 isStarted: function() |
| 57 { | 57 { |
| 58 return this._dispatcher.isStarted(); | 58 return this._dispatcher.isStarted(); |
| 59 }, | 59 }, |
| 60 | 60 |
| 61 /** | 61 /** |
| 62 * @param {number=} maxCallStackDepth | 62 * @param {number=} maxCallStackDepth |
| 63 * @param {boolean=} bufferEvents | |
| 64 * @param {string=} liveEvents | 63 * @param {string=} liveEvents |
| 65 * @param {boolean=} includeCounters | 64 * @param {boolean=} includeCounters |
| 66 * @param {boolean=} includeGPUEvents | 65 * @param {boolean=} includeGPUEvents |
| 67 * @param {function(?Protocol.Error)=} callback | 66 * @param {function(?Protocol.Error)=} callback |
| 68 */ | 67 */ |
| 69 start: function(maxCallStackDepth, bufferEvents, liveEvents, includeCounters
, includeGPUEvents, callback) | 68 start: function(maxCallStackDepth, liveEvents, includeCounters, includeGPUEv
ents, callback) |
| 70 { | 69 { |
| 71 this._enablementCount++; | 70 this._enablementCount++; |
| 72 this.target().profilingLock.acquire(); | 71 this.target().profilingLock.acquire(); |
| 73 if (WebInspector.experimentsSettings.timelineJSCPUProfile.isEnabled() &&
maxCallStackDepth) { | 72 if (WebInspector.experimentsSettings.timelineJSCPUProfile.isEnabled() &&
maxCallStackDepth) { |
| 74 this._configureCpuProfilerSamplingInterval(); | 73 this._configureCpuProfilerSamplingInterval(); |
| 75 this._jsProfilerStarted = true; | 74 this._jsProfilerStarted = true; |
| 76 this.target().profilerAgent().start(); | 75 this.target().profilerAgent().start(); |
| 77 } | 76 } |
| 78 if (this._enablementCount === 1) | 77 if (this._enablementCount === 1) |
| 79 this.target().timelineAgent().start(maxCallStackDepth, bufferEvents,
liveEvents, includeCounters, includeGPUEvents, callback); | 78 this.target().timelineAgent().start(maxCallStackDepth, true, liveEve
nts, includeCounters, includeGPUEvents, callback); |
| 80 else if (callback) | 79 else if (callback) |
| 81 callback(null); | 80 callback(null); |
| 82 }, | 81 }, |
| 83 | 82 |
| 84 /** | 83 /** |
| 85 * @param {function(?Protocol.Error,?ProfilerAgent.CPUProfile)} callback | 84 * @param {function(?Protocol.Error,?ProfilerAgent.CPUProfile)} callback |
| 86 */ | 85 */ |
| 87 stop: function(callback) | 86 stop: function(callback) |
| 88 { | 87 { |
| 89 this._enablementCount--; | 88 this._enablementCount--; |
| 90 if (this._enablementCount < 0) { | 89 if (this._enablementCount < 0) { |
| 91 console.error("WebInspector.TimelineManager start/stop calls are unb
alanced " + new Error().stack); | 90 console.error("WebInspector.TimelineManager start/stop calls are unb
alanced " + new Error().stack); |
| 92 return; | 91 return; |
| 93 } | 92 } |
| 94 | 93 |
| 95 var masterError = null; | 94 var masterError = null; |
| 96 var masterProfile = null; | 95 var masterProfile = null; |
| 97 var callbackBarrier = new CallbackBarrier(); | 96 var callbackBarrier = new CallbackBarrier(); |
| 98 | 97 |
| 99 if (this._jsProfilerStarted) { | 98 if (this._jsProfilerStarted) { |
| 100 this.target().profilerAgent().stop(callbackBarrier.createCallback(pr
ofilerCallback)); | 99 this.target().profilerAgent().stop(callbackBarrier.createCallback(pr
ofilerCallback)); |
| 101 this._jsProfilerStarted = false; | 100 this._jsProfilerStarted = false; |
| 102 } | 101 } |
| 103 if (!this._enablementCount) | 102 if (!this._enablementCount) |
| 104 this.target().timelineAgent().stop(callbackBarrier.createCallback(ti
melineCallback)); | 103 this.target().timelineAgent().stop(callbackBarrier.createCallback(ti
melineCallback)); |
| 105 TimelineAgent.stop(callbackBarrier.createCallback(timelineCallback))
; | |
| 106 | 104 |
| 107 callbackBarrier.callWhenDone(allDoneCallback.bind(this)); | 105 callbackBarrier.callWhenDone(allDoneCallback.bind(this)); |
| 108 | 106 |
| 109 /** | 107 /** |
| 110 * @param {?Protocol.Error} error | 108 * @param {?Protocol.Error} error |
| 111 */ | 109 */ |
| 112 function timelineCallback(error) | 110 function timelineCallback(error) |
| 113 { | 111 { |
| 114 masterError = masterError || error; | 112 masterError = masterError || error; |
| 115 } | 113 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 }, | 210 }, |
| 213 | 211 |
| 214 /** | 212 /** |
| 215 * @param {number} count | 213 * @param {number} count |
| 216 */ | 214 */ |
| 217 progress: function(count) | 215 progress: function(count) |
| 218 { | 216 { |
| 219 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineProgress, count); | 217 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineProgress, count); |
| 220 } | 218 } |
| 221 } | 219 } |
| OLD | NEW |