Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/dom/PClientManagerChild.h"
#include "ipc/ErrorIPCUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/BindingIPCUtils.h"
#include "mozilla/dom/ClientIPCUtils.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/dom/PClientHandleChild.h"
#include "mozilla/dom/PClientManagerOpChild.h"
#include "mozilla/dom/PClientNavigateOpChild.h"
#include "mozilla/dom/PClientSourceChild.h"
#include "ipc/IPCMessageUtils.h"
#include "ipc/IPCMessageUtilsSpecializations.h"
#include "nsIFile.h"
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/ProtocolMessageUtils.h"
#include "mozilla/ipc/ProtocolUtils.h"
#include "mozilla/ipc/ShmemMessageUtils.h"
#include "mozilla/ipc/TaintingIPCUtils.h"
namespace mozilla {
namespace dom {
auto PClientManagerChild::RecvPClientNavigateOpConstructor(
PClientNavigateOpChild* actor,
const ClientNavigateOpConstructorArgs& aArgs) -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PClientManagerChild::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
MOZ_IMPLICIT PClientManagerChild::PClientManagerChild() :
mozilla::ipc::IRefCountedProtocol(PClientManagerMsgStart, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PClientManagerChild);
}
PClientManagerChild::~PClientManagerChild()
{
MOZ_COUNT_DTOR(PClientManagerChild);
}
auto PClientManagerChild::ActorAlloc() -> void
{
AddRef();
}
auto PClientManagerChild::ActorDealloc() -> void
{
Release();
}
auto PClientManagerChild::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PClientManagerChild::Manager() const -> PBackgroundChild*
{
return static_cast<PBackgroundChild*>(IProtocol::Manager());
}
auto PClientManagerChild::ManagedPClientHandleChild(nsTArray<PClientHandleChild*>& aArr) const -> void
{
mManagedPClientHandleChild.ToArray(aArr);
}
auto PClientManagerChild::ManagedPClientHandleChild() const -> const ManagedContainer<PClientHandleChild>&
{
return mManagedPClientHandleChild;
}
auto PClientManagerChild::ManagedPClientManagerOpChild(nsTArray<PClientManagerOpChild*>& aArr) const -> void
{
mManagedPClientManagerOpChild.ToArray(aArr);
}
auto PClientManagerChild::ManagedPClientManagerOpChild() const -> const ManagedContainer<PClientManagerOpChild>&
{
return mManagedPClientManagerOpChild;
}
auto PClientManagerChild::ManagedPClientNavigateOpChild(nsTArray<PClientNavigateOpChild*>& aArr) const -> void
{
mManagedPClientNavigateOpChild.ToArray(aArr);
}
auto PClientManagerChild::ManagedPClientNavigateOpChild() const -> const ManagedContainer<PClientNavigateOpChild>&
{
return mManagedPClientNavigateOpChild;
}
auto PClientManagerChild::ManagedPClientSourceChild(nsTArray<PClientSourceChild*>& aArr) const -> void
{
mManagedPClientSourceChild.ToArray(aArr);
}
auto PClientManagerChild::ManagedPClientSourceChild() const -> const ManagedContainer<PClientSourceChild>&
{
return mManagedPClientSourceChild;
}
auto PClientManagerChild::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
total += mManagedPClientHandleChild.Count();
total += mManagedPClientManagerOpChild.Count();
total += mManagedPClientNavigateOpChild.Count();
total += mManagedPClientSourceChild.Count();
return total;
}
auto PClientManagerChild::OpenPClientHandleEndpoint(PClientHandleChild* aActor) -> ManagedEndpoint<PClientHandleParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PClientHandleChild actor");
return ManagedEndpoint<PClientHandleParent>();
}
if (aActor->SetManagerAndRegister(this)) {
mManagedPClientHandleChild.Insert(aActor);
} else {
NS_WARNING("Failed to bind PClientHandleChild actor");
return ManagedEndpoint<PClientHandleParent>();
}
// Mark our actor as awaiting the other side to be bound. This will
// be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is
// received.
aActor->mAwaitingManagedEndpointBind = true;
return ManagedEndpoint<PClientHandleParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PClientManagerChild::BindPClientHandleEndpoint(
ManagedEndpoint<PClientHandleChild> aEndpoint,
PClientHandleChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this, mManagedPClientHandleChild);
}
auto PClientManagerChild::OpenPClientManagerOpEndpoint(PClientManagerOpChild* aActor) -> ManagedEndpoint<PClientManagerOpParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PClientManagerOpChild actor");
return ManagedEndpoint<PClientManagerOpParent>();
}
if (aActor->SetManagerAndRegister(this)) {
mManagedPClientManagerOpChild.Insert(aActor);
} else {
NS_WARNING("Failed to bind PClientManagerOpChild actor");
return ManagedEndpoint<PClientManagerOpParent>();
}
// Mark our actor as awaiting the other side to be bound. This will
// be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is
// received.
aActor->mAwaitingManagedEndpointBind = true;
return ManagedEndpoint<PClientManagerOpParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PClientManagerChild::BindPClientManagerOpEndpoint(
ManagedEndpoint<PClientManagerOpChild> aEndpoint,
PClientManagerOpChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this, mManagedPClientManagerOpChild);
}
auto PClientManagerChild::OpenPClientNavigateOpEndpoint(PClientNavigateOpChild* aActor) -> ManagedEndpoint<PClientNavigateOpParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PClientNavigateOpChild actor");
return ManagedEndpoint<PClientNavigateOpParent>();
}
if (aActor->SetManagerAndRegister(this)) {
mManagedPClientNavigateOpChild.Insert(aActor);
} else {
NS_WARNING("Failed to bind PClientNavigateOpChild actor");
return ManagedEndpoint<PClientNavigateOpParent>();
}
// Mark our actor as awaiting the other side to be bound. This will
// be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is
// received.
aActor->mAwaitingManagedEndpointBind = true;
return ManagedEndpoint<PClientNavigateOpParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PClientManagerChild::BindPClientNavigateOpEndpoint(
ManagedEndpoint<PClientNavigateOpChild> aEndpoint,
PClientNavigateOpChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this, mManagedPClientNavigateOpChild);
}
auto PClientManagerChild::OpenPClientSourceEndpoint(PClientSourceChild* aActor) -> ManagedEndpoint<PClientSourceParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PClientSourceChild actor");
return ManagedEndpoint<PClientSourceParent>();
}
if (aActor->SetManagerAndRegister(this)) {
mManagedPClientSourceChild.Insert(aActor);
} else {
NS_WARNING("Failed to bind PClientSourceChild actor");
return ManagedEndpoint<PClientSourceParent>();
}
// Mark our actor as awaiting the other side to be bound. This will
// be cleared when a `MANAGED_ENDPOINT_{DROPPED,BOUND}` message is
// received.
aActor->mAwaitingManagedEndpointBind = true;
return ManagedEndpoint<PClientSourceParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PClientManagerChild::BindPClientSourceEndpoint(
ManagedEndpoint<PClientSourceChild> aEndpoint,
PClientSourceChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this, mManagedPClientSourceChild);
}
auto PClientManagerChild::SendTeardown() -> bool
{
UniquePtr<IPC::Message> msg__ = PClientManager::Msg_Teardown(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PClientManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PClientManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PClientManager::Msg_Teardown", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PClientManagerChild::SendPClientHandleConstructor(
PClientHandleChild* actor,
const IPCClientInfo& aClientInfo) -> PClientHandleChild*
{
if (!actor) {
NS_WARNING("Cannot bind null PClientHandleChild actor");
return nullptr;
}
if (actor->SetManagerAndRegister(this)) {
mManagedPClientHandleChild.Insert(actor);
} else {
NS_WARNING("Failed to bind PClientHandleChild actor");
return nullptr;
}
// Build our constructor message.
UniquePtr<IPC::Message> msg__ = PClientManager::Msg_PClientHandleConstructor(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), actor);
// Sentinel = 'actor'
((&(writer__)))->WriteSentinel(102892058);
IPC::WriteParam((&(writer__)), aClientInfo);
// Sentinel = 'aClientInfo'
((&(writer__)))->WriteSentinel(422315085);
// Notify the other side about the newly created actor. This can
// fail if our manager has already been destroyed.
//
// NOTE: If the send call fails due to toplevel channel teardown,
// the `IProtocol::ChannelSend` wrapper absorbs the error for us,
// so we don't tear down actors unexpectedly.
if (mozilla::ipc::LoggingEnabledFor("PClientManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PClientManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PClientManager::Msg_PClientHandleConstructor", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
// Warn, destroy the actor, and return null if the message failed to
// send. Otherwise, return the successfully created actor reference.
if (!sendok__) {
NS_WARNING("Error sending PClientHandleChild constructor");
actor->ActorDisconnected(FailedConstructor);
return nullptr;
}
return actor;
}
auto PClientManagerChild::SendPClientManagerOpConstructor(const ClientOpConstructorArgs& aArgs) -> PClientManagerOpChild*
{
PClientManagerOpChild* actor = (this)->AllocPClientManagerOpChild(aArgs);
return SendPClientManagerOpConstructor(std::move(actor), std::move(aArgs));
}
auto PClientManagerChild::SendPClientManagerOpConstructor(
PClientManagerOpChild* actor,
const ClientOpConstructorArgs& aArgs) -> PClientManagerOpChild*
{
if (!actor) {
NS_WARNING("Cannot bind null PClientManagerOpChild actor");
return nullptr;
}
if (actor->SetManagerAndRegister(this)) {
mManagedPClientManagerOpChild.Insert(actor);
} else {
NS_WARNING("Failed to bind PClientManagerOpChild actor");
return nullptr;
}
// Build our constructor message.
UniquePtr<IPC::Message> msg__ = PClientManager::Msg_PClientManagerOpConstructor(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), actor);
// Sentinel = 'actor'
((&(writer__)))->WriteSentinel(102892058);
IPC::WriteParam((&(writer__)), aArgs);
// Sentinel = 'aArgs'
((&(writer__)))->WriteSentinel(92602863);
// Notify the other side about the newly created actor. This can
// fail if our manager has already been destroyed.
//
// NOTE: If the send call fails due to toplevel channel teardown,
// the `IProtocol::ChannelSend` wrapper absorbs the error for us,
// so we don't tear down actors unexpectedly.
if (mozilla::ipc::LoggingEnabledFor("PClientManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PClientManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PClientManager::Msg_PClientManagerOpConstructor", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
// Warn, destroy the actor, and return null if the message failed to
// send. Otherwise, return the successfully created actor reference.
if (!sendok__) {
NS_WARNING("Error sending PClientManagerOpChild constructor");
actor->ActorDisconnected(FailedConstructor);
return nullptr;
}
return actor;
}
auto PClientManagerChild::SendPClientSourceConstructor(
PClientSourceChild* actor,
const ClientSourceConstructorArgs& aArgs) -> PClientSourceChild*
{
if (!actor) {
NS_WARNING("Cannot bind null PClientSourceChild actor");
return nullptr;
}
if (actor->SetManagerAndRegister(this)) {
mManagedPClientSourceChild.Insert(actor);
} else {
NS_WARNING("Failed to bind PClientSourceChild actor");
return nullptr;
}
// Build our constructor message.
UniquePtr<IPC::Message> msg__ = PClientManager::Msg_PClientSourceConstructor(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), actor);
// Sentinel = 'actor'
((&(writer__)))->WriteSentinel(102892058);
IPC::WriteParam((&(writer__)), aArgs);
// Sentinel = 'aArgs'
((&(writer__)))->WriteSentinel(92602863);
// Notify the other side about the newly created actor. This can
// fail if our manager has already been destroyed.
//
// NOTE: If the send call fails due to toplevel channel teardown,
// the `IProtocol::ChannelSend` wrapper absorbs the error for us,
// so we don't tear down actors unexpectedly.
if (mozilla::ipc::LoggingEnabledFor("PClientManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PClientManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PClientManager::Msg_PClientSourceConstructor", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
// Warn, destroy the actor, and return null if the message failed to
// send. Otherwise, return the successfully created actor reference.
if (!sendok__) {
NS_WARNING("Error sending PClientSourceChild constructor");
actor->ActorDisconnected(FailedConstructor);
return nullptr;
}
return actor;
}
auto PClientManagerChild::SendExpectFutureClientSource(const IPCClientInfo& aClientInfo) -> bool
{
UniquePtr<IPC::Message> msg__ = PClientManager::Msg_ExpectFutureClientSource(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aClientInfo);
// Sentinel = 'aClientInfo'
((&(writer__)))->WriteSentinel(422315085);
if (mozilla::ipc::LoggingEnabledFor("PClientManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PClientManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PClientManager::Msg_ExpectFutureClientSource", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PClientManagerChild::SendForgetFutureClientSource(const IPCClientInfo& aClientInfo) -> bool
{
UniquePtr<IPC::Message> msg__ = PClientManager::Msg_ForgetFutureClientSource(Id());
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aClientInfo);
// Sentinel = 'aClientInfo'
((&(writer__)))->WriteSentinel(422315085);
if (mozilla::ipc::LoggingEnabledFor("PClientManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PClientManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PClientManager::Msg_ForgetFutureClientSource", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PClientManagerChild::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
case PClientHandleMsgStart:
MOZ_ALWAYS_TRUE(mManagedPClientHandleChild.EnsureRemoved(static_cast<PClientHandleChild*>(aListener)));
return;
case PClientManagerOpMsgStart:
MOZ_ALWAYS_TRUE(mManagedPClientManagerOpChild.EnsureRemoved(static_cast<PClientManagerOpChild*>(aListener)));
return;
case PClientNavigateOpMsgStart:
MOZ_ALWAYS_TRUE(mManagedPClientNavigateOpChild.EnsureRemoved(static_cast<PClientNavigateOpChild*>(aListener)));
return;
case PClientSourceMsgStart:
MOZ_ALWAYS_TRUE(mManagedPClientSourceChild.EnsureRemoved(static_cast<PClientSourceChild*>(aListener)));
return;
default:
FatalError("unreached");
return; }
}
auto PClientManagerChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
case PClientManagerOpMsgStart:
this->DeallocPClientManagerOpChild(static_cast<PClientManagerOpChild*>(aListener));
return;
case PClientNavigateOpMsgStart:
this->DeallocPClientNavigateOpChild(static_cast<PClientNavigateOpChild*>(aListener));
return;
default:
FatalError("unreached");
return;
}
}
auto PClientManagerChild::OnMessageReceived(const Message& msg__) -> PClientManagerChild::Result
{
switch (msg__.type()) {
case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
return MsgProcessed;
}
case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
{
if (!mAwaitingManagedEndpointBind) {
NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
return MsgNotAllowed;
}
mAwaitingManagedEndpointBind = false;
this->ActorDisconnected(ManagedEndpointDropped);
return MsgProcessed;
}
case PClientManager::Reply_PClientHandleConstructor__ID:
{
return MsgProcessed;
}
case PClientManager::Reply_PClientManagerOpConstructor__ID:
{
return MsgProcessed;
}
case PClientManager::Reply_PClientSourceConstructor__ID:
{
return MsgProcessed;
}
case PClientManager::Msg_PClientNavigateOpConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PClientManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PClientManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PClientManager::Msg_PClientNavigateOpConstructor", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__handle__ = IPC::ReadParam<ActorHandle>((&(reader__)));
if (!maybe__handle__) {
FatalError("Error deserializing 'ActorHandle'");
return MsgValueError;
}
auto& handle__ = *maybe__handle__;
// Sentinel = 'actor'
if ((!(((&(reader__)))->ReadSentinel(102892058)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'ActorHandle'");
return MsgValueError;
}
auto maybe__aArgs = IPC::ReadParam<ClientNavigateOpConstructorArgs>((&(reader__)));
if (!maybe__aArgs) {
FatalError("Error deserializing 'ClientNavigateOpConstructorArgs'");
return MsgValueError;
}
auto& aArgs = *maybe__aArgs;
// Sentinel = 'aArgs'
if ((!(((&(reader__)))->ReadSentinel(92602863)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'ClientNavigateOpConstructorArgs'");
return MsgValueError;
}
reader__.EndRead();
PClientNavigateOpChild* actor = (this)->AllocPClientNavigateOpChild(aArgs);
if (!actor) {
NS_WARNING("Cannot bind null PClientNavigateOpChild actor");
return MsgValueError;
}
if (actor->SetManagerAndRegister(this, (handle__).mId)) {
mManagedPClientNavigateOpChild.Insert(actor);
} else {
NS_WARNING("Failed to bind PClientNavigateOpChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (this)->RecvPClientNavigateOpConstructor(std::move(actor), std::move(aArgs));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PClientManager::Msg___delete____ID:
{
if (mozilla::ipc::LoggingEnabledFor("PClientManager", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PClientManagerChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PClientManager::Msg___delete__", OTHER);
mozilla::ipc::IPCResult __ok = (this)->Recv__delete__();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
this->ActorDisconnected(Deletion);
return MsgProcessed;
}
default:
return MsgNotKnown;
}
}
auto PClientManagerChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PClientManagerChild::Result
{
return MsgNotKnown;
}
auto PClientManagerChild::DoomSubtree() -> void
{
for (auto* key : mManagedPClientHandleChild) {
key->DoomSubtree();
}
for (auto* key : mManagedPClientManagerOpChild) {
key->DoomSubtree();
}
for (auto* key : mManagedPClientNavigateOpChild) {
key->DoomSubtree();
}
for (auto* key : mManagedPClientSourceChild) {
key->DoomSubtree();
}
SetDoomed();
}
auto PClientManagerChild::PeekManagedActor() -> IProtocol*
{
if (IProtocol* actor = mManagedPClientHandleChild.Peek()) {
return actor;
}
if (IProtocol* actor = mManagedPClientManagerOpChild.Peek()) {
return actor;
}
if (IProtocol* actor = mManagedPClientNavigateOpChild.Peek()) {
return actor;
}
if (IProtocol* actor = mManagedPClientSourceChild.Peek()) {
return actor;
}
return nullptr;
}
} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::PClientManagerChild*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
MOZ_RELEASE_ASSERT(
aWriter->GetActor(),
"Cannot serialize managed actors without an actor");
int32_t id;
if (!aVar) {
id = 0; // kNullActorId
} else {
id = aVar->Id();
if (id == 1) { // kFreedActorId
aVar->FatalError("Actor has been |delete|d");
}
MOZ_RELEASE_ASSERT(
aWriter->GetActor()->GetIPCChannel() == aVar->GetIPCChannel(),
"Actor must be from the same channel as the"
" actor it's being sent over");
MOZ_RELEASE_ASSERT(
aVar->CanSend(),
"Actor must still be open when sending");
}
IPC::WriteParam(aWriter, id);
}
auto ParamTraits<::mozilla::dom::PClientManagerChild*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
MOZ_RELEASE_ASSERT(
aReader->GetActor(),
"Cannot deserialize managed actors without an actor");
mozilla::Maybe<mozilla::ipc::IProtocol*> actor = aReader->GetActor()
->ReadActor(aReader, true, "PClientManager", PClientManagerMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::dom::PClientManagerChild*>(actor.ref());
}
return {};
}
} // namespace IPC