void AsyncChannel::ProcessLink::OnChannelError() { AssertIOThread(); MonitorAutoLock lock(*mChan->mMonitor); mChan->OnChannelErrorFromLink(); }
void AsyncChannel::ProcessLink::OnEchoMessage(Message* msg) { AssertIOThread(); OnMessageReceived(*msg); delete msg; }
void ProcessLink::OnChannelConnected(int32_t peer_pid) { AssertIOThread(); bool notifyChannel = false; { MonitorAutoLock lock(*mChan->mMonitor); // Only update channel state if its still thinks its opening. Do not // force it into connected if it has errored out, started closing, etc. if (mChan->mChannelState == ChannelOpening) { mChan->mChannelState = ChannelConnected; mChan->mMonitor->Notify(); notifyChannel = true; } } if (mExistingListener) mExistingListener->OnChannelConnected(peer_pid); if (notifyChannel) { mChan->OnChannelConnected(peer_pid); } }
void ProcessLink::OnEchoMessage(Message* msg) { AssertIOThread(); OnMessageReceived(Move(*msg)); delete msg; }
void ProcessLink::OnChannelConnected(int32_t peer_pid) { AssertIOThread(); bool notifyChannel = false; { MonitorAutoLock lock(*mChan->mMonitor); // Only update channel state if its still thinks its opening. Do not // force it into connected if it has errored out, started closing, etc. if (mChan->mChannelState == ChannelOpening) { mChan->mChannelState = ChannelConnected; mChan->mMonitor->Notify(); notifyChannel = true; } } if (mExistingListener) mExistingListener->OnChannelConnected(peer_pid); #ifdef MOZ_NUWA_PROCESS mIsToNuwaProcess = (peer_pid == mozilla::dom::ContentParent::NuwaPid()); #endif if (notifyChannel) { mChan->OnChannelConnected(peer_pid); } }
void SyncChannel::OnMessageReceived(const Message& msg) { AssertIOThread(); if (!msg.is_sync()) { return AsyncChannel::OnMessageReceived(msg); } MonitorAutoLock lock(mMonitor); if (MaybeInterceptSpecialIOMessage(msg)) return; if (!AwaitingSyncReply()) { // wake up the worker, there's work to do mWorkerLoop->PostTask( FROM_HERE, NewRunnableMethod(this, &SyncChannel::OnDispatchMessage, msg)); } else { // let the worker know a new sync message has arrived mRecvd = msg; NotifyWorkerThread(); } }
void AsyncChannel::ProcessLink::OnMessageReceived(const Message& msg) { AssertIOThread(); NS_ASSERTION(mChan->mChannelState != ChannelError, "Shouldn't get here!"); MonitorAutoLock lock(*mChan->mMonitor); mChan->OnMessageReceivedFromLink(msg); }
void AsyncChannel::ProcessLink::OnCloseChannel() { AssertIOThread(); mTransport->Close(); MonitorAutoLock lock(*mChan->mMonitor); mChan->mChannelState = ChannelClosed; mChan->mMonitor->Notify(); }
void ProcessLink::OnChannelError() { AssertIOThread(); MonitorAutoLock lock(*mChan->mMonitor); MOZ_ALWAYS_TRUE(this == mTransport->set_listener(mExistingListener)); mChan->OnChannelErrorFromLink(); }
void SyncChannel::OnChannelError() { AssertIOThread(); MonitorAutoLock lock(mMonitor); if (ChannelClosing != mChannelState) mChannelState = ChannelError; if (AwaitingSyncReply()) NotifyWorkerThread(); PostErrorNotifyTask(); }
void ProcessLink::OnChannelConnected(int32_t peer_pid) { AssertIOThread(); { MonitorAutoLock lock(*mChan->mMonitor); mChan->mChannelState = ChannelConnected; mChan->mMonitor->Notify(); } if (mExistingListener) mExistingListener->OnChannelConnected(peer_pid); mChan->OnChannelConnected(peer_pid); }
void ProcessLink::OnCloseChannel() { AssertIOThread(); mTransport->Close(); MonitorAutoLock lock(*mChan->mMonitor); DebugOnly<IPC::Channel::Listener*> previousListener = mTransport->set_listener(mExistingListener); // OnChannelError may have reset the listener already. MOZ_ASSERT(previousListener == this || previousListener == mExistingListener); mChan->mChannelState = ChannelClosed; mChan->mMonitor->Notify(); }
void AsyncChannel::ProcessLink::OnChannelConnected(int32 peer_pid) { AssertIOThread(); { MonitorAutoLock lock(*mChan->mMonitor); mChan->mChannelState = ChannelConnected; mChan->mMonitor->Notify(); } if(mExistingListener) mExistingListener->OnChannelConnected(peer_pid); mChan->mWorkerLoop->PostTask( FROM_HERE, NewRunnableMethod(mChan, &AsyncChannel::DispatchOnChannelConnected, peer_pid)); }
void ProcessLink::OnChannelOpened() { AssertIOThread(); { MonitorAutoLock lock(*mChan->mMonitor); mExistingListener = mTransport->set_listener(this); #ifdef DEBUG if (mExistingListener) { queue<Message> pending; mExistingListener->GetQueuedMessages(pending); MOZ_ASSERT(pending.empty()); } #endif // DEBUG mChan->mChannelState = ChannelOpening; lock.Notify(); } /*assert*/mTransport->Connect(); }
void ProcessLink::OnTakeConnectedChannel() { AssertIOThread(); queue<Message> pending; { MonitorAutoLock lock(*mChan->mMonitor); mChan->mChannelState = ChannelConnected; mExistingListener = mTransport->set_listener(this); if (mExistingListener) { mExistingListener->GetQueuedMessages(pending); } lock.Notify(); } // Dispatch whatever messages the previous listener had queued up. while (!pending.empty()) { OnMessageReceived(Move(pending.front())); pending.pop(); } }