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

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

Issue 883953003: Mojo JS Bindings: Add support for closing Proxy and Stub connections (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « mojo/public/js/bindings.js ('k') | mojo/services/public/js/shell.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("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
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;
173 return proxy; 171 return proxy;
174 } 172 }
175 173
176 // Return a localInterface stub for handle. Used by generated code 174 // Return a localInterface stub for handle. Used by generated code
177 // for converting incoming interface& request parameters to localInterface 175 // for converting incoming interface& request parameters to localInterface
178 // stubs. The caller can specify the stub's implementation of localInterface 176 // stubs. The caller can specify the stub's implementation of localInterface
179 // like this: StubBindings(stub).delegate = myStubImpl. 177 // like this: StubBindings(stub).delegate = myStubImpl.
180 function bindHandleToStub(handle, localInterface) { 178 function bindHandleToStub(handle, localInterface) {
181 if (!core.isHandle(handle)) 179 if (!core.isHandle(handle))
182 throw new Error("Not a handle " + handle); 180 throw new Error("Not a handle " + handle);
(...skipping 12 matching lines...) Expand all
195 // TODO(hansmuller): remove these when Shell.mojom loses its client. 193 // TODO(hansmuller): remove these when Shell.mojom loses its client.
196 exports.bindProxyHandle = bindProxyHandle; 194 exports.bindProxyHandle = bindProxyHandle;
197 exports.bindProxyClient = bindProxyClient; 195 exports.bindProxyClient = bindProxyClient;
198 196
199 exports.bindProxy = bindProxy; 197 exports.bindProxy = bindProxy;
200 exports.bindImpl = bindImpl; 198 exports.bindImpl = bindImpl;
201 exports.bindHandleToProxy = bindHandleToProxy; 199 exports.bindHandleToProxy = bindHandleToProxy;
202 exports.bindHandleToStub = bindHandleToStub; 200 exports.bindHandleToStub = bindHandleToStub;
203 return exports; 201 return exports;
204 }); 202 });
OLDNEW
« no previous file with comments | « mojo/public/js/bindings.js ('k') | mojo/services/public/js/shell.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698