Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/_ipdltest/PIPDLUnitTestParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/_ipdltest/IPDLUnitTestParent.h"
#include "mozilla/ipc/ScopedPort.h"
#include "nsID.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 PIPDLUnitTestParent::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PIPDLUnitTestParent::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PIPDLUnitTestParent::PIPDLUnitTestParent() :
mozilla::ipc::IToplevelProtocol("PIPDLUnitTestParent", PIPDLUnitTestMsgStart, mozilla::ipc::ParentSide)
{
MOZ_COUNT_CTOR(PIPDLUnitTestParent);
}
PIPDLUnitTestParent::~PIPDLUnitTestParent()
{
MOZ_COUNT_DTOR(PIPDLUnitTestParent);
}
auto PIPDLUnitTestParent::ActorAlloc() -> void
{
MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PIPDLUnitTestParent'");
AddRef();
}
auto PIPDLUnitTestParent::ActorDealloc() -> void
{
Release();
}
auto PIPDLUnitTestParent::OtherPid() const -> ::base::ProcessId
{
::base::ProcessId pid =
::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
return pid;
}
auto PIPDLUnitTestParent::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PIPDLUnitTestParent::SendStart(
const nsACString& name,
ScopedPort&& port,
const nsID& channelId) -> bool
{
UniquePtr<IPC::Message> msg__ = PIPDLUnitTest::Msg_Start(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), name);
// Sentinel = 'name'
((&(writer__)))->WriteSentinel(69075362);
IPC::WriteParam((&(writer__)), std::move(port));
// Sentinel = 'port'
((&(writer__)))->WriteSentinel(73990598);
IPC::WriteParam((&(writer__)), channelId);
// Sentinel = 'channelId'
((&(writer__)))->WriteSentinel(301138823);
if (mozilla::ipc::LoggingEnabledFor("PIPDLUnitTest", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIPDLUnitTestParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PIPDLUnitTest::Msg_Start", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PIPDLUnitTestParent::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PIPDLUnitTestParent::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PIPDLUnitTestParent::OnMessageReceived(const Message& msg__) -> PIPDLUnitTestParent::Result
{
switch (msg__.type()) {
case PIPDLUnitTest::Msg_Report__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIPDLUnitTest", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIPDLUnitTestParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIPDLUnitTest::Msg_Report", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__result = IPC::ReadParam<TestPartResult>((&(reader__)));
if (!maybe__result) {
FatalError("Error deserializing 'TestPartResult'");
return MsgValueError;
}
auto& result = *maybe__result;
// Sentinel = 'result'
if ((!(((&(reader__)))->ReadSentinel(153223840)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'TestPartResult'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (static_cast<IPDLUnitTestParent*>(this))->RecvReport(std::move(result));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PIPDLUnitTest::Msg_Complete__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PIPDLUnitTest", mozilla::ipc::ParentSide)) {
mozilla::ipc::LogMessageForProtocol(
"PIPDLUnitTestParent",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PIPDLUnitTest::Msg_Complete", OTHER);
mozilla::ipc::IPCResult __ok = (static_cast<IPDLUnitTestParent*>(this))->RecvComplete();
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 PIPDLUnitTestParent::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PIPDLUnitTestParent::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PIPDLUnitTestParent::DoomSubtree() -> void
{
SetDoomed();
}
auto PIPDLUnitTestParent::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace _ipdltest
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::_ipdltest::PIPDLUnitTestParent*>::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::PIPDLUnitTestParent*>::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, "PIPDLUnitTest", PIPDLUnitTestMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::_ipdltest::PIPDLUnitTestParent*>(actor.ref());
}
return {};
}
} // namespace IPC