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

Unified Diff: mojo/public/js/bindings.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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | mojo/public/js/connection.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/bindings.js
diff --git a/mojo/public/js/bindings.js b/mojo/public/js/bindings.js
index c6c98d5ff713ee9d574ffec0318009f09a8819e0..44aa9f4e9fed6529dbfa495db9712c939e01d38e 100644
--- a/mojo/public/js/bindings.js
+++ b/mojo/public/js/bindings.js
@@ -4,7 +4,8 @@
define("mojo/public/js/bindings", [
"mojo/public/js/router",
-], function(router) {
+ "mojo/public/js/core",
+], function(router, core) {
var Router = router.Router;
@@ -30,12 +31,31 @@ define("mojo/public/js/bindings", [
throw new Error("no stub object");
}
+ function connectionHandle(connection) {
+ return connection &&
+ connection.router &&
+ connection.router.connector_ &&
+ connection.router.connector_.handle_;
+ }
+
+ ProxyProperties.prototype.close = function() {
+ var handle = connectionHandle(this.connection);
+ if (handle)
+ core.close(handle);
+ }
+
// Public stub class properties that are managed at runtime by the JS
// bindings. See StubBindings below.
function StubProperties(delegate) {
this.delegate = delegate;
}
+ StubProperties.prototype.close = function() {
+ var handle = connectionHandle(this.connection);
+ if (handle)
+ core.close(handle);
+ }
+
// The base class for generated proxy classes.
function ProxyBase(receiver) {
this[kProxyProperties] = new ProxyProperties(receiver);
« no previous file with comments | « no previous file | mojo/public/js/connection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698