Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(871)

Unified Diff: third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js

Issue 2137213004: Timeline: rearrange trace completion logic for better extensibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/tracing/trace-event-self-time.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/tracing/trace-event-self-time.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698