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

Unified Diff: mojo/public/js/lib/interface_endpoint_handle.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/interface_endpoint_client.js ('k') | mojo/public/js/lib/pipe_control_message_proxy.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_handle.js
diff --git a/mojo/public/js/lib/interface_endpoint_handle.js b/mojo/public/js/lib/interface_endpoint_handle.js
index f48b89ba85c71a372fd8d03c119a578fa8425cc8..dda951ae2322d2afff68aa987471bd83c8c54f24 100644
--- a/mojo/public/js/lib/interface_endpoint_handle.js
+++ b/mojo/public/js/lib/interface_endpoint_handle.js
@@ -92,6 +92,20 @@ define("mojo/public/js/lib/interface_endpoint_handle", [
}
};
+ State.prototype.notifyAssociation = function(interfaceId,
+ peerGroupController) {
+ var cachedPeerState = this.peerState_;
+ this.peerState_ = null;
+
+ this.pendingAssociation = false;
+
+ if (cachedPeerState) {
+ cachedPeerState.onAssociated(interfaceId, peerGroupController);
+ return true;
+ }
+ return false;
+ };
+
State.prototype.onAssociated = function(interfaceId,
associatedGroupController) {
if (!this.pendingAssociation) {
@@ -117,6 +131,14 @@ define("mojo/public/js/lib/interface_endpoint_handle", [
AssociationEvent.PEER_CLOSED_BEFORE_ASSOCIATION);
};
+ function createPairPendingAssociation() {
+ var handle0 = new InterfaceEndpointHandle();
+ var handle1 = new InterfaceEndpointHandle();
+ handle0.state_.initPendingState(handle1.state_);
+ handle1.state_.initPendingState(handle0.state_);
+ return {handle0: handle0, handle1: handle1};
+ }
+
function InterfaceEndpointHandle(interfaceId, associatedGroupController) {
this.state_ = new State(interfaceId, associatedGroupController);
}
@@ -146,13 +168,20 @@ define("mojo/public/js/lib/interface_endpoint_handle", [
this.state_.setAssociationEventHandler(handler);
};
+ InterfaceEndpointHandle.prototype.notifyAssociation = function(interfaceId,
+ peerGroupController) {
+ return this.state_.notifyAssociation(interfaceId, peerGroupController);
+ };
+
InterfaceEndpointHandle.prototype.reset = function(reason) {
this.state_.close(reason);
this.state_ = new State();
};
var exports = {};
+ exports.AssociationEvent = AssociationEvent;
exports.InterfaceEndpointHandle = InterfaceEndpointHandle;
+ exports.createPairPendingAssociation = createPairPendingAssociation;
return exports;
});
« no previous file with comments | « mojo/public/js/lib/interface_endpoint_client.js ('k') | mojo/public/js/lib/pipe_control_message_proxy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698