Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(95)

Side by Side Diff: extensions/renderer/resources/data_receiver.js

Issue 628763002: Mojo JS bindings: simplify mojo.connectToService() usage - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed template indentation Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/test/data/web_ui_mojo.js ('k') | extensions/renderer/resources/data_sender.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 });
OLDNEW
« no previous file with comments | « content/test/data/web_ui_mojo.js ('k') | extensions/renderer/resources/data_sender.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698