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

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: 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..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();
« 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