Copy as Markdown
Other Tools
//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/_ipdltest/PTestAsyncReturnsChild.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 PTestAsyncReturnsChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PTestAsyncReturnsChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PTestAsyncReturnsChild::PTestAsyncReturnsChild() :
mozilla::ipc::IToplevelProtocol("PTestAsyncReturnsChild", kProtocolId, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PTestAsyncReturnsChild);
}
PTestAsyncReturnsChild::~PTestAsyncReturnsChild()
{
MOZ_COUNT_DTOR(PTestAsyncReturnsChild);
}
auto PTestAsyncReturnsChild::ActorAlloc() -> void
{
AddRef();
}
auto PTestAsyncReturnsChild::ActorDealloc() -> void
{
Release();
}
auto PTestAsyncReturnsChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
return {};
}
auto PTestAsyncReturnsChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
switch (aProtocol) {
default:
return nullptr;
}
}
auto PTestAsyncReturnsChild::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
mAsyncCallbacks.RejectPendingResponses(aReason);
}
auto PTestAsyncReturnsChild::SendPong(
mozilla::ipc::ResolveCallback<std::tuple<uint32_t, uint32_t>>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PTestAsyncReturns::Msg_Pong(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PTestAsyncReturns", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestAsyncReturnsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PTestAsyncReturns::Msg_Pong", OTHER);
int32_t seqno__ = 0;
if (ChannelSend(std::move(msg__), (&(seqno__)))) {
mAsyncCallbacks.AddCallback(seqno__, PTestAsyncReturns::Reply_Pong__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
auto maybe__param1 = IPC::ReadParam<uint32_t>(aReader);
if (!maybe__param1) {
(aReader)->FatalError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto& param1 = *maybe__param1;
// Sentinel = 'param1'
if ((!((aReader)->ReadSentinel(142672451)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto maybe__param2 = IPC::ReadParam<uint32_t>(aReader);
if (!maybe__param2) {
(aReader)->FatalError("Error deserializing 'uint32_t'");
return MsgValueError;
}
auto& param2 = *maybe__param2;
// Sentinel = 'param2'
if ((!((aReader)->ReadSentinel(142737988)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
return MsgValueError;
}
aReader->EndRead();
resolve(std::make_tuple(std::move(param1), std::move(param2)));
return MsgProcessed;
}, std::move(aReject));
}
else {
aReject(::mozilla::ipc::ResponseRejectReason::SendError);
}
return;
}
auto PTestAsyncReturnsChild::SendPong() -> RefPtr<PongPromise>
{
RefPtr<MozPromise<std::tuple<uint32_t, uint32_t>, ResponseRejectReason, true>::Private> promise__ = new MozPromise<std::tuple<uint32_t, uint32_t>, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendPong([promise__](std::tuple<uint32_t, uint32_t>&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PTestAsyncReturnsChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PTestAsyncReturnsChild::OnMessageReceived(const Message& msg__) -> PTestAsyncReturnsChild::Result
{
switch (msg__.type()) {
case PTestAsyncReturns::Msg_Ping__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestAsyncReturns", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestAsyncReturnsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestAsyncReturns::Msg_Ping", OTHER);
int32_t id__ = MSG_ROUTING_CONTROL;
UniquePtr<IPC::Message> reply__(PTestAsyncReturns::Reply_Ping(id__));
reply__->set_seqno(msg__.seqno());
RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);
PingResolver resolver = [resolver__ = std::move(resolver__)](const bool& aParam) {
resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
IPC::MessageWriter writer__(*reply__, self__);
IPC::WriteParam((&(writer__)), aParam);
// Sentinel = 'one'
((&(writer__)))->WriteSentinel(43057475);
if (mozilla::ipc::LoggingEnabledFor("PTestAsyncReturns", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestAsyncReturnsChild",
self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
});
};
mozilla::ipc::IPCResult __ok = (this)->RecvPing(std::move(resolver));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PTestAsyncReturns::Msg_NoReturn__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestAsyncReturns", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestAsyncReturnsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestAsyncReturns::Msg_NoReturn", OTHER);
int32_t id__ = MSG_ROUTING_CONTROL;
UniquePtr<IPC::Message> reply__(PTestAsyncReturns::Reply_NoReturn(id__));
reply__->set_seqno(msg__.seqno());
RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);
NoReturnResolver resolver = [resolver__ = std::move(resolver__)](const bool& aParam) {
resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
IPC::MessageWriter writer__(*reply__, self__);
IPC::WriteParam((&(writer__)), aParam);
// Sentinel = 'unused'
((&(writer__)))->WriteSentinel(155517589);
if (mozilla::ipc::LoggingEnabledFor("PTestAsyncReturns", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestAsyncReturnsChild",
self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending reply ",
reply__->type(),
mozilla::ipc::MessageDirection::eSending);
}
});
};
mozilla::ipc::IPCResult __ok = (this)->RecvNoReturn(std::move(resolver));
if ((!(__ok))) {
mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
// Error handled in mozilla::ipc::IPCResult
return MsgProcessingError;
}
return MsgProcessed;
}
case PTestAsyncReturns::Reply_Pong__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PTestAsyncReturns", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PTestAsyncReturnsChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PTestAsyncReturns::Msg_Pong", OTHER);
return mAsyncCallbacks.GotReply(this, msg__);
}
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 PTestAsyncReturnsChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PTestAsyncReturnsChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
} // namespace _ipdltest
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::_ipdltest::PTestAsyncReturnsChild*>::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::PTestAsyncReturnsChild*>::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, "PTestAsyncReturns", PTestAsyncReturnsMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::_ipdltest::PTestAsyncReturnsChild*>(actor.ref());
}
return {};
}
} // namespace IPC