| 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_receiver', [ | 5 define('data_receiver', [ |
| 6 'async_waiter', | 6 'async_waiter', |
| 7 'device/serial/data_stream.mojom', | 7 'device/serial/data_stream.mojom', |
| 8 'device/serial/data_stream_serialization.mojom', | 8 'device/serial/data_stream_serialization.mojom', |
| 9 'mojo/public/js/bindings/core', | 9 'mojo/public/js/bindings/core', |
| 10 'mojo/public/js/bindings/router', | 10 'mojo/public/js/bindings/router', |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 elementNumBytes: 1, | 100 elementNumBytes: 1, |
| 101 capacityNumBytes: bufferSize, | 101 capacityNumBytes: bufferSize, |
| 102 }; | 102 }; |
| 103 var receivePipe = core.createDataPipe(dataPipeOptions); | 103 var receivePipe = core.createDataPipe(dataPipeOptions); |
| 104 this.init_( | 104 this.init_( |
| 105 handle, receivePipe.consumerHandle, fatalErrorValue, 0, null, false); | 105 handle, receivePipe.consumerHandle, fatalErrorValue, 0, null, false); |
| 106 this.source_.init(receivePipe.producerHandle); | 106 this.source_.init(receivePipe.producerHandle); |
| 107 } | 107 } |
| 108 | 108 |
| 109 DataReceiver.prototype = | 109 DataReceiver.prototype = |
| 110 $Object.create(dataStream.DataSourceClientStub.prototype); | 110 $Object.create(dataStream.DataSourceClient.stubClass.prototype); |
| 111 | 111 |
| 112 /** | 112 /** |
| 113 * Closes this DataReceiver. | 113 * Closes this DataReceiver. |
| 114 */ | 114 */ |
| 115 DataReceiver.prototype.close = function() { | 115 DataReceiver.prototype.close = function() { |
| 116 if (this.shutDown_) | 116 if (this.shutDown_) |
| 117 return; | 117 return; |
| 118 this.shutDown_ = true; | 118 this.shutDown_ = true; |
| 119 this.router_.close(); | 119 this.router_.close(); |
| 120 this.waiter_.stop(); | 120 this.waiter_.stop(); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 147 /** | 147 /** |
| 148 * The [Router]{@link module:mojo/public/js/bindings/router.Router} for the | 148 * The [Router]{@link module:mojo/public/js/bindings/router.Router} for the |
| 149 * connection to the DataSource. | 149 * connection to the DataSource. |
| 150 * @private | 150 * @private |
| 151 */ | 151 */ |
| 152 this.router_ = new router.Router(source); | 152 this.router_ = new router.Router(source); |
| 153 /** | 153 /** |
| 154 * The connection to the DataSource. | 154 * The connection to the DataSource. |
| 155 * @private | 155 * @private |
| 156 */ | 156 */ |
| 157 this.source_ = new dataStream.DataSourceProxy(this.router_); | 157 this.source_ = new dataStream.DataSource.proxyClass(this.router_); |
| 158 this.router_.setIncomingReceiver(this); | 158 this.router_.setIncomingReceiver(this); |
| 159 /** | 159 /** |
| 160 * The handle to the data pipe to use for receiving data. | 160 * The handle to the data pipe to use for receiving data. |
| 161 * @private | 161 * @private |
| 162 */ | 162 */ |
| 163 this.receivePipe_ = dataPipe; | 163 this.receivePipe_ = dataPipe; |
| 164 /** | 164 /** |
| 165 * The current receive operation. | 165 * The current receive operation. |
| 166 * @type {module:data_receiver~PendingReceive} | 166 * @type {module:data_receiver~PendingReceive} |
| 167 * @private | 167 * @private |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 this.receive_ = null; | 340 this.receive_ = null; |
| 341 this.waiter_.stop(); | 341 this.waiter_.stop(); |
| 342 this.paused_ = true; | 342 this.paused_ = true; |
| 343 return; | 343 return; |
| 344 } | 344 } |
| 345 this.pendingError_ = pendingError; | 345 this.pendingError_ = pendingError; |
| 346 }; | 346 }; |
| 347 | 347 |
| 348 return {DataReceiver: DataReceiver}; | 348 return {DataReceiver: DataReceiver}; |
| 349 }); | 349 }); |
| OLD | NEW |