//
// Automatically generated by ipdlc.
// Edit at your own risk
//


#include "mozilla/ipc/PUtilityProcessParent.h"
#include "ProfileAdditionalInformation.h"
#include "mozilla/D3DMessageUtils.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/ipc/ByteBufUtils.h"
#include "mozilla/ipc/IPCCore.h"
#include "mozilla/ipc/UtilityProcessParent.h"

#include "mozilla/PProfilerParent.h"
#include "mozilla/ipc/PUtilityMediaServiceParent.h"
#include "mozilla/dom/PJSOracleParent.h"
#include "mozilla/hwinference/PHWInferenceParent.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 ipc {


auto PUtilityProcessParent::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

auto PUtilityProcessParent::ShouldContinueFromReplyTimeout() -> bool
{
    return true;
}

MOZ_IMPLICIT PUtilityProcessParent::PUtilityProcessParent() :
    mozilla::ipc::IToplevelProtocol("PUtilityProcessParent", kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PUtilityProcessParent);
}

PUtilityProcessParent::~PUtilityProcessParent()
{
    MOZ_COUNT_DTOR(PUtilityProcessParent);
}

auto PUtilityProcessParent::ActorAlloc() -> void
{
    MOZ_RELEASE_ASSERT(XRE_IsParentProcess(), "Invalid process for `PUtilityProcessParent'");
    AddRef();
}

auto PUtilityProcessParent::ActorDealloc() -> void
{
    Release();
}

auto PUtilityProcessParent::OtherPid() const -> ::base::ProcessId
{
    ::base::ProcessId pid =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherPidMaybeInvalid();
    MOZ_RELEASE_ASSERT(pid != ::base::kInvalidProcessId);
    return pid;
}

auto PUtilityProcessParent::OtherChildID() const -> ::GeckoChildID
{
    ::GeckoChildID childID =
        ::mozilla::ipc::IProtocol::ToplevelProtocol()->OtherChildIDMaybeInvalid();
    MOZ_RELEASE_ASSERT(childID != -1);
    return childID;
}

auto PUtilityProcessParent::OtherEndpointProcInfo() const -> ::mozilla::ipc::EndpointProcInfo
{
    return ::mozilla::ipc::EndpointProcInfo{OtherPid(), OtherChildID()};
}

auto PUtilityProcessParent::ManagedProtocolIds() const -> mozilla::Span<mozilla::ipc::ProtocolId const>
{
    return {};
}

auto PUtilityProcessParent::GetManagedActors(mozilla::ipc::ProtocolId aProtocol) -> UntypedManagedContainer*
{
    switch (aProtocol) {
    default:
        return nullptr;
    }
}

auto PUtilityProcessParent::RejectPendingResponses(ResponseRejectReason aReason) -> void
{
    mAsyncCallbacks.RejectPendingResponses(aReason);
}

auto PUtilityProcessParent::SendInit(
        const mozilla::Maybe<FileDescriptor>& sandboxBroker,
        const bool& canRecordReleaseTelemetry,
        const bool& aIsReadyForBackgroundProcessing) -> bool
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_Init(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), sandboxBroker);
    // Sentinel = 'sandboxBroker'
    ((&(writer__)))->WriteSentinel(625149269);
    IPC::WriteParam((&(writer__)), canRecordReleaseTelemetry);
    // Sentinel = 'canRecordReleaseTelemetry'
    ((&(writer__)))->WriteSentinel(2148731406);
    IPC::WriteParam((&(writer__)), aIsReadyForBackgroundProcessing);
    // Sentinel = 'aIsReadyForBackgroundProcessing'
    ((&(writer__)))->WriteSentinel(3228372055);


    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_Init", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PUtilityProcessParent::SendInitProfiler(Endpoint<::mozilla::PProfilerChild>&& endpoint) -> bool
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_InitProfiler(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), std::move(endpoint));
    // Sentinel = 'endpoint'
    ((&(writer__)))->WriteSentinel(251724642);


    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_InitProfiler", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PUtilityProcessParent::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__ = PUtilityProcess::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("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_RequestMemoryReport", OTHER);

    IPC::Message::seqno_t seqno__ = 0;
    if (ChannelSend(std::move(msg__), (&(seqno__)))) {
        mAsyncCallbacks.AddCallback(seqno__, PUtilityProcess::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 PUtilityProcessParent::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::forward<const uint32_t&>(generation), std::forward<const bool&>(anonymize), std::forward<const bool&>(minimizeMemoryUsage), std::forward<const mozilla::Maybe<FileDescriptor>&>(DMDFile), [promise__](uint32_t&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PUtilityProcessParent::SendPreferenceUpdate(const Pref& pref) -> bool
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_PreferenceUpdate(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), pref);
    // Sentinel = 'pref'
    ((&(writer__)))->WriteSentinel(71958958);


    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_PreferenceUpdate", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PUtilityProcessParent::SendFlushFOGData(
        mozilla::ipc::ResolveCallback<ByteBuf>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_FlushFOGData(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_FlushFOGData", OTHER);

    IPC::Message::seqno_t seqno__ = 0;
    if (ChannelSend(std::move(msg__), (&(seqno__)))) {
        mAsyncCallbacks.AddCallback(seqno__, PUtilityProcess::Reply_FlushFOGData__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
            auto maybe__buf = IPC::ReadParam<ByteBuf>(aReader);
            if (!maybe__buf) {
                (aReader)->FatalError("Error deserializing 'ByteBuf'");
                return MsgValueError;

            }
            auto& buf = *maybe__buf;
            // Sentinel = 'buf'
            if ((!((aReader)->ReadSentinel(41484606)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ByteBuf'");
                return MsgValueError;
            }


            aReader->EndRead();

            resolve(std::move(buf));
            return MsgProcessed;
        }, std::move(aReject));
    }
    else {
        aReject(::mozilla::ipc::ResponseRejectReason::SendError);
    }
    return;
}

auto PUtilityProcessParent::SendFlushFOGData() -> RefPtr<FlushFOGDataPromise>
{
    RefPtr<MozPromise<ByteBuf, ResponseRejectReason, true>::Private> promise__ = new MozPromise<ByteBuf, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendFlushFOGData([promise__](ByteBuf&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PUtilityProcessParent::SendTestTriggerMetrics(
        mozilla::ipc::ResolveCallback<bool>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_TestTriggerMetrics(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_TestTriggerMetrics", OTHER);

    IPC::Message::seqno_t seqno__ = 0;
    if (ChannelSend(std::move(msg__), (&(seqno__)))) {
        mAsyncCallbacks.AddCallback(seqno__, PUtilityProcess::Reply_TestTriggerMetrics__ID, [resolve=std::move(aResolve)](IPC::MessageReader* aReader) mutable {
            auto maybe__unused = IPC::ReadParam<bool>(aReader);
            if (!maybe__unused) {
                (aReader)->FatalError("Error deserializing 'bool'");
                return MsgValueError;

            }
            auto& unused = *maybe__unused;
            // Sentinel = 'unused'
            if ((!((aReader)->ReadSentinel(155517589)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'bool'");
                return MsgValueError;
            }


            aReader->EndRead();

            resolve(std::move(unused));
            return MsgProcessed;
        }, std::move(aReject));
    }
    else {
        aReject(::mozilla::ipc::ResponseRejectReason::SendError);
    }
    return;
}

auto PUtilityProcessParent::SendTestTriggerMetrics() -> RefPtr<TestTriggerMetricsPromise>
{
    RefPtr<MozPromise<bool, ResponseRejectReason, true>::Private> promise__ = new MozPromise<bool, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendTestTriggerMetrics([promise__](bool&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PUtilityProcessParent::SendTestTelemetryProbes() -> bool
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_TestTelemetryProbes(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_TestTelemetryProbes", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PUtilityProcessParent::SendStartUtilityMediaService(
        Endpoint<::mozilla::ipc::PUtilityMediaServiceParent>&& aEndpoint,
        mozilla::Span<GfxVarUpdate const> updates) -> bool
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_StartUtilityMediaService(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), std::move(aEndpoint));
    // Sentinel = 'aEndpoint'
    ((&(writer__)))->WriteSentinel(292225955);
    IPC::WriteParam((&(writer__)), updates);
    // Sentinel = 'updates'
    ((&(writer__)))->WriteSentinel(199951095);


    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_StartUtilityMediaService", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PUtilityProcessParent::SendStartJSOracleService(Endpoint<::mozilla::dom::PJSOracleChild>&& aEndpoint) -> bool
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_StartJSOracleService(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), std::move(aEndpoint));
    // Sentinel = 'aEndpoint'
    ((&(writer__)))->WriteSentinel(292225955);


    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_StartJSOracleService", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PUtilityProcessParent::SendStartHWInferenceService(Endpoint<::mozilla::hwinference::PHWInferenceChild>&& aEndpoint) -> bool
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_StartHWInferenceService(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), std::move(aEndpoint));
    // Sentinel = 'aEndpoint'
    ((&(writer__)))->WriteSentinel(292225955);


    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_StartHWInferenceService", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PUtilityProcessParent::SendShutdown() -> bool
{
    UniquePtr<IPC::Message> msg__ = PUtilityProcess::Msg_Shutdown(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



    if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PUtilityProcessParent",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PUtilityProcess::Msg_Shutdown", OTHER);

    bool sendok__ = ChannelSend(std::move(msg__));
    return sendok__;
}

auto PUtilityProcessParent::DeallocManagee(
        mozilla::ipc::ProtocolId aProtocolId,
        IProtocol* aListener) -> void
{
    FatalError("unreached");
    return;
}

auto PUtilityProcessParent::OnMessageReceived(const Message& msg__) -> PUtilityProcessParent::Result
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PUtilityProcessParent",
                this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                "Ignored message for dead actor",
                (&(msg__))->type(),
                mozilla::ipc::MessageDirection::eSending);
        }
        return MsgProcessed;

    }
    switch (msg__.type()) {
    case PUtilityProcess::Msg_InitCrashReporter__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::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<::mozilla::ipc::UtilityProcessParent*>(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 PUtilityProcess::Msg_AddMemoryReport__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::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<::mozilla::ipc::UtilityProcessParent*>(this))->RecvAddMemoryReport(std::move(aReport));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_FOGData__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_FOGData", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__buf = IPC::ReadParam<ByteBuf>((&(reader__)));
            if (!maybe__buf) {
                FatalError("Error deserializing 'ByteBuf'");
                return MsgValueError;

            }
            auto& buf = *maybe__buf;
            // Sentinel = 'buf'
            if ((!(((&(reader__)))->ReadSentinel(41484606)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ByteBuf'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvFOGData(std::move(buf));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_GeckoTraceExport__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_GeckoTraceExport", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aBuf = IPC::ReadParam<ByteBuf>((&(reader__)));
            if (!maybe__aBuf) {
                FatalError("Error deserializing 'ByteBuf'");
                return MsgValueError;

            }
            auto& aBuf = *maybe__aBuf;
            // Sentinel = 'aBuf'
            if ((!(((&(reader__)))->ReadSentinel(60686719)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ByteBuf'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvGeckoTraceExport(std::move(aBuf));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_AccumulateChildHistograms__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_AccumulateChildHistograms", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__accumulations = IPC::ReadParam<nsTArray<HistogramAccumulation>>((&(reader__)));
            if (!maybe__accumulations) {
                FatalError("Error deserializing 'HistogramAccumulation[]'");
                return MsgValueError;

            }
            auto& accumulations = *maybe__accumulations;
            // Sentinel = 'accumulations'
            if ((!(((&(reader__)))->ReadSentinel(632030585)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'HistogramAccumulation[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvAccumulateChildHistograms(std::move(accumulations));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_AccumulateChildKeyedHistograms__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_AccumulateChildKeyedHistograms", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__accumulations = IPC::ReadParam<nsTArray<KeyedHistogramAccumulation>>((&(reader__)));
            if (!maybe__accumulations) {
                FatalError("Error deserializing 'KeyedHistogramAccumulation[]'");
                return MsgValueError;

            }
            auto& accumulations = *maybe__accumulations;
            // Sentinel = 'accumulations'
            if ((!(((&(reader__)))->ReadSentinel(632030585)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'KeyedHistogramAccumulation[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvAccumulateChildKeyedHistograms(std::move(accumulations));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_UpdateChildScalars__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_UpdateChildScalars", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__actions = IPC::ReadParam<nsTArray<ScalarAction>>((&(reader__)));
            if (!maybe__actions) {
                FatalError("Error deserializing 'ScalarAction[]'");
                return MsgValueError;

            }
            auto& actions = *maybe__actions;
            // Sentinel = 'actions'
            if ((!(((&(reader__)))->ReadSentinel(193200882)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ScalarAction[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvUpdateChildScalars(std::move(actions));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_UpdateChildKeyedScalars__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_UpdateChildKeyedScalars", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__actions = IPC::ReadParam<nsTArray<KeyedScalarAction>>((&(reader__)));
            if (!maybe__actions) {
                FatalError("Error deserializing 'KeyedScalarAction[]'");
                return MsgValueError;

            }
            auto& actions = *maybe__actions;
            // Sentinel = 'actions'
            if ((!(((&(reader__)))->ReadSentinel(193200882)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'KeyedScalarAction[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvUpdateChildKeyedScalars(std::move(actions));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_RecordChildEvents__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_RecordChildEvents", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__events = IPC::ReadParam<nsTArray<ChildEventData>>((&(reader__)));
            if (!maybe__events) {
                FatalError("Error deserializing 'ChildEventData[]'");
                return MsgValueError;

            }
            auto& events = *maybe__events;
            // Sentinel = 'events'
            if ((!(((&(reader__)))->ReadSentinel(149619350)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ChildEventData[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvRecordChildEvents(std::move(events));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_RecordDiscardedData__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_RecordDiscardedData", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__data = IPC::ReadParam<DiscardedData>((&(reader__)));
            if (!maybe__data) {
                FatalError("Error deserializing 'DiscardedData'");
                return MsgValueError;

            }
            auto& data = *maybe__data;
            // Sentinel = 'data'
            if ((!(((&(reader__)))->ReadSentinel(67109275)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'DiscardedData'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvRecordDiscardedData(std::move(data));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_InitCompleted__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_InitCompleted", OTHER);

            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvInitCompleted();
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_ShutdownProfile__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_ShutdownProfile", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

            auto maybe__aProfileAndAdditionalInformation = IPC::ReadParam<ProfileAndAdditionalInformation>((&(reader__)));
            if (!maybe__aProfileAndAdditionalInformation) {
                FatalError("Error deserializing 'ProfileAndAdditionalInformation'");
                return MsgValueError;

            }
            auto& aProfileAndAdditionalInformation = *maybe__aProfileAndAdditionalInformation;
            // Sentinel = 'aProfileAndAdditionalInformation'
            if ((!(((&(reader__)))->ReadSentinel(3466529989)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'ProfileAndAdditionalInformation'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvShutdownProfile(std::move(aProfileAndAdditionalInformation));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Msg_FinishShutdown__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_FinishShutdown", OTHER);

            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::ipc::UtilityProcessParent*>(this))->RecvFinishShutdown();
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PUtilityProcess::Reply_RequestMemoryReport__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_RequestMemoryReport", OTHER);


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PUtilityProcess::Reply_FlushFOGData__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_FlushFOGData", OTHER);


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PUtilityProcess::Reply_TestTriggerMetrics__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PUtilityProcess", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PUtilityProcessParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

            AUTO_PROFILER_LABEL("PUtilityProcess::Msg_TestTriggerMetrics", 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 PUtilityProcessParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PUtilityProcessParent::Result
{
    if (!CanSend()) {
        return MsgDropped;

    }
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}



} // namespace ipc
} // namespace mozilla
