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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.profilerAgent().stop(this._addCpuProfile.bind(this, target
.id())); |
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.CPUProfile} 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) { |
143 WebInspector.console.warn(WebInspector.UIString("CPU profile for a t
arget is not available. %s", error || "")); | 143 WebInspector.console.warn(WebInspector.UIString("CPU profile for a t
arget is not available. %s", error || "")); |
144 return; | 144 return; |
145 } | 145 } |
146 if (!this._cpuProfiles) | 146 if (!this._cpuProfiles) |
147 this._cpuProfiles = new Map(); | 147 this._cpuProfiles = new Map(); |
148 this._cpuProfiles.set(targetId, cpuProfile); | 148 this._cpuProfiles.set(targetId, cpuProfile); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 _allSourcesFinished: function() | 215 _allSourcesFinished: function() |
216 { | 216 { |
217 this._injectCpuProfileEvents(); | 217 this._injectCpuProfileEvents(); |
218 this._tracingModel.tracingComplete(); | 218 this._tracingModel.tracingComplete(); |
219 this._delegate.loadingComplete(true); | 219 this._delegate.loadingComplete(true); |
220 }, | 220 }, |
221 | 221 |
222 /** | 222 /** |
223 * @param {number} pid | 223 * @param {number} pid |
224 * @param {number} tid | 224 * @param {number} tid |
225 * @param {?ProfilerAgent.CPUProfile} cpuProfile | 225 * @param {?ProfilerAgent.Profile} cpuProfile |
226 */ | 226 */ |
227 _injectCpuProfileEvent: function(pid, tid, cpuProfile) | 227 _injectCpuProfileEvent: function(pid, tid, cpuProfile) |
228 { | 228 { |
229 if (!cpuProfile) | 229 if (!cpuProfile) |
230 return; | 230 return; |
231 var cpuProfileEvent = /** @type {!WebInspector.TracingManager.EventPaylo
ad} */ ({ | 231 var cpuProfileEvent = /** @type {!WebInspector.TracingManager.EventPaylo
ad} */ ({ |
232 cat: WebInspector.TracingModel.DevToolsMetadataEventCategory, | 232 cat: WebInspector.TracingModel.DevToolsMetadataEventCategory, |
233 ph: WebInspector.TracingModel.Phase.Instant, | 233 ph: WebInspector.TracingModel.Phase.Instant, |
234 ts: this._tracingModel.maximumRecordTime() * 1000, | 234 ts: this._tracingModel.maximumRecordTime() * 1000, |
235 pid: pid, | 235 pid: pid, |
(...skipping 42 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 |