Copy as Markdown

Other Tools

//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/PRemoteLazyInputStreamChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteLazyInputStreamChild.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 {
auto PRemoteLazyInputStreamChild::ProcessingError(
Result aCode,
const char* aReason) -> void
{
}
auto PRemoteLazyInputStreamChild::ShouldContinueFromReplyTimeout() -> bool
{
return true;
}
MOZ_IMPLICIT PRemoteLazyInputStreamChild::PRemoteLazyInputStreamChild() :
mozilla::ipc::IToplevelProtocol("PRemoteLazyInputStreamChild", PRemoteLazyInputStreamMsgStart, mozilla::ipc::ChildSide)
{
MOZ_COUNT_CTOR(PRemoteLazyInputStreamChild);
}
PRemoteLazyInputStreamChild::~PRemoteLazyInputStreamChild()
{
MOZ_COUNT_DTOR(PRemoteLazyInputStreamChild);
}
auto PRemoteLazyInputStreamChild::ActorAlloc() -> void
{
AddRef();
}
auto PRemoteLazyInputStreamChild::ActorDealloc() -> void
{
Release();
}
auto PRemoteLazyInputStreamChild::AllManagedActorsCount() const -> uint32_t
{
uint32_t total = 0;
return total;
}
auto PRemoteLazyInputStreamChild::SendClone(Endpoint<::mozilla::PRemoteLazyInputStreamParent>&& aCloneEndpoint) -> bool
{
UniquePtr<IPC::Message> msg__ = PRemoteLazyInputStream::Msg_Clone(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), std::move(aCloneEndpoint));
// Sentinel = 'aCloneEndpoint'
((&(writer__)))->WriteSentinel(678036884);
if (mozilla::ipc::LoggingEnabledFor("PRemoteLazyInputStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteLazyInputStreamChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PRemoteLazyInputStream::Msg_Clone", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PRemoteLazyInputStreamChild::SendStreamNeeded(
const uint64_t& aStart,
const uint64_t& aLength,
mozilla::ipc::ResolveCallback<mozilla::Maybe<IPCStream>>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PRemoteLazyInputStream::Msg_StreamNeeded(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
IPC::WriteParam((&(writer__)), aStart);
// Sentinel = 'aStart'
((&(writer__)))->WriteSentinel(137757296);
IPC::WriteParam((&(writer__)), aLength);
// Sentinel = 'aLength'
((&(writer__)))->WriteSentinel(179045060);
if (mozilla::ipc::LoggingEnabledFor("PRemoteLazyInputStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteLazyInputStreamChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PRemoteLazyInputStream::Msg_StreamNeeded", OTHER);
ChannelSend(std::move(msg__), PRemoteLazyInputStream::Reply_StreamNeeded__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PRemoteLazyInputStreamChild::SendStreamNeeded(
const uint64_t& aStart,
const uint64_t& aLength) -> RefPtr<StreamNeededPromise>
{
RefPtr<MozPromise<mozilla::Maybe<IPCStream>, ResponseRejectReason, true>::Private> promise__ = new MozPromise<mozilla::Maybe<IPCStream>, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendStreamNeeded(std::move(aStart), std::move(aLength), [promise__](mozilla::Maybe<IPCStream>&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PRemoteLazyInputStreamChild::SendLengthNeeded(
mozilla::ipc::ResolveCallback<int64_t>&& aResolve,
mozilla::ipc::RejectCallback&& aReject) -> void
{
UniquePtr<IPC::Message> msg__ = PRemoteLazyInputStream::Msg_LengthNeeded(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PRemoteLazyInputStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteLazyInputStreamChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PRemoteLazyInputStream::Msg_LengthNeeded", OTHER);
ChannelSend(std::move(msg__), PRemoteLazyInputStream::Reply_LengthNeeded__ID, std::move(aResolve), std::move(aReject));
return;
}
auto PRemoteLazyInputStreamChild::SendLengthNeeded() -> RefPtr<LengthNeededPromise>
{
RefPtr<MozPromise<int64_t, ResponseRejectReason, true>::Private> promise__ = new MozPromise<int64_t, ResponseRejectReason, true>::Private(__func__);
promise__->UseDirectTaskDispatch(__func__);
SendLengthNeeded([promise__](int64_t&& aValue) {
promise__->Resolve(std::move(aValue), __func__);
}, [promise__](ResponseRejectReason&& aReason) {
promise__->Reject(std::move(aReason), __func__);
});
return promise__;
}
auto PRemoteLazyInputStreamChild::SendGoodbye() -> bool
{
UniquePtr<IPC::Message> msg__ = PRemoteLazyInputStream::Msg_Goodbye(MSG_ROUTING_CONTROL);
IPC::MessageWriter writer__{
(*(msg__)),
this};
if (mozilla::ipc::LoggingEnabledFor("PRemoteLazyInputStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteLazyInputStreamChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Sending ",
msg__->type(),
mozilla::ipc::MessageDirection::eSending);
}
AUTO_PROFILER_LABEL("PRemoteLazyInputStream::Msg_Goodbye", OTHER);
bool sendok__ = ChannelSend(std::move(msg__));
return sendok__;
}
auto PRemoteLazyInputStreamChild::RemoveManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PRemoteLazyInputStreamChild::DeallocManagee(
int32_t aProtocolId,
IProtocol* aListener) -> void
{
FatalError("unreached");
return;
}
auto PRemoteLazyInputStreamChild::OnMessageReceived(const Message& msg__) -> PRemoteLazyInputStreamChild::Result
{
switch (msg__.type()) {
case PRemoteLazyInputStream::Reply_StreamNeeded__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteLazyInputStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteLazyInputStreamChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteLazyInputStream::Msg_StreamNeeded", OTHER);
IPC::MessageReader reader__{
msg__,
this};
bool resolve__ = false;
if (!IPC::ReadParam(&reader__, &resolve__)) {
FatalError("Error deserializing bool");
return MsgValueError;
}
UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback =
GetIPCChannel()->PopCallback(msg__, Id());
typedef MessageChannel::CallbackHolder<mozilla::Maybe<IPCStream>> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__stream = IPC::ReadParam<mozilla::Maybe<IPCStream>>((&(reader__)));
if (!maybe__stream) {
FatalError("Error deserializing 'IPCStream?'");
return MsgValueError;
}
auto& stream = *maybe__stream;
// Sentinel = 'stream'
if ((!(((&(reader__)))->ReadSentinel(153223821)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'IPCStream?'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(stream));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
return MsgProcessed;
}
case PRemoteLazyInputStream::Reply_LengthNeeded__ID:
{
if (mozilla::ipc::LoggingEnabledFor("PRemoteLazyInputStream", mozilla::ipc::ChildSide)) {
mozilla::ipc::LogMessageForProtocol(
"PRemoteLazyInputStreamChild",
this->ToplevelProtocol()->OtherPidMaybeInvalid(),
"Received ",
(&(msg__))->type(),
mozilla::ipc::MessageDirection::eReceiving);
}
AUTO_PROFILER_LABEL("PRemoteLazyInputStream::Msg_LengthNeeded", OTHER);
IPC::MessageReader reader__{
msg__,
this};
bool resolve__ = false;
if (!IPC::ReadParam(&reader__, &resolve__)) {
FatalError("Error deserializing bool");
return MsgValueError;
}
UniquePtr<MessageChannel::UntypedCallbackHolder> untypedCallback =
GetIPCChannel()->PopCallback(msg__, Id());
typedef MessageChannel::CallbackHolder<int64_t> CallbackHolder;
auto* callback = static_cast<CallbackHolder*>(untypedCallback.get());
if (!callback) {
FatalError("Error unknown callback");
return MsgProcessingError;
}
if (resolve__) {
auto maybe__length = IPC::ReadParam<int64_t>((&(reader__)));
if (!maybe__length) {
FatalError("Error deserializing 'int64_t'");
return MsgValueError;
}
auto& length = *maybe__length;
// Sentinel = 'length'
if ((!(((&(reader__)))->ReadSentinel(147063427)))) {
mozilla::ipc::SentinelReadError("Error deserializing 'int64_t'");
return MsgValueError;
}
reader__.EndRead();
callback->Resolve(std::move(length));
} else {
ResponseRejectReason reason__{};
if (!IPC::ReadParam(&reader__, &reason__)) {
FatalError("Error deserializing ResponseRejectReason");
return MsgValueError;
}
reader__.EndRead();
callback->Reject(std::move(reason__));
}
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 PRemoteLazyInputStreamChild::OnMessageReceived(
const Message& msg__,
UniquePtr<Message>& reply__) -> PRemoteLazyInputStreamChild::Result
{
MOZ_ASSERT_UNREACHABLE("message protocol not supported");
return MsgNotKnown;
}
auto PRemoteLazyInputStreamChild::DoomSubtree() -> void
{
SetDoomed();
}
auto PRemoteLazyInputStreamChild::PeekManagedActor() -> IProtocol*
{
return nullptr;
}
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::PRemoteLazyInputStreamChild*>::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::PRemoteLazyInputStreamChild*>::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, "PRemoteLazyInputStream", PRemoteLazyInputStreamMsgStart);
if (actor.isSome()) {
return static_cast<::mozilla::PRemoteLazyInputStreamChild*>(actor.ref());
}
return {};
}
} // namespace IPC