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

Side by Side Diff: mojo/public/js/connection.js

Issue 2020463002: Mojo JS: Attempt to simplify bindTo* related code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename Created 4 years, 6 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 | « chrome/test/data/webui/plugins_browsertest.js ('k') | no next file » | 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("mojo/public/js/connection", [ 5 define("mojo/public/js/connection", [
6 "mojo/public/js/bindings", 6 "mojo/public/js/bindings",
7 "mojo/public/js/connector", 7 "mojo/public/js/connector",
8 "mojo/public/js/core", 8 "mojo/public/js/core",
9 "mojo/public/js/router", 9 "mojo/public/js/router",
10 ], function(bindings, connector, core, router) { 10 ], function(bindings, connector, core, router) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (!core.isHandle(handle)) 141 if (!core.isHandle(handle))
142 throw new Error("Not a handle " + handle); 142 throw new Error("Not a handle " + handle);
143 143
144 var stub = new localInterface.stubClass; 144 var stub = new localInterface.stubClass;
145 var router = new Router(handle); 145 var router = new Router(handle);
146 var connection = new BaseConnection(stub, undefined, router); 146 var connection = new BaseConnection(stub, undefined, router);
147 StubBindings(stub).connection = connection; 147 StubBindings(stub).connection = connection;
148 return stub; 148 return stub;
149 } 149 }
150 150
151 /**
152 * Creates a messape pipe and links one end of the pipe to the given object.
153 * @param {!Object} obj The object to create a handle for. Must be a subclass
154 * of an auto-generated stub class.
155 * @return {!MojoHandle} The other (not yet connected) end of the message
156 * pipe.
157 */
158 function bindStubDerivedImpl(obj) {
159 var pipe = core.createMessagePipe();
160 var router = new Router(pipe.handle0);
161 var connection = new BaseConnection(obj, undefined, router);
162 obj.connection = connection;
163 return pipe.handle1;
164 }
165
151 var exports = {}; 166 var exports = {};
152 exports.Connection = Connection; 167 exports.Connection = Connection;
153 exports.TestConnection = TestConnection; 168 exports.TestConnection = TestConnection;
154 169
155 exports.bindProxy = bindProxy; 170 exports.bindProxy = bindProxy;
156 exports.bindImpl = bindImpl; 171 exports.bindImpl = bindImpl;
157 exports.bindHandleToProxy = bindHandleToProxy; 172 exports.bindHandleToProxy = bindHandleToProxy;
158 exports.bindHandleToStub = bindHandleToStub; 173 exports.bindHandleToStub = bindHandleToStub;
174 exports.bindStubDerivedImpl = bindStubDerivedImpl;
159 return exports; 175 return exports;
160 }); 176 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/plugins_browsertest.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698