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

Unified Diff: mojo/public/js/lib/interface_endpoint_client.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/lib/control_message_proxy.js ('k') | mojo/public/js/lib/interface_endpoint_handle.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/lib/interface_endpoint_client.js
diff --git a/mojo/public/js/lib/interface_endpoint_client.js b/mojo/public/js/lib/interface_endpoint_client.js
index 631c52ec911c168410c6ff98402cdb21d4433875..b74b6d203acb5078adab193597d2932a667f092c 100644
--- a/mojo/public/js/lib/interface_endpoint_client.js
+++ b/mojo/public/js/lib/interface_endpoint_client.js
@@ -21,8 +21,8 @@ define("mojo/public/js/lib/interface_endpoint_client", [
var ControlMessageHandler = controlMessageHandler.ControlMessageHandler;
var ControlMessageProxy = controlMessageProxy.ControlMessageProxy;
var MessageReader = codec.MessageReader;
- var Validator = validator.Validator;
var InterfaceEndpointHandle = interfaceEndpointHandle.InterfaceEndpointHandle;
+ var AssociationEvent = interfaceEndpointHandle.AssociationEvent;
function InterfaceEndpointClient(interfaceEndpointHandle, receiver,
interfaceVersion) {
@@ -62,12 +62,10 @@ define("mojo/public/js/lib/interface_endpoint_client", [
InterfaceEndpointClient.prototype.onAssociationEvent = function(
associationEvent) {
- if (associationEvent ===
- InterfaceEndpointHandle.AssociationEvent.ASSOCIATED) {
+ if (associationEvent === AssociationEvent.ASSOCIATED) {
this.initControllerIfNecessary_();
} else if (associationEvent ===
- InterfaceEndpointHandle.AssociationEvent
- .PEER_CLOSED_BEFORE_ASSOCIATION) {
+ AssociationEvent.PEER_CLOSED_BEFORE_ASSOCIATION) {
timer.createOneShot(0, this.notifyError.bind(this,
this.handle_.disconnectReason()));
}
@@ -96,6 +94,11 @@ define("mojo/public/js/lib/interface_endpoint_client", [
};
InterfaceEndpointClient.prototype.accept = function(message) {
+ if (message.associatedEndpointHandles.length > 0) {
+ message.serializeAssociatedEndpointHandles(
+ this.handle_.groupController());
+ }
+
if (this.encounteredError_) {
return false;
}
@@ -106,6 +109,11 @@ define("mojo/public/js/lib/interface_endpoint_client", [
InterfaceEndpointClient.prototype.acceptAndExpectResponse = function(
message) {
+ if (message.associatedEndpointHandles.length > 0) {
+ message.serializeAssociatedEndpointHandles(
+ this.handle_.groupController());
+ }
+
if (this.encounteredError_) {
return Promise.reject();
}
@@ -144,10 +152,9 @@ define("mojo/public/js/lib/interface_endpoint_client", [
this.connectionErrorHandler_ = handler;
};
- InterfaceEndpointClient.prototype.handleIncomingMessage_ = function(
- message) {
+ InterfaceEndpointClient.prototype.handleIncomingMessage = function(message,
+ messageValidator) {
var noError = validator.validationError.NONE;
- var messageValidator = new Validator(message);
var err = noError;
for (var i = 0; err === noError && i < this.payloadValidators_.length; ++i)
err = this.payloadValidators_[i](messageValidator);
« no previous file with comments | « mojo/public/js/lib/control_message_proxy.js ('k') | mojo/public/js/lib/interface_endpoint_handle.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698