Copy as Markdown
Other Tools
//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/_ipdltest/PTestSelfManageChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/_ipdltest/PTestSelfManageRootChild.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 PTestSelfManageChild::RecvPTestSelfManageConstructor(PTestSelfManageChild* actor) -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
auto PTestSelfManageChild::Recv__delete__() -> mozilla::ipc::IPCResult
{
return IPC_OK();
}
MOZ_IMPLICIT PTestSelfManageChild::PTestSelfManageChild() :
mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PTestSelfManageChild);
}
PTestSelfManageChild::~PTestSelfManageChild()
{
MOZ_COUNT_DTOR(PTestSelfManageChild);
}
auto PTestSelfManageChild::ActorAlloc() -> void
{
AddRef();
}
auto PTestSelfManageChild::ActorDealloc() -> void
{
Release();
}
auto PTestSelfManageChild::ManagedPTestSelfManageChild(nsTArray<PTestSelfManageChild*>& aArr) const -> void
{
mManagedPTestSelfManageChild.ToArray(aArr);
}
auto PTestSelfManageChild::ManagedPTestSelfManageChild() const -> const ManagedContainer<PTestSelfManageChild>&
{
return mManagedPTestSelfManageChild;
}
auto PTestSelfManageChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
static constexpr ::mozilla::ipc::ProtocolId sIds[] = {
PTestSelfManageMsgStart
};
return sIds;
}
auto PTestSelfManageChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
case PTestSelfManageMsgStart:
return (&(mManagedPTestSelfManageChild));
default:
return nullptr;
}
}
auto PTestSelfManageChild::OpenPTestSelfManageEndpoint(PTestSelfManageChild* aActor) -> ManagedEndpoint<PTestSelfManageParent>
{
if (!aActor) {
NS_WARNING("Cannot bind null PTestSelfManageChild actor");
return ManagedEndpoint<PTestSelfManageParent>();
}
if (!aActor->SetManagerAndRegister(this)) {
NS_WARNING("Failed to bind PTestSelfManageChild actor");
return ManagedEndpoint<PTestSelfManageParent>();
}
// 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<PTestSelfManageParent>(mozilla::ipc::PrivateIPDLInterface(), aActor);
}
auto PTestSelfManageChild::BindPTestSelfManageEndpoint(
ManagedEndpoint<PTestSelfManageChild> aEndpoint,
PTestSelfManageChild* aActor) -> bool
{
return aEndpoint.Bind(mozilla::ipc::PrivateIPDLInterface(), aActor, this);
}
auto PTestSelfManageChild::DeallocManagee(
mozilla::ipc::ProtocolId aProtocolId,
IProtocol* aListener) -> void
{
switch (aProtocolId) {
default:
FatalError("unreached");
return;
}
}
auto PTestSelfManageChild::OnMessageReceived(const Message& msg__) -> PTestSelfManageChild::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 PTestSelfManage::Msg_PTestSelfManageConstructor__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestSelfManage", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestSelfManageChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestSelfManage::Msg_PTestSelfManageConstructor", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__actorid__ = IPC::ReadParam<mozilla::ipc::ActorId>((&(reader__)));
if (!maybe__actorid__) {
FatalError("Error deserializing 'mozilla::ipc::ActorId'");
return MsgValueError;
}
auto& actorid__ = *maybe__actorid__;
// Sentinel = 'actorid'
if ((!(((&(reader__)))->ReadSentinel(193725159)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'mozilla::ipc::ActorId'");
return MsgValueError;
}
reader__.EndRead();
RefPtr<PTestSelfManageChild> actor = (this)->AllocPTestSelfManageChild();
if (!actor) {
NS_WARNING("Cannot bind null PTestSelfManageChild actor");
return MsgValueError;
}
if (!actor->SetManagerAndRegister(this, actorid__)) {
NS_WARNING("Failed to bind PTestSelfManageChild actor");
return MsgValueError;
}
mozilla::ipc::IPCResult __ok = (this)->RecvPTestSelfManageConstructor(actor);
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PTestSelfManage::Msg___delete____ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestSelfManage", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestSelfManageChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestSelfManage::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 PTestSelfManageChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PTestSelfManageChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
} // namespace _ipdltest
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::_ipdltest::PTestSelfManageChild*>::Write(
IPC::MessageWriter* aWriter,
const paramType& aVar) -> void
{
IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
// Sentinel = 'PTestSelfManage'
(aWriter)->WriteSentinel(764282308);
}
auto ParamTraits<::mozilla::_ipdltest::PTestSelfManageChild*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
if (!maybe__actor) {
aReader->FatalError("Error deserializing managed PTestSelfManage actor");
return {};
}
auto& actor = *maybe__actor;
// Sentinel = 'PTestSelfManage'
if ((!((aReader)->ReadSentinel(764282308)))) {
mozilla::ipc::SentinelReadError("Error deserializing managed PTestSelfManage actor");
return {};
}
if (actor && actor->GetProtocolId() != PTestSelfManageMsgStart) {
aReader->FatalError("Unexpected actor type (expected PTestSelfManage)");
return {};
}
return static_cast<::mozilla::_ipdltest::PTestSelfManageChild*>(actor);
}
} // namespace IPC