| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 /** | 60 /** |
| 61 * @param {number=} maxCallStackDepth | 61 * @param {number=} maxCallStackDepth |
| 62 * @param {string=} liveEvents | 62 * @param {string=} liveEvents |
| 63 * @param {boolean=} includeCounters | 63 * @param {boolean=} includeCounters |
| 64 * @param {boolean=} includeGPUEvents | 64 * @param {boolean=} includeGPUEvents |
| 65 * @param {function(?Protocol.Error)=} callback | 65 * @param {function(?Protocol.Error)=} callback |
| 66 */ | 66 */ |
| 67 start: function(maxCallStackDepth, liveEvents, includeCounters, includeGPUEv
ents, callback) | 67 start: function(maxCallStackDepth, liveEvents, includeCounters, includeGPUEv
ents, callback) |
| 68 { | 68 { |
| 69 this._enablementCount++; | 69 this._enablementCount++; |
| 70 WebInspector.profilingLock().acquire(); | 70 WebInspector.targetManager.suspendAllTargets(); |
| 71 if (this._enablementCount === 1) | 71 if (this._enablementCount === 1) |
| 72 this.target().timelineAgent().start(maxCallStackDepth, true, liveEve
nts, includeCounters, includeGPUEvents, callback); | 72 this.target().timelineAgent().start(maxCallStackDepth, true, liveEve
nts, includeCounters, includeGPUEvents, callback); |
| 73 else if (callback) | 73 else if (callback) |
| 74 callback(null); | 74 callback(null); |
| 75 }, | 75 }, |
| 76 | 76 |
| 77 /** | 77 /** |
| 78 * @param {function(?Protocol.Error)} callback | 78 * @param {function(?Protocol.Error)} callback |
| 79 */ | 79 */ |
| 80 stop: function(callback) | 80 stop: function(callback) |
| 81 { | 81 { |
| 82 this._enablementCount--; | 82 this._enablementCount--; |
| 83 if (this._enablementCount < 0) { | 83 if (this._enablementCount < 0) { |
| 84 console.error("WebInspector.TimelineManager start/stop calls are unb
alanced " + new Error().stack); | 84 console.error("WebInspector.TimelineManager start/stop calls are unb
alanced " + new Error().stack); |
| 85 return; | 85 return; |
| 86 } | 86 } |
| 87 | 87 |
| 88 if (!this._enablementCount) | 88 if (!this._enablementCount) |
| 89 this.target().timelineAgent().stop(allDoneCallback); | 89 this.target().timelineAgent().stop(allDoneCallback); |
| 90 | 90 |
| 91 /** | 91 /** |
| 92 * @param {?Protocol.Error} error | 92 * @param {?Protocol.Error} error |
| 93 */ | 93 */ |
| 94 function allDoneCallback(error) | 94 function allDoneCallback(error) |
| 95 { | 95 { |
| 96 WebInspector.profilingLock().release(); | 96 WebInspector.targetManager.resumeAllTargets(); |
| 97 callback(error); | 97 callback(error); |
| 98 } | 98 } |
| 99 }, | 99 }, |
| 100 | 100 |
| 101 /** | 101 /** |
| 102 * @param {boolean=} consoleTimeline | 102 * @param {boolean=} consoleTimeline |
| 103 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events | 103 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events |
| 104 */ | 104 */ |
| 105 _stopped: function(consoleTimeline, events) | 105 _stopped: function(consoleTimeline, events) |
| 106 { | 106 { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 }, | 161 }, |
| 162 | 162 |
| 163 /** | 163 /** |
| 164 * @param {number} count | 164 * @param {number} count |
| 165 */ | 165 */ |
| 166 progress: function(count) | 166 progress: function(count) |
| 167 { | 167 { |
| 168 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineProgress, count); | 168 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even
tTypes.TimelineProgress, count); |
| 169 } | 169 } |
| 170 } | 170 } |
| OLD | NEW |