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

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

Issue 2296363002: DevTools: Do not run CPU profiler on targets with no JS capability. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2840
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // FIXME: We'd like to stop profiling on the target and retrieve a profi le 102 // FIXME: We'd like to stop profiling on the target and retrieve a profi le
103 // but it's too late. Backend connection is closed. 103 // but it's too late. Backend connection is closed.
104 }, 104 },
105 105
106 /** 106 /**
107 * @param {!WebInspector.Target} target 107 * @param {!WebInspector.Target} target
108 * @return {!Promise} 108 * @return {!Promise}
109 */ 109 */
110 _startProfilingOnTarget: function(target) 110 _startProfilingOnTarget: function(target)
111 { 111 {
112 return target.profilerAgent().start(); 112 return target.hasJSCapability() ? target.profilerAgent().start() : Promi se.resolve();
113 }, 113 },
114 114
115 /** 115 /**
116 * @return {!Promise} 116 * @return {!Promise}
117 */ 117 */
118 _startProfilingOnAllTargets: function() 118 _startProfilingOnAllTargets: function()
119 { 119 {
120 var intervalUs = WebInspector.moduleSetting("highResolutionCpuProfiling" ).get() ? 100 : 1000; 120 var intervalUs = WebInspector.moduleSetting("highResolutionCpuProfiling" ).get() ? 100 : 1000;
121 this._target.profilerAgent().setSamplingInterval(intervalUs); 121 this._target.profilerAgent().setSamplingInterval(intervalUs);
122 this._profiling = true; 122 this._profiling = true;
123 return Promise.all(this._targets.map(this._startProfilingOnTarget)); 123 return Promise.all(this._targets.map(this._startProfilingOnTarget));
124 }, 124 },
125 125
126 /** 126 /**
127 * @param {!WebInspector.Target} target 127 * @param {!WebInspector.Target} target
128 * @return {!Promise} 128 * @return {!Promise}
129 */ 129 */
130 _stopProfilingOnTarget: function(target) 130 _stopProfilingOnTarget: function(target)
131 { 131 {
132 return target.profilerAgent().stop(this._addCpuProfile.bind(this, target .id())); 132 return target.hasJSCapability() ? target.profilerAgent().stop(this._addC puProfile.bind(this, target.id())) : Promise.resolve();
133 }, 133 },
134 134
135 /** 135 /**
136 * @param {number} targetId 136 * @param {number} targetId
137 * @param {?Protocol.Error} error 137 * @param {?Protocol.Error} error
138 * @param {?ProfilerAgent.Profile} cpuProfile 138 * @param {?ProfilerAgent.Profile} cpuProfile
139 */ 139 */
140 _addCpuProfile: function(targetId, error, cpuProfile) 140 _addCpuProfile: function(targetId, error, cpuProfile)
141 { 141 {
142 if (!cpuProfile) { 142 if (!cpuProfile) {
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 /** 279 /**
280 * @param {number} progress 280 * @param {number} progress
281 * @override 281 * @override
282 */ 282 */
283 eventsRetrievalProgress: function(progress) 283 eventsRetrievalProgress: function(progress)
284 { 284 {
285 this._delegate.loadingProgress(progress); 285 this._delegate.loadingProgress(progress);
286 } 286 }
287 } 287 }
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