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("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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // Return a remoteInterface proxy for handle. Used by generated code | 161 // Return a remoteInterface proxy for handle. Used by generated code |
162 // for converting incoming interface parameters to proxies. | 162 // for converting incoming interface parameters to proxies. |
163 function bindHandleToProxy(handle, remoteInterface) { | 163 function bindHandleToProxy(handle, remoteInterface) { |
164 if (!core.isHandle(handle)) | 164 if (!core.isHandle(handle)) |
165 throw new Error("Not a handle " + handle); | 165 throw new Error("Not a handle " + handle); |
166 | 166 |
167 var proxy = new remoteInterface.proxyClass; | 167 var proxy = new remoteInterface.proxyClass; |
168 var router = new Router(handle); | 168 var router = new Router(handle); |
169 var connection = new BaseConnection(undefined, proxy, router); | 169 var connection = new BaseConnection(undefined, proxy, router); |
170 ProxyBindings(proxy).connection = connection; | 170 ProxyBindings(proxy).connection = connection; |
| 171 // TODO(hansmuller): Provide a way to explicitly close a proxy. |
| 172 proxy.handleStash = handle; |
171 return proxy; | 173 return proxy; |
172 } | 174 } |
173 | 175 |
174 // Return a localInterface stub for handle. Used by generated code | 176 // Return a localInterface stub for handle. Used by generated code |
175 // for converting incoming interface& request parameters to localInterface | 177 // for converting incoming interface& request parameters to localInterface |
176 // stubs. The caller can specify the stub's implementation of localInterface | 178 // stubs. The caller can specify the stub's implementation of localInterface |
177 // like this: StubBindings(stub).delegate = myStubImpl. | 179 // like this: StubBindings(stub).delegate = myStubImpl. |
178 function bindHandleToStub(handle, localInterface) { | 180 function bindHandleToStub(handle, localInterface) { |
179 if (!core.isHandle(handle)) | 181 if (!core.isHandle(handle)) |
180 throw new Error("Not a handle " + handle); | 182 throw new Error("Not a handle " + handle); |
(...skipping 12 matching lines...) Expand all Loading... |
193 // TODO(hansmuller): remove these when Shell.mojom loses its client. | 195 // TODO(hansmuller): remove these when Shell.mojom loses its client. |
194 exports.bindProxyHandle = bindProxyHandle; | 196 exports.bindProxyHandle = bindProxyHandle; |
195 exports.bindProxyClient = bindProxyClient; | 197 exports.bindProxyClient = bindProxyClient; |
196 | 198 |
197 exports.bindProxy = bindProxy; | 199 exports.bindProxy = bindProxy; |
198 exports.bindImpl = bindImpl; | 200 exports.bindImpl = bindImpl; |
199 exports.bindHandleToProxy = bindHandleToProxy; | 201 exports.bindHandleToProxy = bindHandleToProxy; |
200 exports.bindHandleToStub = bindHandleToStub; | 202 exports.bindHandleToStub = bindHandleToStub; |
201 return exports; | 203 return exports; |
202 }); | 204 }); |
OLD | NEW |