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 * @implements {Common.OutputStream} | 5 * @implements {Common.OutputStream} |
6 * @implements {Bindings.OutputStreamDelegate} | 6 * @implements {Bindings.OutputStreamDelegate} |
7 * @unrestricted | 7 * @unrestricted |
8 */ | 8 */ |
9 Timeline.TimelineLoader = class { | 9 Timeline.TimelineLoader = class { |
10 /** | 10 /** |
11 * @param {!Timeline.TimelineLoader.Client} client | 11 * @param {!Timeline.TimelineLoader.Client} client |
12 */ | 12 */ |
13 constructor(client) { | 13 constructor(client) { |
14 this._client = client; | 14 this._client = client; |
15 | 15 |
16 this._backingStorage = new Bindings.TempFileBackingStorage('tracing'); | 16 this._backingStorage = new Bindings.TempFileBackingStorage('tracing'); |
17 this._tracingModel = new SDK.TracingModel(this._backingStorage); | 17 this._tracingModel = new SDK.TracingModel(this._backingStorage); |
18 | 18 |
19 /** @type {?function()} */ | 19 /** @type {?function()} */ |
20 this._canceledCallback = null; | 20 this._canceledCallback = null; |
21 this._state = Timeline.TimelineLoader.State.Initial; | 21 this._state = Timeline.TimelineLoader.State.Initial; |
22 this._buffer = ''; | 22 this._buffer = ''; |
23 this._firstRawChunk = true; | 23 this._firstRawChunk = true; |
24 this._firstChunk = true; | 24 this._firstChunk = true; |
25 | 25 |
26 this._loadedBytes = 0; | 26 this._loadedBytes = 0; |
27 /** @type {number} */ | 27 /** @type {number} */ |
28 this._totalSize; | 28 this._totalSize; |
29 this._jsonTokenizer = new Common.TextUtils.BalancedJSONTokenizer(this._write
BalancedJSON.bind(this), true); | 29 this._jsonTokenizer = new TextUtils.TextUtils.BalancedJSONTokenizer(this._wr
iteBalancedJSON.bind(this), true); |
30 } | 30 } |
31 | 31 |
32 /** | 32 /** |
33 * @param {!File} file | 33 * @param {!File} file |
34 * @param {!Timeline.TimelineLoader.Client} client | 34 * @param {!Timeline.TimelineLoader.Client} client |
35 * @return {!Timeline.TimelineLoader} | 35 * @return {!Timeline.TimelineLoader} |
36 */ | 36 */ |
37 static loadFromFile(file, client) { | 37 static loadFromFile(file, client) { |
38 var loader = new Timeline.TimelineLoader(client); | 38 var loader = new Timeline.TimelineLoader(client); |
39 var fileReader = Timeline.TimelineLoader._createFileReader(file, loader); | 39 var fileReader = Timeline.TimelineLoader._createFileReader(file, loader); |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 * @override | 318 * @override |
319 * @param {!Bindings.ChunkedReader} reader | 319 * @param {!Bindings.ChunkedReader} reader |
320 * @param {!Event} event | 320 * @param {!Event} event |
321 */ | 321 */ |
322 onError(reader, event) { | 322 onError(reader, event) { |
323 var error = event.target.error; | 323 var error = event.target.error; |
324 Common.console.error( | 324 Common.console.error( |
325 Common.UIString('Failed to save timeline: %s (%s, %s)', error.message, e
rror.name, error.code)); | 325 Common.UIString('Failed to save timeline: %s (%s, %s)', error.message, e
rror.name, error.code)); |
326 } | 326 } |
327 }; | 327 }; |
OLD | NEW |