OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 define('data_sender', [ | 5 define('data_sender', [ |
6 'device/serial/data_stream.mojom', | 6 'device/serial/data_stream.mojom', |
7 'device/serial/data_stream_serialization.mojom', | 7 'device/serial/data_stream_serialization.mojom', |
8 'mojo/public/js/bindings/core', | 8 'mojo/public/js/core', |
9 'mojo/public/js/bindings/router', | 9 'mojo/public/js/router', |
10 ], function(dataStreamMojom, serialization, core, routerModule) { | 10 ], function(dataStreamMojom, serialization, core, routerModule) { |
11 /** | 11 /** |
12 * @module data_sender | 12 * @module data_sender |
13 */ | 13 */ |
14 | 14 |
15 /** | 15 /** |
16 * A pending send operation. | 16 * A pending send operation. |
17 * @param {!ArrayBuffer} data The data to be sent. | 17 * @param {!ArrayBuffer} data The data to be sent. |
18 * @constructor | 18 * @constructor |
19 * @alias module:data_sender~PendingSend | 19 * @alias module:data_sender~PendingSend |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 * @private | 214 * @private |
215 */ | 215 */ |
216 this.fatalErrorValue_ = fatalErrorValue; | 216 this.fatalErrorValue_ = fatalErrorValue; |
217 /** | 217 /** |
218 * Whether this DataSender has shut down. | 218 * Whether this DataSender has shut down. |
219 * @type {boolean} | 219 * @type {boolean} |
220 * @private | 220 * @private |
221 */ | 221 */ |
222 this.shutDown_ = false; | 222 this.shutDown_ = false; |
223 /** | 223 /** |
224 * The [Router]{@link module:mojo/public/js/bindings/router.Router} for the | 224 * The [Router]{@link module:mojo/public/js/router.Router} for the |
225 * connection to the DataSink. | 225 * connection to the DataSink. |
226 * @private | 226 * @private |
227 */ | 227 */ |
228 this.router_ = new routerModule.Router(sink); | 228 this.router_ = new routerModule.Router(sink); |
229 /** | 229 /** |
230 * The connection to the DataSink. | 230 * The connection to the DataSink. |
231 * @private | 231 * @private |
232 */ | 232 */ |
233 this.sink_ = new dataStreamMojom.DataSink.proxyClass(this.router_); | 233 this.sink_ = new dataStreamMojom.DataSink.proxyClass(this.router_); |
234 this.router_.setIncomingReceiver(this); | 234 this.router_.setIncomingReceiver(this); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 // Note: Only the first PendingSend in |pendingSends_| will have data to | 439 // Note: Only the first PendingSend in |pendingSends_| will have data to |
440 // flush as only the first can have sent data to the DataSink. | 440 // flush as only the first can have sent data to the DataSink. |
441 this.availableBufferCapacity_ += result.bytesToFlush; | 441 this.availableBufferCapacity_ += result.bytesToFlush; |
442 } | 442 } |
443 this.callCancelCallback_(); | 443 this.callCancelCallback_(); |
444 return Promise.resolve(); | 444 return Promise.resolve(); |
445 }; | 445 }; |
446 | 446 |
447 return {DataSender: DataSender}; | 447 return {DataSender: DataSender}; |
448 }); | 448 }); |
OLD | NEW |