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

Unified Diff: mojo/public/js/bindings.js

Issue 2820783002: Add associated interfaces & bindings. (Closed)
Patch Set: Change Router.prototype.accept. Add a TODO for endpoint client not attached. Created 3 years, 8 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 | « mojo/public/js/associated_bindings.js ('k') | mojo/public/js/codec.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 a944e2f7aaf28d4cbcf8f6d9e1dfbd14cfc016f4..ed00554eb9a1036782443ef48b7b0f5e238436c4 100644
--- a/mojo/public/js/bindings.js
+++ b/mojo/public/js/bindings.js
@@ -53,7 +53,7 @@ define("mojo/public/js/bindings", [
};
InterfacePtrController.prototype.isBound = function() {
- return this.router_ !== null || this.handle_ !== null;
+ return this.interfaceEndpointClient_ !== null || this.handle_ !== null;
};
// Although users could just discard the object, reset() closes the pipe
@@ -77,9 +77,11 @@ define("mojo/public/js/bindings", [
};
InterfacePtrController.prototype.resetWithReason = function(reason) {
- this.configureProxyIfNecessary_();
- this.interfaceEndpointClient_.close(reason);
- this.interfaceEndpointClient_ = null;
+ if (this.isBound()) {
+ this.configureProxyIfNecessary_();
+ this.interfaceEndpointClient_.close(reason);
+ this.interfaceEndpointClient_ = null;
+ }
this.reset();
};
@@ -123,12 +125,11 @@ define("mojo/public/js/bindings", [
if (!this.handle_)
return;
- this.router_ = new router.Router(this.handle_);
+ this.router_ = new router.Router(this.handle_, true);
this.handle_ = null;
this.interfaceEndpointClient_ = new InterfaceEndpointClient(
- this.router_.createLocalEndpointHandle(types.kMasterInterfaceId),
- this.router_);
+ this.router_.createLocalEndpointHandle(types.kMasterInterfaceId));
this.interfaceEndpointClient_ .setPayloadValidators([
this.interfaceType_.validateResponse]);
@@ -207,8 +208,8 @@ define("mojo/public/js/bindings", [
this.stub_ = new this.interfaceType_.stubClass(this.impl_);
this.interfaceEndpointClient_ = new InterfaceEndpointClient(
this.router_.createLocalEndpointHandle(types.kMasterInterfaceId),
- this.router_, this.interfaceType_.kVersion);
- this.interfaceEndpointClient_.setIncomingReceiver(this.stub_);
+ this.stub_, this.interfaceType_.kVersion);
+
this.interfaceEndpointClient_ .setPayloadValidators([
this.interfaceType_.validateRequest]);
};
@@ -235,8 +236,7 @@ define("mojo/public/js/bindings", [
this.close();
};
- Binding.prototype.setConnectionErrorHandler
- = function(callback) {
+ Binding.prototype.setConnectionErrorHandler = function(callback) {
if (!this.isBound()) {
throw new Error("Cannot set connection error handler if not bound.");
}
« no previous file with comments | « mojo/public/js/associated_bindings.js ('k') | mojo/public/js/codec.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698