Bug 1240985 - Stop returning MsgNotAllowed (r=dvander)
authorBill McCloskey <billm@mozilla.com>
Tue, 19 Jan 2016 17:37:10 -0800
changeset 281002 cda5277636b647782aff619cd1c46e614bb06e17
parent 281001 908c5be531aebd2fbad4fded78008b6cd9c73a8a
child 281003 aac985c600521f0f119c57c4731a636acaeaaae3
push id29925
push userkwierso@gmail.com
push dateFri, 22 Jan 2016 00:27:20 +0000
treeherdermozilla-central@cea2883034cb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs1240985
milestone46.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1240985 - Stop returning MsgNotAllowed (r=dvander)
ipc/glue/MessageChannel.cpp
ipc/glue/MessageChannel.h
--- a/ipc/glue/MessageChannel.cpp
+++ b/ipc/glue/MessageChannel.cpp
@@ -322,17 +322,16 @@ MessageChannel::MessageChannel(MessageLi
     mAwaitingSyncReply(false),
     mAwaitingSyncReplyPriority(0),
     mDispatchingSyncMessage(false),
     mDispatchingSyncMessagePriority(0),
     mDispatchingAsyncMessage(false),
     mDispatchingAsyncMessagePriority(0),
     mCurrentTransaction(0),
     mTimedOutMessageSeqno(0),
-    mTimedOutMessagePriority(0),
     mRecvdErrors(0),
     mRemoteStackDepthGuess(false),
     mSawInterruptOutMsg(false),
     mIsWaitingForIncoming(false),
     mAbortOnError(false),
     mBlockScripts(false),
     mFlags(REQUIRE_DEFAULT),
     mPeerPidSet(false),
@@ -1038,17 +1037,16 @@ MessageChannel::Send(Message* aMsg, Mess
                 mRecvdErrors--;
                 return false;
             }
             if (mRecvd) {
                 break;
             }
 
             mTimedOutMessageSeqno = seqno;
-            mTimedOutMessagePriority = prio;
             return false;
         }
     }
 
     MOZ_ASSERT(mRecvd);
     MOZ_ASSERT(mRecvd->is_reply(), "expected reply");
     MOZ_ASSERT(!mRecvd->is_reply_error());
     MOZ_ASSERT(mRecvd->type() == replyType, "wrong reply type");
@@ -1408,32 +1406,17 @@ MessageChannel::DispatchSyncMessage(cons
     // no longer blocked.
     MOZ_ASSERT_IF(prio > IPC::Message::PRIORITY_NORMAL, NS_IsMainThread());
     MaybeScriptBlocker scriptBlocker(this, prio > IPC::Message::PRIORITY_NORMAL);
 
     MessageChannel* dummy;
     MessageChannel*& blockingVar = ShouldBlockScripts() ? gParentProcessBlocker : dummy;
 
     Result rv;
-    if (mTimedOutMessageSeqno && mTimedOutMessagePriority >= prio) {
-        // If the other side sends a message in response to one of our messages
-        // that we've timed out, then we reply with an error.
-        //
-        // We do this because want to avoid a situation where we process an
-        // incoming message from the child here while it simultaneously starts
-        // processing our timed-out CPOW. It's very bad for both sides to
-        // be processing sync messages concurrently.
-        //
-        // The only exception is if the incoming message has urgent priority and
-        // our timed-out message had only high priority. In that case it's safe
-        // to process the incoming message because we know that the child won't
-        // process anything (the child will defer incoming messages when waiting
-        // for a response to its urgent message).
-        rv = MsgNotAllowed;
-    } else {
+    {
         AutoSetValue<MessageChannel*> blocked(blockingVar, this);
         AutoSetValue<bool> sync(mDispatchingSyncMessage, true);
         AutoSetValue<int> prioSet(mDispatchingSyncMessagePriority, prio);
         rv = mListener->OnMessageReceived(aMsg, aReply);
     }
 
     if (!MaybeHandleError(rv, aMsg, "DispatchSyncMessage")) {
         aReply = new Message();
--- a/ipc/glue/MessageChannel.h
+++ b/ipc/glue/MessageChannel.h
@@ -625,17 +625,16 @@ class MessageChannel : HasResultCodes
     // side is responsible for replying to all sync messages sent by the other
     // side when it dispatches the timed out message. The response is always an
     // error.
     //
     // A message is only timed out if it initiated a transaction. This avoids
     // hitting a lot of corner cases with message nesting that we don't really
     // care about.
     int32_t mTimedOutMessageSeqno;
-    int mTimedOutMessagePriority;
 
     // If waiting for the reply to a sync out-message, it will be saved here
     // on the I/O thread and then read and cleared by the worker thread.
     nsAutoPtr<Message> mRecvd;
 
     // If a sync message reply that is an error arrives, we increment this
     // counter rather than storing it in mRecvd.
     size_t mRecvdErrors;