Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/_ipdltest/PTestMultiMgrsChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/_ipdltest/PTestMultiMgrsLeftChild.h"
#include "mozilla/_ipdltest/PTestMultiMgrsRightChild.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 _ipdltest {
auto PTestMultiMgrsChild::RecvPTestMultiMgrsLeftConstructor(PTestMultiMgrsLeftChild* actor) -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PTestMultiMgrsChild::RecvPTestMultiMgrsRightConstructor(PTestMultiMgrsRightChild* actor) -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PTestMultiMgrsChild::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PTestMultiMgrsChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PTestMultiMgrsChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PTestMultiMgrsChild::PTestMultiMgrsChild() :
mozilla::ipc::IToplevelProtocol("PTestMultiMgrsChild", PTestMultiMgrsMsgStart, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PTestMultiMgrsChild);
}
PTestMultiMgrsChild::~PTestMultiMgrsChild()
{
MOZ_COUNT_DTOR(PTestMultiMgrsChild);
}
auto PTestMultiMgrsChild::ActorAlloc() -> void
{
AddRef();
}
auto PTestMultiMgrsChild::ActorDealloc() -> void
{
Release();
}
auto PTestMultiMgrsChild::ManagedPTestMultiMgrsLeftChild(nsTArray<PTestMultiMgrsLeftChild*>& aArr) const -> void
{
mManagedPTestMultiMgrsLeftChild.ToArray(aArr);
}
auto PTestMultiMgrsChild::ManagedPTestMultiMgrsLeftChild() const -> const ManagedContainer<PTestMultiMgrsLeftChild>&
{
return mManagedPTestMultiMgrsLeftChild;
}
auto PTestMultiMgrsChild::ManagedPTestMultiMgrsRightChild(nsTArray<PTestMultiMgrsRightChild*>& aArr) const -> void
{
mManagedPTestMultiMgrsRightChild.ToArray(aArr);
}
auto PTestMultiMgrsChild::ManagedPTestMultiMgrsRightChild() const -> const ManagedContainer<PTestMultiMgrsRightChild>&
{
return mManagedPTestMultiMgrsRightChild;
}
auto PTestMultiMgrsChild::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
total += mManagedPTestMultiMgrsLeftChild.Count();
total += mManagedPTestMultiMgrsRightChild.Count();
return total;
}
auto PTestMultiMgrsChild::OpenPTestMultiMgrsLeftEndpoint(PTestMultiMgrsLeftChild* aActor) -> ManagedEndpoint<PTestMultiMgrsLeftParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PTestMultiMgrsLeftChild actor");
return ManagedEndpoint<PTestMultiMgrsLeftParent>();
}
if (aActor->SetManagerAndRegister(this)) {
mManagedPTestMultiMgrsLeftChild.Insert(aActor);
} else {
NS_WARNING("Failed to bind PTestMultiMgrsLeftChild actor");
return ManagedEndpoint<PTestMultiMgrsLeftParent>();
}
// 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<PTestMultiMgrsLeftParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PTestMultiMgrsChild::BindPTestMultiMgrsLeftEndpoint(
ManagedEndpoint<PTestMultiMgrsLeftChild> aEndpoint,
PTestMultiMgrsLeftChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this, mManagedPTestMultiMgrsLeftChild);
}
auto PTestMultiMgrsChild::OpenPTestMultiMgrsRightEndpoint(PTestMultiMgrsRightChild* aActor) -> ManagedEndpoint<PTestMultiMgrsRightParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PTestMultiMgrsRightChild actor");
return ManagedEndpoint<PTestMultiMgrsRightParent>();
}
if (aActor->SetManagerAndRegister(this)) {
mManagedPTestMultiMgrsRightChild.Insert(aActor);
} else {
NS_WARNING("Failed to bind PTestMultiMgrsRightChild actor");
return ManagedEndpoint<PTestMultiMgrsRightParent>();
}
// 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<PTestMultiMgrsRightParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PTestMultiMgrsChild::BindPTestMultiMgrsRightEndpoint(
ManagedEndpoint<PTestMultiMgrsRightChild> aEndpoint,
PTestMultiMgrsRightChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this, mManagedPTestMultiMgrsRightChild);
}
auto PTestMultiMgrsChild::SendOK() -> bool
{
UniquePtr<IPC::Message> msg__ = PTestMultiMgrs::Msg_OK(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PTestMultiMgrs", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestMultiMgrsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PTestMultiMgrs::Msg_OK", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PTestMultiMgrsChild::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
case PTestMultiMgrsLeftMsgStart:
mManagedPTestMultiMgrsLeftChild.EnsureRemoved(static_cast<PTestMultiMgrsLeftChild*>(aListener));
return;
case PTestMultiMgrsRightMsgStart:
mManagedPTestMultiMgrsRightChild.EnsureRemoved(static_cast<PTestMultiMgrsRightChild*>(aListener));
return;
default:
FatalError("unreached");
return; }
}
auto PTestMultiMgrsChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
default:
FatalError("unreached");
return;
}
}
auto PTestMultiMgrsChild::OnMessageReceived(const Message& msg__) -> PTestMultiMgrsChild::Result
{
int32_t route__ = msg__.routing_id();
if (MSG_ROUTING_CONTROL != route__) {
IProtocol* routed__ = Lookup(route__);
if (!routed__ || !routed__->GetLifecycleProxy()) {
if (mozilla::ipc::LoggingEnabledFor("PTestMultiMgrs", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestMultiMgrsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Ignored message for dead actor",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eSending);
}
return MsgProcessed;
}
RefPtr<mozilla::ipc::ActorLifecycleProxy> proxy__ =
routed__->GetLifecycleProxy();
return proxy__->Get()->OnMessageReceived(msg__);
}
switch (msg__.type()) {
case PTestMultiMgrs::Msg_PTestMultiMgrsLeftConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestMultiMgrs", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestMultiMgrsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestMultiMgrs::Msg_PTestMultiMgrsLeftConstructor", 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;
}
reader__.EndRead();
RefPtr<PTestMultiMgrsLeftChild> actor = (this)->AllocPTestMultiMgrsLeftChild();
if (!actor) {
NS_WARNING("Cannot bind null PTestMultiMgrsLeftChild actor");
return MsgValueError;
}
if (actor->SetManagerAndRegister(this, (handle__).mId)) {
mManagedPTestMultiMgrsLeftChild.Insert(actor);
} else {
NS_WARNING("Failed to bind PTestMultiMgrsLeftChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (this)->RecvPTestMultiMgrsLeftConstructor(actor);
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PTestMultiMgrs::Msg_PTestMultiMgrsRightConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestMultiMgrs", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestMultiMgrsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestMultiMgrs::Msg_PTestMultiMgrsRightConstructor", 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;
}
reader__.EndRead();
RefPtr<PTestMultiMgrsRightChild> actor = (this)->AllocPTestMultiMgrsRightChild();
if (!actor) {
NS_WARNING("Cannot bind null PTestMultiMgrsRightChild actor");
return MsgValueError;
}
if (actor->SetManagerAndRegister(this, (handle__).mId)) {
mManagedPTestMultiMgrsRightChild.Insert(actor);
} else {
NS_WARNING("Failed to bind PTestMultiMgrsRightChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (this)->RecvPTestMultiMgrsRightConstructor(actor);
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PTestMultiMgrs::Msg_Check__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestMultiMgrs", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestMultiMgrsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestMultiMgrs::Msg_Check", OTHER);
mozilla::ipc::IPCResult __ok = (this)->RecvCheck();
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
default:
return MsgNotKnown;
case SHMEM_CREATED_MESSAGE_TYPE:
{
if (!ShmemCreated(msg__)) {
return MsgPayloadError;
}
return MsgProcessed;
}
case SHMEM_DESTROYED_MESSAGE_TYPE:
{
if (!ShmemDestroyed(msg__)) {
return MsgPayloadError;
}
return MsgProcessed;
}
}
}
auto PTestMultiMgrsChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PTestMultiMgrsChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PTestMultiMgrsChild::DoomSubtree() -> void
{
for (auto* key : mManagedPTestMultiMgrsLeftChild) {
key->DoomSubtree();
}
for (auto* key : mManagedPTestMultiMgrsRightChild) {
key->DoomSubtree();
}
SetDoomed();
}
auto PTestMultiMgrsChild::PeekManagedActor() -> IProtocol*
{
if (IProtocol* actor = mManagedPTestMultiMgrsLeftChild.Peek()) {
return actor;
}
if (IProtocol* actor = mManagedPTestMultiMgrsRightChild.Peek()) {
return actor;
}
return nullptr;
}
} // namespace _ipdltest
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::_ipdltest::PTestMultiMgrsChild*>::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::_ipdltest::PTestMultiMgrsChild*>::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, "PTestMultiMgrs", PTestMultiMgrsMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::_ipdltest::PTestMultiMgrsChild*>(actor.ref());
}
return {};
}
} // namespace IPC