bug 517923: support serializing ns*Strings that represent NULL, use this mechanism in PluginInstanceParent/PluginModuleChild. also add basic crash-handling to *Channel code and some NS_OVERRIDE annotations.
This commit is contained in:
@@ -59,18 +59,26 @@ SyncChannel::Send(Message* msg, Message* reply)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(!ProcessingSyncMessage(),
|
||||
"violation of sync handler invariant");
|
||||
NS_ASSERTION(ChannelConnected == mChannelState,
|
||||
"trying to Send() to a channel not yet open");
|
||||
NS_PRECONDITION(msg->is_sync(), "can only Send() sync messages here");
|
||||
NS_ABORT_IF_FALSE(msg->is_sync(), "can only Send() sync messages here");
|
||||
|
||||
if (!Connected())
|
||||
// trying to Send() to a closed or error'd channel
|
||||
return false;
|
||||
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
mPendingReply = msg->type() + 1;
|
||||
/*assert*/AsyncChannel::Send(msg);
|
||||
if (!AsyncChannel::Send(msg))
|
||||
// FIXME more sophisticated error handling
|
||||
return false;
|
||||
|
||||
// wait for the next sync message to arrive
|
||||
mCvar.Wait();
|
||||
|
||||
if (!Connected())
|
||||
// FIXME more sophisticated error handling
|
||||
return false;
|
||||
|
||||
// we just received a synchronous message from the other side.
|
||||
// If it's not the reply we were awaiting, there's a serious
|
||||
// error: either a mistimed/malformed message or a sync in-message
|
||||
@@ -156,6 +164,22 @@ SyncChannel::OnMessageReceived(const Message& msg)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SyncChannel::OnChannelError()
|
||||
{
|
||||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
mChannelState = ChannelError;
|
||||
|
||||
if (AwaitingSyncReply()) {
|
||||
mCvar.Notify();
|
||||
}
|
||||
}
|
||||
|
||||
return AsyncChannel::OnChannelError();
|
||||
}
|
||||
|
||||
void
|
||||
SyncChannel::OnSendReply(Message* aReply)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user