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 3ce1bc2a3b2d5eb85e22af33d1ca022a59eb61d4..83d5f5ce01649627073db4e2f9966e2a66ea8e6b 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js |
| @@ -16,8 +16,6 @@ WebInspector.TimelineController = function(target, delegate, tracingModel) |
| this._target = target; |
| this._tracingModel = tracingModel; |
| this._targets = []; |
| - this._allProfilesStoppedPromise = Promise.resolve(); |
| - this._targetsResumedPromise = Promise.resolve(); |
| WebInspector.targetManager.observeTargets(this); |
| } |
| @@ -73,9 +71,13 @@ WebInspector.TimelineController.prototype = { |
| stopRecording: function() |
| { |
| - this._allProfilesStoppedPromise = this._stopProfilingOnAllTargets(); |
| + var tracingStoppedPromises = []; |
| + tracingStoppedPromises.push(new Promise(resolve => this._resolveTracingStoppedPromise = resolve)); |
| + tracingStoppedPromises.push.apply(tracingStoppedPromises, this._stopProfilingOnAllTargets()); |
| + |
| + Promise.all(tracingStoppedPromises).then(() => this._allSourcesFinished()); |
| this._target.tracingManager.stop(); |
| - this._targetsResumedPromise = WebInspector.targetManager.resumeAllTargets(); |
| + WebInspector.targetManager.resumeAllTargets(); |
|
alph
2016/07/11 22:21:01
I think we still need this to have all targets res
|
| this._delegate.loadingStarted(); |
| }, |
| @@ -147,13 +149,13 @@ WebInspector.TimelineController.prototype = { |
| }, |
| /** |
| - * @return {!Promise} |
| + * @return {!Array<!Promise>} |
| */ |
| _stopProfilingOnAllTargets: function() |
| { |
| var targets = this._profiling ? this._targets : []; |
| this._profiling = false; |
| - return Promise.all(targets.map(this._stopProfilingOnTarget, this)); |
| + return targets.map(this._stopProfilingOnTarget, this); |
|
alph
2016/07/11 22:21:01
could you please revert it.
|
| }, |
| /** |
| @@ -206,11 +208,11 @@ WebInspector.TimelineController.prototype = { |
| */ |
| tracingComplete: function() |
| { |
| - Promise.all([this._allProfilesStoppedPromise, this._targetsResumedPromise]) |
| - .then(this._didStopRecordingTraceEvents.bind(this)); |
| + this._resolveTracingStoppedPromise(); |
|
alph
2016/07/11 22:21:01
The name is misleading. This is not a promise.
|
| + this._resolveTracingStoppedPromise = null; |
| }, |
| - _didStopRecordingTraceEvents: function() |
| + _allSourcesFinished: function() |
| { |
| this._injectCpuProfileEvents(); |
| this._tracingModel.tracingComplete(); |