Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js |
| index 00272073b3724b5e22dd9482964aa1fe6f578aa6..f66e86d5429a2dfd34769b63a7bd60ba18f62dbd 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js |
| @@ -33,6 +33,7 @@ Timeline.TimelineController = class { |
| /** |
| * @param {!Timeline.TimelineController.RecordingOptions} options |
| * @param {!Array<!Extensions.ExtensionTraceProvider>} providers |
| + * @return {!Promise} |
| */ |
| startRecording(options, providers) { |
| this._extensionTraceProviders = Extensions.extensionServer.traceProviders().slice(); |
| @@ -72,8 +73,9 @@ Timeline.TimelineController = class { |
| this._extensionSessions = |
| providers.map(provider => new Timeline.ExtensionTracingSession(provider, this._performanceModel)); |
| this._extensionSessions.forEach(session => session.start()); |
| - this._startRecordingWithCategories(categoriesArray.join(','), options.enableJSSampling); |
| + var startPromise = this._startRecordingWithCategories(categoriesArray.join(','), options.enableJSSampling); |
| this._performanceModel.setRecordStartTime(Date.now()); |
| + return startPromise; |
| } |
| stopRecording() { |
| @@ -169,27 +171,18 @@ Timeline.TimelineController = class { |
| /** |
| * @param {string} categories |
| * @param {boolean=} enableJSSampling |
| - * @param {function(?string)=} callback |
| + * @return {!Promise} |
| */ |
| - _startRecordingWithCategories(categories, enableJSSampling, callback) { |
| + _startRecordingWithCategories(categories, enableJSSampling) { |
| SDK.targetManager.suspendAllTargets(); |
| var profilingStartedPromise = enableJSSampling && !Runtime.experiments.isEnabled('timelineTracingJSProfile') ? |
| this._startProfilingOnAllTargets() : |
| Promise.resolve(); |
| var samplingFrequencyHz = Common.moduleSetting('highResolutionCpuProfiling').get() ? 10000 : 1000; |
| var options = 'sampling-frequency=' + samplingFrequencyHz; |
| - var target = this._target; |
| - var tracingManager = target.tracingManager; |
| - SDK.targetManager.suspendReload(target); |
| - profilingStartedPromise.then(tracingManager.start.bind(tracingManager, this, categories, options, onTraceStarted)); |
| - /** |
| - * @param {?string} error |
| - */ |
| - function onTraceStarted(error) { |
| - SDK.targetManager.resumeReload(target); |
| - if (callback) |
| - callback(error); |
| - } |
| + var tracingManager = this._target.tracingManager; |
| + return profilingStartedPromise.then( |
| + tracingManager.start.bind(tracingManager, this, categories, options, undefined)); |
|
caseq
2017/02/27 23:13:38
Looks like we need to defer this to when tracingMa
dgozman
2017/02/28 01:58:17
Good catch! Done.
|
| } |
| /** |