OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The Chromium Authors. All rights reserved. | 2 * Copyright 2014 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 | 6 |
7 /** | 7 /** |
8 * @interface | 8 * @interface |
9 */ | 9 */ |
10 WebInspector.TracingManagerClient = function() | 10 WebInspector.TracingManagerClient = function() |
11 { | 11 { |
12 } | 12 }; |
13 | 13 |
14 WebInspector.TracingManagerClient.prototype = { | 14 WebInspector.TracingManagerClient.prototype = { |
15 tracingStarted: function() { }, | 15 tracingStarted: function() { }, |
16 /** | 16 /** |
17 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events | 17 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} events |
18 */ | 18 */ |
19 traceEventsCollected: function(events) { }, | 19 traceEventsCollected: function(events) { }, |
20 tracingComplete: function() { }, | 20 tracingComplete: function() { }, |
21 /** | 21 /** |
22 * @param {number} usage | 22 * @param {number} usage |
23 */ | 23 */ |
24 tracingBufferUsage: function(usage) { }, | 24 tracingBufferUsage: function(usage) { }, |
25 /** | 25 /** |
26 * @param {number} progress | 26 * @param {number} progress |
27 */ | 27 */ |
28 eventsRetrievalProgress: function(progress) { } | 28 eventsRetrievalProgress: function(progress) { } |
29 } | 29 }; |
30 | 30 |
31 /** | 31 /** |
32 * @constructor | 32 * @constructor |
33 * @param {!WebInspector.Target} target | 33 * @param {!WebInspector.Target} target |
34 */ | 34 */ |
35 WebInspector.TracingManager = function(target) | 35 WebInspector.TracingManager = function(target) |
36 { | 36 { |
37 this._target = target; | 37 this._target = target; |
38 target.registerTracingDispatcher(new WebInspector.TracingDispatcher(this)); | 38 target.registerTracingDispatcher(new WebInspector.TracingDispatcher(this)); |
39 | 39 |
40 /** @type {?WebInspector.TracingManagerClient} */ | 40 /** @type {?WebInspector.TracingManagerClient} */ |
41 this._activeClient = null; | 41 this._activeClient = null; |
42 this._eventBufferSize = 0; | 42 this._eventBufferSize = 0; |
43 this._eventsRetrieved = 0; | 43 this._eventsRetrieved = 0; |
44 } | 44 }; |
45 | 45 |
46 /** @typedef {!{ | 46 /** @typedef {!{ |
47 cat: string, | 47 cat: string, |
48 pid: number, | 48 pid: number, |
49 tid: number, | 49 tid: number, |
50 ts: number, | 50 ts: number, |
51 ph: string, | 51 ph: string, |
52 name: string, | 52 name: string, |
53 args: !Object, | 53 args: !Object, |
54 dur: number, | 54 dur: number, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 127 |
128 stop: function() | 128 stop: function() |
129 { | 129 { |
130 if (!this._activeClient) | 130 if (!this._activeClient) |
131 throw new Error("Tracing is not started"); | 131 throw new Error("Tracing is not started"); |
132 if (this._finishing) | 132 if (this._finishing) |
133 throw new Error("Tracing is already being stopped"); | 133 throw new Error("Tracing is already being stopped"); |
134 this._finishing = true; | 134 this._finishing = true; |
135 this._target.tracingAgent().end(); | 135 this._target.tracingAgent().end(); |
136 } | 136 } |
137 } | 137 }; |
138 | 138 |
139 /** | 139 /** |
140 * @constructor | 140 * @constructor |
141 * @implements {TracingAgent.Dispatcher} | 141 * @implements {TracingAgent.Dispatcher} |
142 * @param {!WebInspector.TracingManager} tracingManager | 142 * @param {!WebInspector.TracingManager} tracingManager |
143 */ | 143 */ |
144 WebInspector.TracingDispatcher = function(tracingManager) | 144 WebInspector.TracingDispatcher = function(tracingManager) |
145 { | 145 { |
146 this._tracingManager = tracingManager; | 146 this._tracingManager = tracingManager; |
147 } | 147 }; |
148 | 148 |
149 WebInspector.TracingDispatcher.prototype = { | 149 WebInspector.TracingDispatcher.prototype = { |
150 /** | 150 /** |
151 * @override | 151 * @override |
152 * @param {number=} usage | 152 * @param {number=} usage |
153 * @param {number=} eventCount | 153 * @param {number=} eventCount |
154 * @param {number=} percentFull | 154 * @param {number=} percentFull |
155 */ | 155 */ |
156 bufferUsage: function(usage, eventCount, percentFull) | 156 bufferUsage: function(usage, eventCount, percentFull) |
157 { | 157 { |
158 this._tracingManager._bufferUsage(usage, eventCount, percentFull); | 158 this._tracingManager._bufferUsage(usage, eventCount, percentFull); |
159 }, | 159 }, |
160 | 160 |
161 /** | 161 /** |
162 * @override | 162 * @override |
163 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} data | 163 * @param {!Array.<!WebInspector.TracingManager.EventPayload>} data |
164 */ | 164 */ |
165 dataCollected: function(data) | 165 dataCollected: function(data) |
166 { | 166 { |
167 this._tracingManager._eventsCollected(data); | 167 this._tracingManager._eventsCollected(data); |
168 }, | 168 }, |
169 | 169 |
170 /** | 170 /** |
171 * @override | 171 * @override |
172 */ | 172 */ |
173 tracingComplete: function() | 173 tracingComplete: function() |
174 { | 174 { |
175 this._tracingManager._tracingComplete(); | 175 this._tracingManager._tracingComplete(); |
176 } | 176 } |
177 } | 177 }; |
OLD | NEW |