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

Unified Diff: mojo/public/js/connector.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/connector.js
diff --git a/mojo/public/js/connector.js b/mojo/public/js/connector.js
index 012e3c7c07b46b12d6490701c20144a4641a9277..d51b429d7d012e03283a43baf7fd34fc7481c39c 100644
--- a/mojo/public/js/connector.js
+++ b/mojo/public/js/connector.js
@@ -18,6 +18,7 @@ define("mojo/public/js/connector", [
this.incomingReceiver_ = null;
this.readWatcher_ = null;
this.errorHandler_ = null;
+ this.paused_ = false;
if (handle) {
this.readWatcher_ = support.watch(handle,
@@ -37,6 +38,31 @@ define("mojo/public/js/connector", [
}
};
+ Connector.prototype.pauseIncomingMethodCallProcessing = function() {
+ if (this.paused_) {
+ return;
+ }
+ this.paused_= true;
+
+ if (this.readWatcher_) {
+ support.cancelWatch(this.readWatcher_);
+ this.readWatcher_ = null;
+ }
+ };
+
+ Connector.prototype.resumeIncomingMethodCallProcessing = function() {
+ if (!this.paused_) {
+ return;
+ }
+ this.paused_= false;
+
+ if (this.handle_) {
+ this.readWatcher_ = support.watch(this.handle_,
+ core.HANDLE_SIGNAL_READABLE,
+ this.readMore_.bind(this));
+ }
+ };
+
Connector.prototype.accept = function(message) {
if (this.error_)
return false;
@@ -85,6 +111,10 @@ define("mojo/public/js/connector", [
Connector.prototype.readMore_ = function(result) {
for (;;) {
+ if (this.paused_) {
+ return;
+ }
+
var read = core.readMessage(this.handle_,
core.READ_MESSAGE_FLAG_NONE);
if (this.handle_ == null) // The connector has been closed.

Powered by Google App Engine
This is Rietveld 408576698