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

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

Issue 2832303002: Fifo order should be preserved for messages on associated interfaces. (Closed)
Patch Set: Add string sender and use that instead of integer sender twice. 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
Index: mojo/public/js/router.js
diff --git a/mojo/public/js/router.js b/mojo/public/js/router.js
index 401a22278958e0736eb7375bf6f458b7fd0c7d19..b86daae43a969f2698e5d495bda4dd710ab09c4c 100644
--- a/mojo/public/js/router.js
+++ b/mojo/public/js/router.js
@@ -72,6 +72,7 @@ define("mojo/public/js/router", [
});
this.setInterfaceIdNamespaceBit_ = setInterfaceIdNamespaceBit;
+ this.cachedMessageData = null;
yzshen1 2017/04/24 17:30:46 nit: Please consider commenting on the meaning of
wangjimmy 2017/04/24 19:03:35 Done.
this.controlMessageHandler_ = new PipeControlMessageHandler(this);
this.controlMessageProxy_ = new PipeControlMessageProxy(this.connector_);
this.nextInterfaceIdValue_ = 1;
@@ -132,6 +133,18 @@ define("mojo/public/js/router", [
endpoint.client.notifyError.bind(endpoint.client));
}
+ if (this.cachedMessageData && interfaceEndpointHandle.id() ===
+ this.cachedMessageData.message.getInterfaceId()) {
+ var ok = interfaceEndpointClient.handleIncomingMessage(
yzshen1 2017/04/24 17:30:45 We are not supposed to call it synchronously. Beca
wangjimmy 2017/04/24 19:03:35 Done.
+ this.cachedMessageData.message,
+ this.cachedMessageData.messageValidator);
+
+ if (!ok) {
+ this.handleInvalidIncomingMessage_();
+ }
+ this.connector_.resumeIncomingMethodCallProcessing();
+ }
+
return endpoint;
};
@@ -199,8 +212,9 @@ define("mojo/public/js/router", [
if (!endpoint.client) {
// We need to wait until a client is attached in order to dispatch
// further messages.
- // TODO(wangjimmy): Cache the message and send when the appropriate
- // endpoint client is attached.
+ this.cachedMessageData = {message: message,
+ messageValidator: messageValidator};
+ this.connector_.pauseIncomingMethodCallProcessing();
return false;
yzshen1 2017/04/24 17:30:45 I think we should return "true" to mean "the messa
wangjimmy 2017/04/24 19:03:35 Done.
}
ok = endpoint.client.handleIncomingMessage(message, messageValidator);

Powered by Google App Engine
This is Rietveld 408576698