| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |