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..6bc49a7d197ea8434c9f6ec5d4a3dacffa662b13 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._tracingCompleteCallback = resolve)); |
+ tracingStoppedPromises.push(this._stopProfilingOnAllTargets()); |
this._target.tracingManager.stop(); |
- this._targetsResumedPromise = WebInspector.targetManager.resumeAllTargets(); |
+ tracingStoppedPromises.push(WebInspector.targetManager.resumeAllTargets()); |
+ Promise.all(tracingStoppedPromises).then(() => this._allSourcesFinished()); |
+ |
this._delegate.loadingStarted(); |
}, |
@@ -206,11 +208,11 @@ WebInspector.TimelineController.prototype = { |
*/ |
tracingComplete: function() |
{ |
- Promise.all([this._allProfilesStoppedPromise, this._targetsResumedPromise]) |
- .then(this._didStopRecordingTraceEvents.bind(this)); |
+ this._tracingCompleteCallback(); |
+ this._tracingCompleteCallback = null; |
}, |
- _didStopRecordingTraceEvents: function() |
+ _allSourcesFinished: function() |
{ |
this._injectCpuProfileEvents(); |
this._tracingModel.tracingComplete(); |