2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2018-11-30 18:39:55 +03:00
|
|
|
* vim: sw=2 ts=4 et :
|
2013-09-28 05:42:08 +04:00
|
|
|
*/
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "mozilla/ipc/MessageLink.h"
|
|
|
|
#include "mozilla/ipc/MessageChannel.h"
|
|
|
|
#include "mozilla/ipc/BrowserProcessSubThread.h"
|
|
|
|
#include "mozilla/ipc/ProtocolUtils.h"
|
2016-05-05 03:38:53 +03:00
|
|
|
#include "chrome/common/ipc_channel.h"
|
2020-02-07 01:41:56 +03:00
|
|
|
#include "base/task.h"
|
2013-09-28 05:42:08 +04:00
|
|
|
|
2014-08-09 05:19:33 +04:00
|
|
|
#include "mozilla/Assertions.h"
|
2014-08-11 21:09:30 +04:00
|
|
|
#include "mozilla/DebugOnly.h"
|
2013-09-28 05:42:08 +04:00
|
|
|
#include "nsDebug.h"
|
2016-05-23 21:15:47 +03:00
|
|
|
#include "nsExceptionHandler.h"
|
2014-02-27 01:36:35 +04:00
|
|
|
#include "nsISupportsImpl.h"
|
2017-03-14 14:29:43 +03:00
|
|
|
#include "nsPrintfCString.h"
|
2013-09-28 05:42:08 +04:00
|
|
|
#include "nsXULAppAPI.h"
|
|
|
|
|
|
|
|
using namespace mozilla;
|
|
|
|
|
|
|
|
// We rely on invariants about the lifetime of the transport:
|
|
|
|
//
|
|
|
|
// - outlives this MessageChannel
|
|
|
|
// - deleted on the IO thread
|
|
|
|
//
|
|
|
|
// These invariants allow us to send messages directly through the
|
|
|
|
// transport without having to worry about orphaned Send() tasks on
|
|
|
|
// the IO thread touching MessageChannel memory after it's been deleted
|
|
|
|
// on the worker thread. We also don't need to refcount the
|
|
|
|
// Transport, because whatever task triggers its deletion only runs on
|
|
|
|
// the IO thread, and only runs after this MessageChannel is done with
|
|
|
|
// the Transport.
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace ipc {
|
|
|
|
|
|
|
|
MessageLink::MessageLink(MessageChannel* aChan) : mChan(aChan) {}
|
|
|
|
|
|
|
|
MessageLink::~MessageLink() {
|
2014-08-09 05:19:33 +04:00
|
|
|
#ifdef DEBUG
|
2013-09-28 05:42:08 +04:00
|
|
|
mChan = nullptr;
|
2014-08-09 05:19:33 +04:00
|
|
|
#endif
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ProcessLink::ProcessLink(MessageChannel* aChan)
|
2020-02-07 01:41:56 +03:00
|
|
|
: MessageLink(aChan), mIOLoop(nullptr), mExistingListener(nullptr) {}
|
2013-09-28 05:42:08 +04:00
|
|
|
|
|
|
|
ProcessLink::~ProcessLink() {
|
2020-02-07 01:41:56 +03:00
|
|
|
// Dispatch the delete of the transport to the IO thread.
|
|
|
|
RefPtr<DeleteTask<IPC::Channel>> task =
|
|
|
|
new DeleteTask<IPC::Channel>(mTransport.release());
|
|
|
|
XRE_GetIOMessageLoop()->PostTask(task.forget());
|
|
|
|
|
2014-08-09 05:19:33 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
mIOLoop = nullptr;
|
|
|
|
mExistingListener = nullptr;
|
|
|
|
#endif
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
2020-02-07 01:41:56 +03:00
|
|
|
void ProcessLink::Open(UniquePtr<Transport> aTransport, MessageLoop* aIOLoop,
|
|
|
|
Side aSide) {
|
2017-07-22 00:16:10 +03:00
|
|
|
mChan->AssertWorkerThread();
|
|
|
|
|
2018-04-28 22:50:58 +03:00
|
|
|
MOZ_ASSERT(aTransport, "need transport layer");
|
2013-09-28 05:42:08 +04:00
|
|
|
|
|
|
|
// FIXME need to check for valid channel
|
|
|
|
|
2020-02-07 01:41:56 +03:00
|
|
|
mTransport = std::move(aTransport);
|
2013-09-28 05:42:08 +04:00
|
|
|
|
|
|
|
// FIXME figure out whether we're in parent or child, grab IO loop
|
|
|
|
// appropriately
|
|
|
|
bool needOpen = true;
|
|
|
|
if (aIOLoop) {
|
|
|
|
// We're a child or using the new arguments. Either way, we
|
|
|
|
// need an open.
|
|
|
|
needOpen = true;
|
|
|
|
mChan->mSide = (aSide == UnknownSide) ? ChildSide : aSide;
|
|
|
|
} else {
|
2018-04-28 22:50:58 +03:00
|
|
|
MOZ_ASSERT(aSide == UnknownSide, "expected default side arg");
|
2013-09-28 05:42:08 +04:00
|
|
|
|
|
|
|
// parent
|
|
|
|
mChan->mSide = ParentSide;
|
|
|
|
needOpen = false;
|
|
|
|
aIOLoop = XRE_GetIOMessageLoop();
|
|
|
|
}
|
|
|
|
|
|
|
|
mIOLoop = aIOLoop;
|
|
|
|
|
|
|
|
NS_ASSERTION(mIOLoop, "need an IO loop");
|
2020-07-02 03:26:41 +03:00
|
|
|
NS_ASSERTION(mChan->mWorkerThread, "need a worker thread");
|
2013-09-28 05:42:08 +04:00
|
|
|
|
2016-11-15 01:54:00 +03:00
|
|
|
// If we were never able to open the transport, immediately post an error
|
|
|
|
// message.
|
|
|
|
if (mTransport->Unsound_IsClosed()) {
|
2017-06-12 22:34:10 +03:00
|
|
|
mIOLoop->PostTask(
|
|
|
|
NewNonOwningRunnableMethod("ipc::ProcessLink::OnChannelConnectError",
|
|
|
|
this, &ProcessLink::OnChannelConnectError));
|
|
|
|
return;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2013-09-28 05:42:08 +04:00
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
if (needOpen) {
|
|
|
|
// Transport::Connect() has not been called. Call it so
|
|
|
|
// we start polling our pipe and processing outgoing
|
|
|
|
// messages.
|
2017-06-12 22:34:10 +03:00
|
|
|
mIOLoop->PostTask(
|
|
|
|
NewNonOwningRunnableMethod("ipc::ProcessLink::OnChannelOpened", this,
|
|
|
|
&ProcessLink::OnChannelOpened));
|
2018-11-30 13:46:48 +03:00
|
|
|
} else {
|
2013-09-28 05:42:08 +04:00
|
|
|
// Transport::Connect() has already been called. Take
|
|
|
|
// over the channel from the previous listener and process
|
|
|
|
// any queued messages.
|
2017-06-12 22:34:10 +03:00
|
|
|
mIOLoop->PostTask(NewNonOwningRunnableMethod(
|
|
|
|
"ipc::ProcessLink::OnTakeConnectedChannel", this,
|
|
|
|
&ProcessLink::OnTakeConnectedChannel));
|
2016-11-15 01:54:00 +03:00
|
|
|
}
|
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
// Wait until one of the runnables above changes the state of the
|
|
|
|
// channel. Note that the state could be changed again after that (to
|
|
|
|
// ChannelClosing, for example, by the IO thread). We can rely on it not
|
2017-07-22 00:16:10 +03:00
|
|
|
// changing back to Closed: only the worker thread changes it to closed,
|
|
|
|
// and we're on the worker thread, blocked.
|
|
|
|
while (mChan->mChannelState == ChannelClosed) {
|
2013-09-28 05:42:08 +04:00
|
|
|
mChan->mMonitor->Wait();
|
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
2020-06-03 00:23:08 +03:00
|
|
|
void ProcessLink::SendMessage(UniquePtr<Message> msg) {
|
2016-05-23 21:15:47 +03:00
|
|
|
if (msg->size() > IPC::Channel::kMaximumMessageSize) {
|
Bug 1348273 - Convert crash annotations into a machine-readable list of constants; r=ted.mielczarek,njn,dholbert,mak,cpearce,mcmanus,froydnj,Dexter,jrmuizel,jchen,jimm,bz,surkov
This introduces the machinery needed to generate crash annotations from a YAML
file. The relevant C++ functions are updated to take a typed enum. JavaScript
calls are unaffected but they will throw if the string argument does not
correspond to one of the known entries in the C++ enum. The existing whitelists
and blacklists of annotations are also generated from the YAML file and all
duplicate code related to them has been consolidated. Once written out to the
.extra file the annotations are converted in string form and are no different
than the existing ones.
All existing annotations have been included in the list (and some obsolete ones
have been removed) and all call sites have been updated including tests where
appropriate.
--HG--
extra : source : 4f6c43f2830701ec5552e08e3f1b06fe6d045860
2018-07-05 16:42:11 +03:00
|
|
|
CrashReporter::AnnotateCrashReport(
|
|
|
|
CrashReporter::Annotation::IPCMessageName,
|
|
|
|
nsDependentCString(msg->name()));
|
|
|
|
CrashReporter::AnnotateCrashReport(
|
|
|
|
CrashReporter::Annotation::IPCMessageSize,
|
2019-11-21 04:26:08 +03:00
|
|
|
static_cast<unsigned int>(msg->size()));
|
2016-05-23 21:15:47 +03:00
|
|
|
MOZ_CRASH("IPC message size is too large");
|
|
|
|
}
|
|
|
|
|
2017-06-21 23:40:18 +03:00
|
|
|
if (!mChan->mIsPostponingSends) {
|
|
|
|
mChan->AssertWorkerThread();
|
|
|
|
}
|
2013-09-28 05:42:08 +04:00
|
|
|
mChan->mMonitor->AssertCurrentThreadOwns();
|
|
|
|
|
2020-05-23 01:25:27 +03:00
|
|
|
msg->AssertAsLargeAsHeader();
|
|
|
|
|
2020-06-03 00:23:08 +03:00
|
|
|
mIOLoop->PostTask(NewNonOwningRunnableMethod<UniquePtr<Message>&&>(
|
|
|
|
"IPC::Channel::Send", mTransport.get(), &Transport::Send,
|
|
|
|
std::move(msg)));
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessLink::SendClose() {
|
|
|
|
mChan->AssertWorkerThread();
|
|
|
|
mChan->mMonitor->AssertCurrentThreadOwns();
|
|
|
|
|
2017-06-12 22:34:10 +03:00
|
|
|
mIOLoop->PostTask(NewNonOwningRunnableMethod(
|
|
|
|
"ipc::ProcessLink::OnCloseChannel", this, &ProcessLink::OnCloseChannel));
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ThreadLink::ThreadLink(MessageChannel* aChan, MessageChannel* aTargetChan)
|
|
|
|
: MessageLink(aChan), mTargetChan(aTargetChan) {}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2020-06-17 01:33:55 +03:00
|
|
|
void ThreadLink::PrepareToDestroy() {
|
2013-09-28 05:42:08 +04:00
|
|
|
MOZ_ASSERT(mChan);
|
2014-07-10 01:39:18 +04:00
|
|
|
MOZ_ASSERT(mChan->mMonitor);
|
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
// Bug 848949: We need to prevent the other side
|
|
|
|
// from sending us any more messages to avoid Use-After-Free.
|
|
|
|
// The setup here is as shown:
|
2018-11-30 13:46:48 +03:00
|
|
|
//
|
2013-09-28 05:42:08 +04:00
|
|
|
// (Us) (Them)
|
|
|
|
// MessageChannel MessageChannel
|
|
|
|
// | ^ \ / ^ |
|
|
|
|
// | | X | |
|
|
|
|
// v | / \ | v
|
|
|
|
// ThreadLink ThreadLink
|
2018-11-30 13:46:48 +03:00
|
|
|
//
|
2013-09-28 05:42:08 +04:00
|
|
|
// We want to null out the diagonal link from their ThreadLink
|
|
|
|
// to our MessageChannel. Note that we must hold the monitor so
|
|
|
|
// that we do this atomically with respect to them trying to send
|
2014-07-10 01:39:18 +04:00
|
|
|
// us a message. Since the channels share the same monitor this
|
2020-06-17 01:33:55 +03:00
|
|
|
// also protects against the two PrepareToDestroy() calls racing.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Why splitting is done in a method separate from ~ThreadLink:
|
|
|
|
//
|
|
|
|
// ThreadLinks are destroyed in MessageChannel::Clear(), when
|
|
|
|
// nullptr is assigned to the UniquePtr<> MessageChannel::mLink.
|
|
|
|
// This single line of code gets executed in three separate steps:
|
|
|
|
// 1. Load the value of mLink into a temporary.
|
|
|
|
// 2. Store nullptr in the mLink field.
|
|
|
|
// 3. Call the destructor on the temporary from step 1.
|
|
|
|
// This is all done without holding the monitor.
|
|
|
|
// The splitting operation, among other things, loads the mLink field
|
|
|
|
// of the other thread's MessageChannel while holding the monitor.
|
|
|
|
// If splitting was done in the destructor, and the two sides were
|
|
|
|
// both running MessageChannel::Clear(), then there would be a race
|
|
|
|
// between the store to mLink in Clear() and the load of mLink
|
|
|
|
// during splitting.
|
|
|
|
// Instead, we call PrepareToDestroy() prior to step 1. One thread or
|
|
|
|
// the other will run the entire method before the other thread,
|
|
|
|
// because this method acquires the monitor. Once that is done, the
|
|
|
|
// mTargetChan of both ThreadLink will be null, so they will no
|
|
|
|
// longer be able to access the other and so there won't be any races.
|
|
|
|
//
|
|
|
|
// An alternate approach would be to hold the monitor in Clear() or
|
|
|
|
// make mLink atomic, but MessageLink does not have to worry about
|
|
|
|
// Clear() racing with Clear(), so it would be inefficient.
|
2013-09-28 05:42:08 +04:00
|
|
|
if (mTargetChan) {
|
2014-07-10 01:39:18 +04:00
|
|
|
MOZ_ASSERT(mTargetChan->mLink);
|
2020-06-17 01:33:55 +03:00
|
|
|
static_cast<ThreadLink*>(mTargetChan->mLink.get())->mTargetChan = nullptr;
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2014-07-10 01:39:18 +04:00
|
|
|
mTargetChan = nullptr;
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
2020-06-03 00:23:08 +03:00
|
|
|
void ThreadLink::SendMessage(UniquePtr<Message> msg) {
|
2013-09-28 05:42:08 +04:00
|
|
|
if (!mChan->mIsPostponingSends) {
|
|
|
|
mChan->AssertWorkerThread();
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2013-09-28 05:42:08 +04:00
|
|
|
mChan->mMonitor->AssertCurrentThreadOwns();
|
|
|
|
|
2018-05-30 22:15:35 +03:00
|
|
|
if (mTargetChan) mTargetChan->OnMessageReceivedFromLink(std::move(*msg));
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ThreadLink::SendClose() {
|
|
|
|
mChan->AssertWorkerThread();
|
|
|
|
mChan->mMonitor->AssertCurrentThreadOwns();
|
|
|
|
|
|
|
|
mChan->mChannelState = ChannelClosed;
|
|
|
|
|
|
|
|
// In a ProcessLink, we would close our half the channel. This
|
|
|
|
// would show up on the other side as an error on the I/O thread.
|
|
|
|
// The I/O thread would then invoke OnChannelErrorFromLink().
|
|
|
|
// As usual, we skip that process and just invoke the
|
|
|
|
// OnChannelErrorFromLink() method directly.
|
|
|
|
if (mTargetChan) mTargetChan->OnChannelErrorFromLink();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ThreadLink::Unsound_IsClosed() const {
|
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
|
|
|
return mChan->mChannelState == ChannelClosed;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t ThreadLink::Unsound_NumQueuedMessages() const {
|
|
|
|
// ThreadLinks don't have a message queue.
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
// The methods below run in the context of the IO thread
|
|
|
|
//
|
|
|
|
|
2016-03-01 02:43:35 +03:00
|
|
|
void ProcessLink::OnMessageReceived(Message&& msg) {
|
2013-09-28 05:42:08 +04:00
|
|
|
AssertIOThread();
|
|
|
|
NS_ASSERTION(mChan->mChannelState != ChannelError, "Shouldn't get here!");
|
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
2018-05-30 22:15:35 +03:00
|
|
|
mChan->OnMessageReceivedFromLink(std::move(msg));
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessLink::OnChannelOpened() {
|
2014-08-09 05:19:33 +04:00
|
|
|
AssertIOThread();
|
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
{
|
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
|
|
|
|
|
|
|
mExistingListener = mTransport->set_listener(this);
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (mExistingListener) {
|
2017-05-26 19:10:59 +03:00
|
|
|
std::queue<Message> pending;
|
2013-09-28 05:42:08 +04:00
|
|
|
mExistingListener->GetQueuedMessages(pending);
|
|
|
|
MOZ_ASSERT(pending.empty());
|
|
|
|
}
|
|
|
|
#endif // DEBUG
|
|
|
|
|
|
|
|
mChan->mChannelState = ChannelOpening;
|
|
|
|
lock.Notify();
|
|
|
|
}
|
2020-03-03 02:14:15 +03:00
|
|
|
|
|
|
|
if (!mTransport->Connect()) {
|
|
|
|
mTransport->Close();
|
|
|
|
OnChannelError();
|
|
|
|
}
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessLink::OnTakeConnectedChannel() {
|
|
|
|
AssertIOThread();
|
|
|
|
|
2017-05-26 19:10:59 +03:00
|
|
|
std::queue<Message> pending;
|
2013-09-28 05:42:08 +04:00
|
|
|
{
|
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
|
|
|
|
|
|
|
mChan->mChannelState = ChannelConnected;
|
|
|
|
|
|
|
|
mExistingListener = mTransport->set_listener(this);
|
|
|
|
if (mExistingListener) {
|
|
|
|
mExistingListener->GetQueuedMessages(pending);
|
|
|
|
}
|
|
|
|
lock.Notify();
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
// Dispatch whatever messages the previous listener had queued up.
|
|
|
|
while (!pending.empty()) {
|
2018-05-30 22:15:35 +03:00
|
|
|
OnMessageReceived(std::move(pending.front()));
|
2013-09-28 05:42:08 +04:00
|
|
|
pending.pop();
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessLink::OnChannelConnected(int32_t peer_pid) {
|
2017-08-10 01:27:22 +03:00
|
|
|
AssertIOThread();
|
2013-09-28 05:42:08 +04:00
|
|
|
|
|
|
|
bool notifyChannel = false;
|
|
|
|
|
2014-08-21 22:13:23 +04:00
|
|
|
{
|
2013-09-28 05:42:08 +04:00
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
2014-08-21 22:13:23 +04:00
|
|
|
// Do not force it into connected if it has errored out, started
|
2017-08-10 01:27:22 +03:00
|
|
|
// closing, etc. Note that we can be in the Connected state already
|
|
|
|
// since the parent starts out Connected.
|
2014-08-21 22:13:23 +04:00
|
|
|
if (mChan->mChannelState == ChannelOpening ||
|
2017-08-10 01:27:22 +03:00
|
|
|
mChan->mChannelState == ChannelConnected) {
|
|
|
|
mChan->mChannelState = ChannelConnected;
|
|
|
|
mChan->mMonitor->Notify();
|
|
|
|
notifyChannel = true;
|
2014-08-21 22:13:23 +04:00
|
|
|
}
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
if (mExistingListener) {
|
|
|
|
mExistingListener->OnChannelConnected(peer_pid);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
|
|
|
|
2014-08-21 22:13:23 +04:00
|
|
|
if (notifyChannel) {
|
2013-09-28 05:42:08 +04:00
|
|
|
mChan->OnChannelConnected(peer_pid);
|
2018-11-30 13:46:48 +03:00
|
|
|
}
|
2013-09-28 05:42:08 +04:00
|
|
|
}
|
|
|
|
|
2016-11-15 01:54:00 +03:00
|
|
|
void ProcessLink::OnChannelConnectError() {
|
|
|
|
AssertIOThread();
|
|
|
|
|
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
|
|
|
|
|
|
|
mChan->OnChannelErrorFromLink();
|
|
|
|
}
|
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
void ProcessLink::OnChannelError() {
|
|
|
|
AssertIOThread();
|
2014-08-09 05:19:33 +04:00
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
2014-08-09 05:19:33 +04:00
|
|
|
|
|
|
|
MOZ_ALWAYS_TRUE(this == mTransport->set_listener(mExistingListener));
|
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
mChan->OnChannelErrorFromLink();
|
|
|
|
}
|
|
|
|
|
|
|
|
void ProcessLink::OnCloseChannel() {
|
|
|
|
AssertIOThread();
|
|
|
|
|
|
|
|
mTransport->Close();
|
|
|
|
|
|
|
|
MonitorAutoLock lock(*mChan->mMonitor);
|
2014-08-09 05:19:33 +04:00
|
|
|
|
2014-08-11 21:09:30 +04:00
|
|
|
DebugOnly<IPC::Channel::Listener*> previousListener =
|
|
|
|
mTransport->set_listener(mExistingListener);
|
|
|
|
|
|
|
|
// OnChannelError may have reset the listener already.
|
|
|
|
MOZ_ASSERT(previousListener == this || previousListener == mExistingListener);
|
2014-08-09 05:19:33 +04:00
|
|
|
|
2013-09-28 05:42:08 +04:00
|
|
|
mChan->mChannelState = ChannelClosed;
|
|
|
|
mChan->mMonitor->Notify();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool ProcessLink::Unsound_IsClosed() const {
|
|
|
|
return mTransport->Unsound_IsClosed();
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t ProcessLink::Unsound_NumQueuedMessages() const {
|
|
|
|
return mTransport->Unsound_NumQueuedMessages();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace ipc
|
|
|
|
} // namespace mozilla
|