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 * @interface | 7 * @interface |
8 */ | 8 */ |
9 SDK.TracingManagerClient = function() {}; | 9 SDK.TracingManagerClient = function() {}; |
10 | 10 |
11 SDK.TracingManagerClient.prototype = { | 11 SDK.TracingManagerClient.prototype = { |
12 tracingStarted() {}, | |
13 /** | 12 /** |
14 * @param {!Array.<!SDK.TracingManager.EventPayload>} events | 13 * @param {!Array.<!SDK.TracingManager.EventPayload>} events |
15 */ | 14 */ |
16 traceEventsCollected(events) {}, | 15 traceEventsCollected(events) {}, |
17 tracingComplete() {}, | 16 tracingComplete() {}, |
18 /** | 17 /** |
19 * @param {number} usage | 18 * @param {number} usage |
20 */ | 19 */ |
21 tracingBufferUsage(usage) {}, | 20 tracingBufferUsage(usage) {}, |
22 /** | 21 /** |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 this._eventsRetrieved = 0; | 76 this._eventsRetrieved = 0; |
78 this._activeClient.tracingComplete(); | 77 this._activeClient.tracingComplete(); |
79 this._activeClient = null; | 78 this._activeClient = null; |
80 this._finishing = false; | 79 this._finishing = false; |
81 } | 80 } |
82 | 81 |
83 /** | 82 /** |
84 * @param {!SDK.TracingManagerClient} client | 83 * @param {!SDK.TracingManagerClient} client |
85 * @param {string} categoryFilter | 84 * @param {string} categoryFilter |
86 * @param {string} options | 85 * @param {string} options |
87 * @param {function(?string)=} callback | 86 * @return {!Promise} |
88 */ | 87 */ |
89 start(client, categoryFilter, options, callback) { | 88 start(client, categoryFilter, options) { |
90 if (this._activeClient) | 89 if (this._activeClient) |
91 throw new Error('Tracing is already started'); | 90 throw new Error('Tracing is already started'); |
92 var bufferUsageReportingIntervalMs = 500; | 91 var bufferUsageReportingIntervalMs = 500; |
93 this._activeClient = client; | 92 this._activeClient = client; |
94 this._target.tracingAgent().start( | 93 return this._target.tracingAgent().start( |
95 categoryFilter, options, bufferUsageReportingIntervalMs, SDK.TracingMana
ger.TransferMode.ReportEvents, | 94 categoryFilter, options, bufferUsageReportingIntervalMs, SDK.TracingMana
ger.TransferMode.ReportEvents); |
96 callback); | |
97 this._activeClient.tracingStarted(); | |
98 } | 95 } |
99 | 96 |
100 stop() { | 97 stop() { |
101 if (!this._activeClient) | 98 if (!this._activeClient) |
102 throw new Error('Tracing is not started'); | 99 throw new Error('Tracing is not started'); |
103 if (this._finishing) | 100 if (this._finishing) |
104 throw new Error('Tracing is already being stopped'); | 101 throw new Error('Tracing is already being stopped'); |
105 this._finishing = true; | 102 this._finishing = true; |
106 this._target.tracingAgent().end(); | 103 this._target.tracingAgent().end(); |
107 } | 104 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 this._tracingManager._eventsCollected(data); | 157 this._tracingManager._eventsCollected(data); |
161 } | 158 } |
162 | 159 |
163 /** | 160 /** |
164 * @override | 161 * @override |
165 */ | 162 */ |
166 tracingComplete() { | 163 tracingComplete() { |
167 this._tracingManager._tracingComplete(); | 164 this._tracingManager._tracingComplete(); |
168 } | 165 } |
169 }; | 166 }; |
OLD | NEW |