Copy as Markdown
Other Tools
//
// Automatically generated by ipdlc.
// Edit at your own risk
//
#include "mozilla/gfx/PVRChild.h"
#include "VRChild.h"
#include "VRMessageUtils.h"
#include "VRParent.h"
#include "mozilla/D3DMessageUtils.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/gfx/PVRGPUChild.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 gfx {
auto PVRChild::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}
auto PVRChild::ShouldContinueFromReplyTimeout() -> bool
{
    return true;
}
MOZ_IMPLICIT PVRChild::PVRChild() :
    mozilla::ipc::IToplevelProtocol("PVRChild", kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PVRChild);
}
PVRChild::~PVRChild()
{
    MOZ_COUNT_DTOR(PVRChild);
}
auto PVRChild::ActorAlloc() -> void
{
    MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PVRChild'");
    AddRef();
}
auto PVRChild::ActorDealloc() -> void
{
    Release();
}
auto PVRChild::OtherPid() const -> ::base::ProcessId
{
    ::base::ProcessId pid =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
    MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
    return pid;
}
auto PVRChild::OtherChildID() const -> ::GeckoChildID
{
    ::GeckoChildID childID =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
    MOZ_RELEASE_ASSERT(childID != -1);
    return childID;
}
auto PVRChild::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
    return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}
auto PVRChild::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
    return {};
}
auto PVRChild::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
    switch (aProtocol) {
    default:
        return nullptr;
    }
}
auto PVRChild::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
    mAsyncCallbacks.RejectPendingResponses(aReason);
}
auto PVRChild::SendNewGPUVRManager(Endpoint<::mozilla::gfx::PVRGPUParent>&& endpoint) -> bool
{
    UniquePtr<IPC::Message> msg__ = PVR::Msg_NewGPUVRManager(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};
    IPC::WriteParam((&(writer__)), std::move(endpoint));
    // Sentinel = 'endpoint'
    ((&(writer__)))->WriteSentinel(251724642);
    if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PVRChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PVR::Msg_NewGPUVRManager", OTHER);
    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}
auto PVRChild::SendInit(
        mozilla::Span<GfxVarUpdate const> vars,
        const DevicePrefs& devicePrefs) -> bool
{
    UniquePtr<IPC::Message> msg__ = PVR::Msg_Init(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};
    IPC::WriteParam((&(writer__)), vars);
    // Sentinel = 'vars'
    ((&(writer__)))->WriteSentinel(72745405);
    IPC::WriteParam((&(writer__)), devicePrefs);
    // Sentinel = 'devicePrefs'
    ((&(writer__)))->WriteSentinel(445645937);
    if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PVRChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PVR::Msg_Init", OTHER);
    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}
auto PVRChild::SendUpdateVar(mozilla::Span<GfxVarUpdate const> var) -> bool
{
    UniquePtr<IPC::Message> msg__ = PVR::Msg_UpdateVar(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};
    IPC::WriteParam((&(writer__)), var);
    // Sentinel = 'var'
    ((&(writer__)))->WriteSentinel(43581770);
    if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PVRChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PVR::Msg_UpdateVar", OTHER);
    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}
auto PVRChild::SendPreferenceUpdate(const Pref& pref) -> bool
{
    UniquePtr<IPC::Message> msg__ = PVR::Msg_PreferenceUpdate(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};
    IPC::WriteParam((&(writer__)), pref);
    // Sentinel = 'pref'
    ((&(writer__)))->WriteSentinel(71958958);
    if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PVRChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PVR::Msg_PreferenceUpdate", OTHER);
    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}
auto PVRChild::SendOpenVRControllerActionPathToVR(const nsACString& aPath) -> bool
{
    UniquePtr<IPC::Message> msg__ = PVR::Msg_OpenVRControllerActionPathToVR(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};
    IPC::WriteParam((&(writer__)), aPath);
    // Sentinel = 'aPath'
    ((&(writer__)))->WriteSentinel(94175727);
    if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PVRChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PVR::Msg_OpenVRControllerActionPathToVR", OTHER);
    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}
auto PVRChild::SendOpenVRControllerManifestPathToVR(
        const VRControllerType& aType,
        const nsACString& aPath) -> bool
{
    UniquePtr<IPC::Message> msg__ = PVR::Msg_OpenVRControllerManifestPathToVR(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};
    IPC::WriteParam((&(writer__)), aType);
    // Sentinel = 'aType'
    ((&(writer__)))->WriteSentinel(99222020);
    IPC::WriteParam((&(writer__)), aPath);
    // Sentinel = 'aPath'
    ((&(writer__)))->WriteSentinel(94175727);
    if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PVRChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PVR::Msg_OpenVRControllerManifestPathToVR", OTHER);
    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}
auto PVRChild::SendRequestMemoryReport(
        const uint32_t& generation,
        const bool& anonymize,
        const bool& minimizeMemoryUsage,
        const mozilla::Maybe<FileDescriptor>& DMDFile,
        mozilla::ipc::ResolveCallback<uint32_t>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PVR::Msg_RequestMemoryReport(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};
    IPC::WriteParam((&(writer__)), generation);
    // Sentinel = 'generation'
    ((&(writer__)))->WriteSentinel(381158445);
    IPC::WriteParam((&(writer__)), anonymize);
    // Sentinel = 'anonymize'
    ((&(writer__)))->WriteSentinel(321127387);
    IPC::WriteParam((&(writer__)), minimizeMemoryUsage);
    // Sentinel = 'minimizeMemoryUsage'
    ((&(writer__)))->WriteSentinel(1321600977);
    IPC::WriteParam((&(writer__)), DMDFile);
    // Sentinel = 'DMDFile'
    ((&(writer__)))->WriteSentinel(143983190);
    if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PVRChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PVR::Msg_RequestMemoryReport", OTHER);
    IPC::Message::seqno_t seqno__ = 0;
    if (ChannelSend(std::move(msg__), (&(seqno__)))) {
        mAsyncCallbacks.AddCallback(seqno__, PVR::Reply_RequestMemoryReport__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
            auto maybe__aGeneration = IPC::ReadParam<uint32_t>(aReader);
            if (!maybe__aGeneration) {
                (aReader)->FatalError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            auto& aGeneration = *maybe__aGeneration;
            // Sentinel = 'aGeneration'
            if ((!((aReader)->ReadSentinel(430179438)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint32_t'");
                return MsgValueError;
            }
            aReader->EndRead();
            resolve(std::move(aGeneration));
            return MsgProcessed;
        }, std::move(aReject));
    }
    else {
        aReject(::mozilla::ipc::ResponseRejectReason::SendError);
    }
    return;
}
auto PVRChild::SendRequestMemoryReport(
        const uint32_t& generation,
        const bool& anonymize,
        const bool& minimizeMemoryUsage,
        const mozilla::Maybe<FileDescriptor>& DMDFile) -> RefPtr<RequestMemoryReportPromise>
{
    RefPtr<MozPromise<uint32_t, ResponseRejectReason, true>::Private> promise__ = new MozPromise<uint32_t, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendRequestMemoryReport(std::move(generation), std::move(anonymize), std::move(minimizeMemoryUsage), std::move(DMDFile), [promise__](uint32_t&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}
auto PVRChild::DeallocManagee(
        mozilla::ipc::ProtocolId aProtocolId,
        IProtocol* aListener) -> void
{
    FatalError("unreached");
    return;
}
auto PVRChild::OnMessageReceived(const Message& msg__) -> PVRChild::Result
{
    switch (msg__.type()) {
    case PVR::Reply_RequestMemoryReport__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PVRChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PVR::Msg_RequestMemoryReport", OTHER);
            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PVR::Msg_InitComplete__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PVRChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PVR::Msg_InitComplete", OTHER);
            mozilla::ipc::IPCResult __ok = (static_cast<VRChild*>(this))->RecvInitComplete();
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }
            return MsgProcessed;
        }
    case PVR::Msg_OpenVRControllerActionPathToParent__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PVRChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PVR::Msg_OpenVRControllerActionPathToParent", OTHER);
            IPC::MessageReader reader__{
                    msg__,
                    this};
            auto maybe__aPath = IPC::ReadParam<nsCString>((&(reader__)));
            if (!maybe__aPath) {
                FatalError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            auto& aPath = *maybe__aPath;
            // Sentinel = 'aPath'
            if ((!(((&(reader__)))->ReadSentinel(94175727)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<VRChild*>(this))->RecvOpenVRControllerActionPathToParent(std::move(aPath));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }
            return MsgProcessed;
        }
    case PVR::Msg_OpenVRControllerManifestPathToParent__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PVRChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PVR::Msg_OpenVRControllerManifestPathToParent", OTHER);
            IPC::MessageReader reader__{
                    msg__,
                    this};
            auto maybe__aType = IPC::ReadParam<VRControllerType>((&(reader__)));
            if (!maybe__aType) {
                FatalError("Error deserializing 'VRControllerType'");
                return MsgValueError;
            }
            auto& aType = *maybe__aType;
            // Sentinel = 'aType'
            if ((!(((&(reader__)))->ReadSentinel(99222020)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'VRControllerType'");
                return MsgValueError;
            }
            auto maybe__aPath = IPC::ReadParam<nsCString>((&(reader__)));
            if (!maybe__aPath) {
                FatalError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            auto& aPath = *maybe__aPath;
            // Sentinel = 'aPath'
            if ((!(((&(reader__)))->ReadSentinel(94175727)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsCString'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<VRChild*>(this))->RecvOpenVRControllerManifestPathToParent(std::move(aType), std::move(aPath));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }
            return MsgProcessed;
        }
    case PVR::Msg_InitCrashReporter__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PVRChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PVR::Msg_InitCrashReporter", OTHER);
            IPC::MessageReader reader__{
                    msg__,
                    this};
            auto maybe__aInitArgs = IPC::ReadParam<CrashReporterInitArgs>((&(reader__)));
            if (!maybe__aInitArgs) {
                FatalError("Error deserializing 'CrashReporterInitArgs'");
                return MsgValueError;
            }
            auto& aInitArgs = *maybe__aInitArgs;
            // Sentinel = 'aInitArgs'
            if ((!(((&(reader__)))->ReadSentinel(286327683)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'CrashReporterInitArgs'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<VRChild*>(this))->RecvInitCrashReporter(std::move(aInitArgs));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }
            return MsgProcessed;
        }
    case PVR::Msg_AddMemoryReport__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PVR", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PVRChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PVR::Msg_AddMemoryReport", OTHER);
            IPC::MessageReader reader__{
                    msg__,
                    this};
            auto maybe__aReport = IPC::ReadParam<MemoryReport>((&(reader__)));
            if (!maybe__aReport) {
                FatalError("Error deserializing 'MemoryReport'");
                return MsgValueError;
            }
            auto& aReport = *maybe__aReport;
            // Sentinel = 'aReport'
            if ((!(((&(reader__)))->ReadSentinel(184025822)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'MemoryReport'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<VRChild*>(this))->RecvAddMemoryReport(std::move(aReport));
            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 PVRChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PVRChild::Result
{
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}
} // namespace gfx
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::gfx::PVRChild*>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
    // Sentinel = 'PVR'
    (aWriter)->WriteSentinel(32571641);
}
auto ParamTraits<::mozilla::gfx::PVRChild*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
    if (!maybe__actor) {
        aReader->FatalError("Error deserializing managed PVR actor");
        return {};
    }
    auto& actor = *maybe__actor;
    // Sentinel = 'PVR'
    if ((!((aReader)->ReadSentinel(32571641)))) {
        mozilla::ipc::SentinelReadError("Error deserializing managed PVR actor");
        return {};
    }
    if (actor && actor->GetProtocolId() != PVRMsgStart) {
        aReader->FatalError("Unexpected actor type (expected PVR)");
        return {};
    }
    return static_cast<::mozilla::gfx::PVRChild*>(actor);
}
} // namespace IPC