Chromium Code Reviews| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 94 | 94 |
| 95 var masterError = null; | 95 var masterError = null; |
| 96 var masterProfile = null; | 96 var masterProfile = null; |
| 97 var callbackBarrier = new CallbackBarrier(); | 97 var callbackBarrier = new CallbackBarrier(); |
| 98 | 98 |
| 99 if (this._jsProfilerStarted) { | 99 if (this._jsProfilerStarted) { |
| 100 ProfilerAgent.stop(callbackBarrier.createCallback(profilerCallback)) ; | 100 ProfilerAgent.stop(callbackBarrier.createCallback(profilerCallback)) ; |
| 101 this._jsProfilerStarted = false; | 101 this._jsProfilerStarted = false; |
| 102 } | 102 } |
| 103 if (!this._enablementCount) | 103 if (!this._enablementCount) |
| 104 TimelineAgent.stop(callbackBarrier.createCallback(this._processBuffe redEvents.bind(this, timelineCallback))); | 104 TimelineAgent.stop(callbackBarrier.createCallback(timelineCallback)) ; |
| 105 | 105 |
| 106 callbackBarrier.callWhenDone(allDoneCallback.bind(this)); | 106 callbackBarrier.callWhenDone(allDoneCallback.bind(this)); |
| 107 | 107 |
| 108 /** | 108 /** |
| 109 * @param {?Protocol.Error} error | 109 * @param {?Protocol.Error} error |
| 110 */ | 110 */ |
| 111 function timelineCallback(error) | 111 function timelineCallback(error) |
| 112 { | 112 { |
| 113 masterError = masterError || error; | 113 masterError = masterError || error; |
| 114 } | 114 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 127 * @this {WebInspector.TimelineManager} | 127 * @this {WebInspector.TimelineManager} |
| 128 */ | 128 */ |
| 129 function allDoneCallback() | 129 function allDoneCallback() |
| 130 { | 130 { |
| 131 this.target().profilingLock.release(); | 131 this.target().profilingLock.release(); |
| 132 callback(masterError, masterProfile); | 132 callback(masterError, masterProfile); |
| 133 } | 133 } |
| 134 }, | 134 }, |
| 135 | 135 |
| 136 /** | 136 /** |
| 137 * @param {function(?Protocol.Error)|undefined} callback | |
| 138 * @param {?Protocol.Error} error | |
| 139 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events | 137 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events |
| 140 */ | 138 */ |
| 141 _processBufferedEvents: function(callback, error, events) | 139 _processBufferedEvents: function(events) |
| 142 { | 140 { |
| 143 if (events) { | 141 if (events) { |
| 144 for (var i = 0; i < events.length; ++i) | 142 for (var i = 0; i < events.length; ++i) |
| 145 this._dispatcher.eventRecorded(events[i]); | 143 this._dispatcher.eventRecorded(events[i]); |
| 146 } | 144 } |
| 147 if (callback) | |
| 148 callback(error); | |
| 149 }, | 145 }, |
| 150 | 146 |
| 151 _configureCpuProfilerSamplingInterval: function() | 147 _configureCpuProfilerSamplingInterval: function() |
| 152 { | 148 { |
| 153 var intervalUs = WebInspector.settings.highResolutionCpuProfiling.get() ? 100 : 1000; | 149 var intervalUs = WebInspector.settings.highResolutionCpuProfiling.get() ? 100 : 1000; |
| 154 ProfilerAgent.setSamplingInterval(intervalUs, didChangeInterval.bind(thi s)); | 150 ProfilerAgent.setSamplingInterval(intervalUs, didChangeInterval.bind(thi s)); |
| 155 | 151 |
| 156 /** | 152 /** |
| 157 * @this {WebInspector.TimelineManager} | 153 * @this {WebInspector.TimelineManager} |
| 158 */ | 154 */ |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 201 if (consoleTimeline) { | 197 if (consoleTimeline) { |
| 202 // Wake up timeline panel module. | 198 // Wake up timeline panel module. |
| 203 WebInspector.moduleManager.loadModule("timeline"); | 199 WebInspector.moduleManager.loadModule("timeline"); |
| 204 } | 200 } |
| 205 this._started = true; | 201 this._started = true; |
| 206 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even tTypes.TimelineStarted, consoleTimeline); | 202 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even tTypes.TimelineStarted, consoleTimeline); |
| 207 }, | 203 }, |
| 208 | 204 |
| 209 /** | 205 /** |
| 210 * @param {boolean=} consoleTimeline | 206 * @param {boolean=} consoleTimeline |
| 207 * @param {!Array.<!TimelineAgent.TimelineEvent>=} events | |
| 211 */ | 208 */ |
| 212 stopped: function(consoleTimeline) | 209 stopped: function(consoleTimeline, events) |
| 213 { | 210 { |
| 214 this._started = false; | 211 this._started = false; |
| 215 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even tTypes.TimelineStopped, consoleTimeline); | 212 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even tTypes.TimelineStopped, consoleTimeline); |
| 213 this._manager._processBufferedEvents(events); | |
|
alph
2014/07/18 10:47:43
Perhaps it's better to processBufferedEvents befor
loislo
2014/07/18 11:42:24
When we start the timeline we may specify a filter
| |
| 216 }, | 214 }, |
| 217 | 215 |
| 218 /** | 216 /** |
| 219 * @param {number} count | 217 * @param {number} count |
| 220 */ | 218 */ |
| 221 progress: function(count) | 219 progress: function(count) |
| 222 { | 220 { |
| 223 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even tTypes.TimelineProgress, count); | 221 this._manager.dispatchEventToListeners(WebInspector.TimelineManager.Even tTypes.TimelineProgress, count); |
| 224 } | 222 } |
| 225 } | 223 } |
| 226 | 224 |
| 227 /** | 225 /** |
| 228 * @type {!WebInspector.TimelineManager} | 226 * @type {!WebInspector.TimelineManager} |
| 229 */ | 227 */ |
| 230 WebInspector.timelineManager; | 228 WebInspector.timelineManager; |
| OLD | NEW |