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

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

Issue 2297813002: DevTools: Do not run CPU profiler on targets with no JS capability. (Closed)
Patch Set: Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!WebInspector.Target} target 7 * @param {!WebInspector.Target} target
8 * @param {!WebInspector.TimelineLifecycleDelegate} delegate 8 * @param {!WebInspector.TimelineLifecycleDelegate} delegate
9 * @param {!WebInspector.TracingModel} tracingModel 9 * @param {!WebInspector.TracingModel} tracingModel
10 * @implements {WebInspector.TargetManager.Observer} 10 * @implements {WebInspector.TargetManager.Observer}
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 // FIXME: We'd like to stop profiling on the target and retrieve a profi le 103 // FIXME: We'd like to stop profiling on the target and retrieve a profi le
104 // but it's too late. Backend connection is closed. 104 // but it's too late. Backend connection is closed.
105 }, 105 },
106 106
107 /** 107 /**
108 * @param {!WebInspector.Target} target 108 * @param {!WebInspector.Target} target
109 * @return {!Promise} 109 * @return {!Promise}
110 */ 110 */
111 _startProfilingOnTarget: function(target) 111 _startProfilingOnTarget: function(target)
112 { 112 {
113 return target.profilerAgent().start(); 113 return target.hasJSCapability() ? target.profilerAgent().start() : Promi se.resolve();
114 }, 114 },
115 115
116 /** 116 /**
117 * @return {!Promise} 117 * @return {!Promise}
118 */ 118 */
119 _startProfilingOnAllTargets: function() 119 _startProfilingOnAllTargets: function()
120 { 120 {
121 var intervalUs = WebInspector.moduleSetting("highResolutionCpuProfiling" ).get() ? 100 : 1000; 121 var intervalUs = WebInspector.moduleSetting("highResolutionCpuProfiling" ).get() ? 100 : 1000;
122 this._target.profilerAgent().setSamplingInterval(intervalUs); 122 this._target.profilerAgent().setSamplingInterval(intervalUs);
123 this._profiling = true; 123 this._profiling = true;
124 return Promise.all(this._targets.map(this._startProfilingOnTarget)); 124 return Promise.all(this._targets.map(this._startProfilingOnTarget));
125 }, 125 },
126 126
127 /** 127 /**
128 * @param {!WebInspector.Target} target 128 * @param {!WebInspector.Target} target
129 * @return {!Promise} 129 * @return {!Promise}
130 */ 130 */
131 _stopProfilingOnTarget: function(target) 131 _stopProfilingOnTarget: function(target)
132 { 132 {
133 return target.profilerAgent().stop(this._addCpuProfile.bind(this, target .id())); 133 return target.hasJSCapability() ? target.profilerAgent().stop(this._addC puProfile.bind(this, target.id())) : Promise.resolve();
134 }, 134 },
135 135
136 /** 136 /**
137 * @param {number} targetId 137 * @param {number} targetId
138 * @param {?Protocol.Error} error 138 * @param {?Protocol.Error} error
139 * @param {?ProfilerAgent.Profile} cpuProfile 139 * @param {?ProfilerAgent.Profile} cpuProfile
140 */ 140 */
141 _addCpuProfile: function(targetId, error, cpuProfile) 141 _addCpuProfile: function(targetId, error, cpuProfile)
142 { 142 {
143 if (!cpuProfile) { 143 if (!cpuProfile) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 /** 280 /**
281 * @param {number} progress 281 * @param {number} progress
282 * @override 282 * @override
283 */ 283 */
284 eventsRetrievalProgress: function(progress) 284 eventsRetrievalProgress: function(progress)
285 { 285 {
286 this._delegate.loadingProgress(progress); 286 this._delegate.loadingProgress(progress);
287 } 287 }
288 } 288 }
OLDNEW
« 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