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

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

Issue 1807093002: DevTools: Resume targets *after* stopping timeline recording. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | 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 853765d809ae17427fce6fd88ee911a0fb84e292..e7a796fe2658d20a3e00509d47abb66ed770b9ff 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineController.js
@@ -70,10 +70,11 @@ WebInspector.TimelineController.prototype = {
stopRecording: function()
{
- WebInspector.targetManager.resumeAllTargets();
this._allProfilesStoppedPromise = this._stopProfilingOnAllTargets();
- if (this._targets[0])
- this._targets[0].tracingManager.stop();
+ var mainTarget = WebInspector.targetManager.mainTarget();
+ if (mainTarget)
+ mainTarget.tracingManager.stop();
+ WebInspector.targetManager.resumeAllTargets();
this._delegate.loadingStarted();
},
@@ -97,6 +98,8 @@ WebInspector.TimelineController.prototype = {
this._targets.remove(target, true);
// FIXME: We'd like to stop profiling on the target and retrieve a profile
// but it's too late. Backend connection is closed.
+ if (this._profiling)
+ WebInspector.console.log(WebInspector.UIString("A target is disconnected while profiling. Its profile will not be retrieved."));
pfeldman 2016/03/17 00:34:31 Don't output this message - it jumps at the user i
alph 2016/03/17 01:10:08 Done.
},
/**
@@ -114,7 +117,9 @@ WebInspector.TimelineController.prototype = {
_startProfilingOnAllTargets: function()
{
var intervalUs = WebInspector.moduleSetting("highResolutionCpuProfiling").get() ? 100 : 1000;
- this._targets[0].profilerAgent().setSamplingInterval(intervalUs);
+ var mainTarget = WebInspector.targetManager.mainTarget();
+ if (mainTarget)
+ mainTarget.profilerAgent().setSamplingInterval(intervalUs);
this._profiling = true;
return Promise.all(this._targets.map(this._startProfilingOnTarget));
},
@@ -125,16 +130,8 @@ WebInspector.TimelineController.prototype = {
*/
_stopProfilingOnTarget: function(target)
{
- /**
- * @param {?Protocol.Error} error
- * @param {?ProfilerAgent.CPUProfile} profile
- * @return {?ProfilerAgent.CPUProfile}
- */
- function extractProfile(error, profile)
- {
- return !error && profile ? profile : null;
- }
- return target.profilerAgent().stop(extractProfile).then(this._addCpuProfile.bind(this, target.id()));
+ return target.profilerAgent().stop((error, profile) => !error && profile ? profile : null)
+ .then(this._addCpuProfile.bind(this, target.id()));
},
/**
@@ -161,7 +158,7 @@ WebInspector.TimelineController.prototype = {
this._startProfilingOnAllTargets() : Promise.resolve();
var samplingFrequencyHz = WebInspector.moduleSetting("highResolutionCpuProfiling").get() ? 10000 : 1000;
var options = "sampling-frequency=" + samplingFrequencyHz;
- var mainTarget = this._targets[0];
+ var mainTarget = WebInspector.targetManager.mainTarget();
var tracingManager = mainTarget.tracingManager;
mainTarget.resourceTreeModel.suspendReload();
profilingStartedPromise.then(tracingManager.start.bind(tracingManager, this, categories, options, onTraceStarted));
@@ -247,7 +244,7 @@ WebInspector.TimelineController.prototype = {
return;
var pid = mainMetaEvent.thread.process().id();
- var mainTarget = this._targets[0];
+ var mainTarget = WebInspector.targetManager.mainTarget();
var mainCpuProfile = this._cpuProfiles.get(mainTarget.id());
this._injectCpuProfileEvent(pid, mainMetaEvent.thread.id(), mainCpuProfile);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698