Backed out changeset 0d358cdf1ce4 (bug 1237458) for bustage

This commit is contained in:
Carsten "Tomcat" Book 2016-02-05 08:13:50 +01:00
parent 97f2ae4d14
commit 8dc2b46544
2 changed files with 51 additions and 52 deletions

View File

@ -149,12 +149,12 @@ public:
mDirection(direction),
mMoved(false)
{
MOZ_RELEASE_ASSERT(mMessageName);
MOZ_ASSERT(mMessageName);
}
InterruptFrame(InterruptFrame&& aOther)
{
MOZ_RELEASE_ASSERT(aOther.mMessageName);
MOZ_ASSERT(aOther.mMessageName);
mMessageName = aOther.mMessageName;
aOther.mMessageName = nullptr;
aOther.mMoved = true;
@ -166,7 +166,7 @@ public:
~InterruptFrame()
{
MOZ_RELEASE_ASSERT(mMessageName || mMoved);
MOZ_ASSERT_IF(!mMessageName, mMoved);
}
InterruptFrame& operator=(InterruptFrame&& aOther)
@ -213,7 +213,7 @@ private:
int32_t mMessageRoutingId;
Semantics mMesageSemantics;
Direction mDirection;
bool mMoved;
DebugOnly<bool> mMoved;
// Disable harmful methods.
InterruptFrame(const InterruptFrame& aOther) = delete;
@ -248,7 +248,7 @@ public:
~CxxStackFrame() {
mThat.AssertWorkerThread();
MOZ_RELEASE_ASSERT(!mThat.mCxxStackFrames.empty());
MOZ_ASSERT(!mThat.mCxxStackFrames.empty());
const InterruptFrame& frame = mThat.mCxxStackFrames.back();
bool exitingSync = frame.IsOutgoingSync();
@ -328,7 +328,7 @@ MessageChannel::MessageChannel(MessageListener *aListener)
#ifdef OS_WIN
mEvent = CreateEventW(nullptr, TRUE, FALSE, nullptr);
MOZ_RELEASE_ASSERT(mEvent, "CreateEvent failed! Nothing is going to work!");
NS_ASSERTION(mEvent, "CreateEvent failed! Nothing is going to work!");
#endif
}
@ -338,7 +338,7 @@ MessageChannel::~MessageChannel()
IPC_ASSERT(mCxxStackFrames.empty(), "mismatched CxxStackFrame ctor/dtors");
#ifdef OS_WIN
DebugOnly<BOOL> ok = CloseHandle(mEvent);
MOZ_RELEASE_ASSERT(ok);
MOZ_ASSERT(ok);
#endif
Clear();
}
@ -466,7 +466,7 @@ MessageChannel::Open(MessageChannel *aTargetChan, MessageLoop *aTargetLoop, Side
while (ChannelOpening == mChannelState)
mMonitor->Wait();
MOZ_RELEASE_ASSERT(ChannelConnected == mChannelState, "not connected when awoken");
NS_ASSERTION(ChannelConnected == mChannelState, "not connected when awoken");
return (ChannelConnected == mChannelState);
}
@ -483,8 +483,8 @@ MessageChannel::OnOpenAsSlave(MessageChannel *aTargetChan, Side aSide)
mMonitor = aTargetChan->mMonitor;
MonitorAutoLock lock(*mMonitor);
MOZ_RELEASE_ASSERT(ChannelOpening == aTargetChan->mChannelState,
"Target channel not in the process of opening");
NS_ASSERTION(ChannelOpening == aTargetChan->mChannelState,
"Target channel not in the process of opening");
mChannelState = ChannelConnected;
aTargetChan->mChannelState = ChannelConnected;
aTargetChan->mMonitor->Notify();
@ -596,7 +596,7 @@ MessageChannel::ShouldDeferMessage(const Message& aMsg)
// Unless they're urgent, we always defer async messages.
if (!aMsg.is_sync()) {
MOZ_RELEASE_ASSERT(aMsg.priority() == IPC::Message::PRIORITY_NORMAL);
MOZ_ASSERT(aMsg.priority() == IPC::Message::PRIORITY_NORMAL);
return true;
}
@ -658,10 +658,10 @@ MessageChannel::OnMessageReceivedFromLink(const Message& aMsg)
return;
}
MOZ_RELEASE_ASSERT(aMsg.transaction_id() == mCurrentTransaction);
MOZ_RELEASE_ASSERT(AwaitingSyncReply());
MOZ_RELEASE_ASSERT(!mRecvd);
MOZ_RELEASE_ASSERT(!mTimedOutMessageSeqno);
MOZ_ASSERT(aMsg.transaction_id() == mCurrentTransaction);
MOZ_ASSERT(AwaitingSyncReply());
MOZ_ASSERT(!mRecvd);
MOZ_ASSERT(!mTimedOutMessageSeqno);
// Rather than storing errors in mRecvd, we mark them in
// mRecvdErrors. We need a counter because multiple replies can arrive
@ -683,8 +683,8 @@ MessageChannel::OnMessageReceivedFromLink(const Message& aMsg)
}
// Prioritized messages cannot be compressed.
MOZ_RELEASE_ASSERT(aMsg.compress_type() == IPC::Message::COMPRESSION_NONE ||
aMsg.priority() == IPC::Message::PRIORITY_NORMAL);
MOZ_ASSERT_IF(aMsg.compress_type() != IPC::Message::COMPRESSION_NONE,
aMsg.priority() == IPC::Message::PRIORITY_NORMAL);
bool compress = false;
if (aMsg.compress_type() == IPC::Message::COMPRESSION_ENABLED) {
@ -695,8 +695,8 @@ MessageChannel::OnMessageReceivedFromLink(const Message& aMsg)
// This message type has compression enabled, and the back of the
// queue was the same message type and routed to the same destination.
// Replace it with the newer message.
MOZ_RELEASE_ASSERT(mPending.back().compress_type() ==
IPC::Message::COMPRESSION_ENABLED);
MOZ_ASSERT(mPending.back().compress_type() ==
IPC::Message::COMPRESSION_ENABLED);
mPending.pop_back();
}
} else if (aMsg.compress_type() == IPC::Message::COMPRESSION_ALL) {
@ -709,7 +709,7 @@ MessageChannel::OnMessageReceivedFromLink(const Message& aMsg)
// Erase it. Note that, since we always compress these redundancies, There Can
// Be Only One.
compress = true;
MOZ_RELEASE_ASSERT((*it).compress_type() == IPC::Message::COMPRESSION_ALL);
MOZ_ASSERT((*it).compress_type() == IPC::Message::COMPRESSION_ALL);
mPending.erase((++it).base());
}
}
@ -787,8 +787,8 @@ MessageChannel::ProcessPendingRequests(int seqno, int transaction)
for (MessageQueue::iterator it = mPending.begin(); it != mPending.end(); ) {
Message &msg = *it;
MOZ_RELEASE_ASSERT(mCurrentTransaction == transaction,
"Calling ShouldDeferMessage when cancelled");
MOZ_ASSERT(mCurrentTransaction == transaction,
"Calling ShouldDeferMessage when cancelled");
bool defer = ShouldDeferMessage(msg);
// Only log the interesting messages.
@ -883,7 +883,7 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
// Generally only the parent dispatches urgent messages. And the only
// sync messages it can send are high-priority. Mainly we want to ensure
// here that we don't return false for non-CPOW messages.
MOZ_RELEASE_ASSERT(msg->priority() == IPC::Message::PRIORITY_HIGH);
MOZ_ASSERT(msg->priority() == IPC::Message::PRIORITY_HIGH);
IPC_LOG("Sending while dispatching urgent message");
mLastSendError = SyncSendError::SendingCPOWWhileDispatchingUrgent;
return false;
@ -893,7 +893,7 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
(msg->priority() < DispatchingSyncMessagePriority() ||
msg->priority() < AwaitingSyncReplyPriority()))
{
MOZ_RELEASE_ASSERT(DispatchingSyncMessage() || DispatchingAsyncMessage());
MOZ_ASSERT(DispatchingSyncMessage() || DispatchingAsyncMessage());
IPC_LOG("Cancel from Send");
CancelMessage *cancel = new CancelMessage(mCurrentTransaction);
CancelTransaction(mCurrentTransaction);
@ -924,7 +924,7 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
int32_t seqno = msg->seqno();
int prio = msg->priority();
msgid_t replyType = msg->type() + 1;
DebugOnly<msgid_t> replyType = msg->type() + 1;
AutoSetValue<bool> replies(mAwaitingSyncReply, true);
AutoSetValue<int> prioSet(mAwaitingSyncReplyPriority, prio);
@ -967,9 +967,9 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
break;
}
MOZ_RELEASE_ASSERT(!mTimedOutMessageSeqno);
MOZ_ASSERT(!mTimedOutMessageSeqno);
MOZ_RELEASE_ASSERT(mCurrentTransaction == transaction);
MOZ_ASSERT(mCurrentTransaction == transaction);
bool maybeTimedOut = !WaitForSyncNotify(handleWindowsMessages);
if (!Connected()) {
@ -1015,12 +1015,12 @@ MessageChannel::Send(Message* aMsg, Message* aReply)
}
}
MOZ_RELEASE_ASSERT(mRecvd);
MOZ_RELEASE_ASSERT(mRecvd->is_reply(), "expected reply");
MOZ_RELEASE_ASSERT(!mRecvd->is_reply_error());
MOZ_RELEASE_ASSERT(mRecvd->seqno() == seqno);
MOZ_RELEASE_ASSERT(mRecvd->type() == replyType, "wrong reply type");
MOZ_RELEASE_ASSERT(mRecvd->is_sync());
MOZ_ASSERT(mRecvd);
MOZ_ASSERT(mRecvd->is_reply(), "expected reply");
MOZ_ASSERT(!mRecvd->is_reply_error());
MOZ_ASSERT(mRecvd->type() == replyType, "wrong reply type");
MOZ_ASSERT(mRecvd->seqno() == seqno);
MOZ_ASSERT(mRecvd->is_sync());
*aReply = Move(*mRecvd);
mRecvd = nullptr;
@ -1348,7 +1348,7 @@ MessageChannel::OnMaybeDequeueOne()
}
// We should not be in a transaction yet if we're not blocked.
MOZ_RELEASE_ASSERT(mCurrentTransaction == 0);
MOZ_ASSERT(mCurrentTransaction == 0);
DispatchMessage(recvd);
return true;
@ -1369,7 +1369,7 @@ MessageChannel::DispatchMessage(const Message &aMsg)
AutoEnterTransaction transaction(this, aMsg);
int id = aMsg.transaction_id();
MOZ_RELEASE_ASSERT(!aMsg.is_sync() || id == mCurrentTransaction);
MOZ_ASSERT_IF(aMsg.is_sync(), id == mCurrentTransaction);
{
MonitorAutoUnlock unlock(*mMonitor);
@ -1401,7 +1401,7 @@ MessageChannel::DispatchSyncMessage(const Message& aMsg, Message*& aReply)
int prio = aMsg.priority();
MOZ_RELEASE_ASSERT(prio == IPC::Message::PRIORITY_NORMAL || NS_IsMainThread());
MOZ_ASSERT_IF(prio > IPC::Message::PRIORITY_NORMAL, NS_IsMainThread());
MessageChannel* dummy;
MessageChannel*& blockingVar = mSide == ChildSide && NS_IsMainThread() ? gParentProcessBlocker : dummy;
@ -1429,7 +1429,7 @@ void
MessageChannel::DispatchAsyncMessage(const Message& aMsg)
{
AssertWorkerThread();
MOZ_RELEASE_ASSERT(!aMsg.is_interrupt() && !aMsg.is_sync());
MOZ_ASSERT(!aMsg.is_interrupt() && !aMsg.is_sync());
if (aMsg.routing_id() == MSG_ROUTING_NONE) {
NS_RUNTIMEABORT("unhandled special message!");
@ -1548,7 +1548,7 @@ MessageChannel::MaybeUndeferIncall()
IPC_ASSERT(0 < mRemoteStackDepthGuess, "fatal logic error");
--mRemoteStackDepthGuess;
MOZ_RELEASE_ASSERT(call.priority() == IPC::Message::PRIORITY_NORMAL);
MOZ_ASSERT(call.priority() == IPC::Message::PRIORITY_NORMAL);
mPending.push_back(call);
}
@ -1697,7 +1697,7 @@ MessageChannel::SetReplyTimeoutMs(int32_t aTimeoutMs)
void
MessageChannel::OnChannelConnected(int32_t peer_id)
{
MOZ_RELEASE_ASSERT(!mPeerPidSet);
MOZ_ASSERT(!mPeerPidSet);
mPeerPidSet = true;
mPeerPid = peer_id;
mWorkerLoop->PostTask(FROM_HERE, new DequeueTask(mOnChannelConnectedTask));
@ -1707,7 +1707,7 @@ void
MessageChannel::DispatchOnChannelConnected()
{
AssertWorkerThread();
MOZ_RELEASE_ASSERT(mPeerPidSet);
MOZ_ASSERT(mPeerPidSet);
if (mListener)
mListener->OnChannelConnected(mPeerPid);
}
@ -2061,7 +2061,7 @@ MessageChannel::DumpInterruptStack(const char* const pfx) const
int32_t
MessageChannel::GetTopmostMessageRoutingId() const
{
MOZ_RELEASE_ASSERT(MessageLoop::current() == mWorkerLoop);
MOZ_ASSERT(MessageLoop::current() == mWorkerLoop);
if (mCxxStackFrames.empty()) {
return MSG_ROUTING_NONE;
}
@ -2147,20 +2147,20 @@ MessageChannel::CancelTransaction(int transaction)
// 2. Parent times out H.
// 3. Child dispatches H and sends nested message H' (same transaction).
// 4. Parent dispatches H' and cancels.
MOZ_RELEASE_ASSERT(!mCurrentTransaction || mCurrentTransaction == transaction);
MOZ_ASSERT_IF(mCurrentTransaction, mCurrentTransaction == transaction);
mCurrentTransaction = 0;
// During a timeout Send should always fail.
MOZ_RELEASE_ASSERT(!mAwaitingSyncReply);
MOZ_ASSERT(!mAwaitingSyncReply);
} else {
MOZ_RELEASE_ASSERT(mCurrentTransaction == transaction);
MOZ_ASSERT(mCurrentTransaction == transaction);
mCurrentTransaction = 0;
mAwaitingSyncReply = false;
mAwaitingSyncReplyPriority = 0;
}
bool foundSync = false;
DebugOnly<bool> foundSync = false;
for (MessageQueue::iterator it = mPending.begin(); it != mPending.end(); ) {
Message &msg = *it;
@ -2172,8 +2172,8 @@ MessageChannel::CancelTransaction(int transaction)
// avoid processing messages out of order in the short time before it
// crashes.
if (msg.is_sync() && msg.priority() != IPC::Message::PRIORITY_NORMAL) {
MOZ_RELEASE_ASSERT(!foundSync);
MOZ_RELEASE_ASSERT(msg.transaction_id() != transaction);
MOZ_ASSERT(!foundSync);
MOZ_ASSERT(msg.transaction_id() != transaction);
IPC_LOG("Removing msg from queue seqno=%d xid=%d", msg.seqno(), msg.transaction_id());
foundSync = true;
it = mPending.erase(it);
@ -2207,7 +2207,7 @@ MessageChannel::CancelCurrentTransaction()
}
IPC_LOG("Cancel requested: current xid=%d", mCurrentTransaction);
MOZ_RELEASE_ASSERT(DispatchingSyncMessage());
MOZ_ASSERT(DispatchingSyncMessage());
CancelMessage *cancel = new CancelMessage(mCurrentTransaction);
CancelTransaction(mCurrentTransaction);
mLink->SendMessage(cancel);

View File

@ -624,9 +624,8 @@ class MessageChannel : HasResultCodes
if (!aMessage.is_sync())
return;
MOZ_DIAGNOSTIC_ASSERT(
!(mChan->mSide == ParentSide && mOldTransaction != aMessage.transaction_id()) ||
!mOldTransaction || aMessage.priority() > mChan->AwaitingSyncReplyPriority());
MOZ_ASSERT_IF(mChan->mSide == ParentSide && mOldTransaction != aMessage.transaction_id(),
!mOldTransaction || aMessage.priority() > mChan->AwaitingSyncReplyPriority());
mChan->mCurrentTransaction = aMessage.transaction_id();
}
~AutoEnterTransaction() {
@ -777,7 +776,7 @@ class MessageChannel : HasResultCodes
// safely. This is necessary to be able to cancel notification if we are
// closed at the same time.
RefPtr<RefCountedTask> mOnChannelConnectedTask;
bool mPeerPidSet;
DebugOnly<bool> mPeerPidSet;
int32_t mPeerPid;
};