Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/_ipdltest/PTestShmemChild.h"
#include "mozilla/ProfilerLabels.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 PTestShmemChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PTestShmemChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PTestShmemChild::PTestShmemChild() :
mozilla::ipc::IToplevelProtocol("PTestShmemChild", kProtocolId, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PTestShmemChild);
}
PTestShmemChild::~PTestShmemChild()
{
MOZ_COUNT_DTOR(PTestShmemChild);
}
auto PTestShmemChild::ActorAlloc() -> void
{
AddRef();
}
auto PTestShmemChild::ActorDealloc() -> void
{
Release();
}
auto PTestShmemChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PTestShmemChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PTestShmemChild::SendTake(
Shmem&& mem,
Shmem&& unsafe,
const uint32_t& expectedSize) -> bool
{
UniquePtr<IPC::Message> msg__ = PTestShmem::Msg_Take(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), std::move(mem));
// Sentinel = 'mem'
((&(writer__)))->WriteSentinel(42008896);
IPC::WriteParam((&(writer__)), std::move(unsafe));
// Sentinel = 'unsafe'
((&(writer__)))->WriteSentinel(151650947);
IPC::WriteParam((&(writer__)), expectedSize);
// Sentinel = 'expectedSize'
((&(writer__)))->WriteSentinel(542311662);
if (mozilla::ipc::LoggingEnabledFor("PTestShmem", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestShmemChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PTestShmem::Msg_Take", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PTestShmemChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PTestShmemChild::OnMessageReceived(const Message& msg__) -> PTestShmemChild::Result
{
switch (msg__.type()) {
case PTestShmem::Msg_Give__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestShmem", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestShmemChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestShmem::Msg_Give", OTHER);
IPC::MessageReader reader__{
msg__,
this};
auto maybe__mem = IPC::ReadParam<Shmem>((&(reader__)));
if (!maybe__mem) {
FatalError("Error deserializing 'Shmem'");
return MsgValueError;
}
auto& mem = *maybe__mem;
// Sentinel = 'mem'
if ((!(((&(reader__)))->ReadSentinel(42008896)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Shmem'");
return MsgValueError;
}
auto maybe__unsafe = IPC::ReadParam<Shmem>((&(reader__)));
if (!maybe__unsafe) {
FatalError("Error deserializing 'Shmem'");
return MsgValueError;
}
auto& unsafe = *maybe__unsafe;
// Sentinel = 'unsafe'
if ((!(((&(reader__)))->ReadSentinel(151650947)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'Shmem'");
return MsgValueError;
}
auto maybe__expectedSize = IPC::ReadParam<uint32_t>((&(reader__)));
if (!maybe__expectedSize) {
FatalError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto& expectedSize = *maybe__expectedSize;
// Sentinel = 'expectedSize'
if ((!(((&(reader__)))->ReadSentinel(542311662)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
return MsgValueError;
}
reader__.EndRead();
mozilla::ipc::IPCResult __ok = (this)->RecvGive(std::move(mem), std::move(unsafe), std::move(expectedSize));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PTestShmem::Reply___delete____ID:
{
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 PTestShmemChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PTestShmemChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
} // namespace _ipdltest
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::_ipdltest::PTestShmemChild*>::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::PTestShmemChild*>::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, "PTestShmem", PTestShmemMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::_ipdltest::PTestShmemChild*>(actor.ref());
}
return {};
}
} // namespace IPC