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


#include "mozilla/dom/PSpeechSynthesisRequestParent.h"
#include "mozilla/ProfilerLabels.h"

#include "mozilla/dom/PSpeechSynthesisParent.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 dom {


auto PSpeechSynthesisRequestParent::Recv__delete__() -> mozilla::ipc::IPCResult
{
    return IPC_OK();
}

MOZ_IMPLICIT PSpeechSynthesisRequestParent::PSpeechSynthesisRequestParent() :
    mozilla::ipc::IProtocol(kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PSpeechSynthesisRequestParent);
}

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

auto PSpeechSynthesisRequestParent::ActorAlloc() -> void
{
}

auto PSpeechSynthesisRequestParent::ActorDealloc() -> void
{
    if (Manager()) {
        Manager()->DeallocManagee(kProtocolId, this);
    }
}

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

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

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

auto PSpeechSynthesisRequestParent::Manager() const -> PSpeechSynthesisParent*
{
    return static_cast<PSpeechSynthesisParent*>(IProtocol::Manager());
}

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

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

auto PSpeechSynthesisRequestParent::SendOnEnd(
        const bool& aIsError,
        const float& aElapsedTime,
        const uint32_t& aCharIndex) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSpeechSynthesisRequest::Msg_OnEnd(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aIsError);
    // Sentinel = 'aIsError'
    ((&(writer__)))->WriteSentinel(227017512);
    IPC::WriteParam((&(writer__)), aElapsedTime);
    // Sentinel = 'aElapsedTime'
    ((&(writer__)))->WriteSentinel(502334639);
    IPC::WriteParam((&(writer__)), aCharIndex);
    // Sentinel = 'aCharIndex'
    ((&(writer__)))->WriteSentinel(341115864);


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

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

auto PSpeechSynthesisRequestParent::SendOnStart(const nsAString& aUri) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSpeechSynthesisRequest::Msg_OnStart(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PSpeechSynthesisRequestParent::SendOnPause(
        const float& aElapsedTime,
        const uint32_t& aCharIndex) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSpeechSynthesisRequest::Msg_OnPause(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aElapsedTime);
    // Sentinel = 'aElapsedTime'
    ((&(writer__)))->WriteSentinel(502334639);
    IPC::WriteParam((&(writer__)), aCharIndex);
    // Sentinel = 'aCharIndex'
    ((&(writer__)))->WriteSentinel(341115864);


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

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

auto PSpeechSynthesisRequestParent::SendOnResume(
        const float& aElapsedTime,
        const uint32_t& aCharIndex) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSpeechSynthesisRequest::Msg_OnResume(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aElapsedTime);
    // Sentinel = 'aElapsedTime'
    ((&(writer__)))->WriteSentinel(502334639);
    IPC::WriteParam((&(writer__)), aCharIndex);
    // Sentinel = 'aCharIndex'
    ((&(writer__)))->WriteSentinel(341115864);


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

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

auto PSpeechSynthesisRequestParent::SendOnBoundary(
        const nsAString& aName,
        const float& aElapsedTime,
        const uint32_t& aCharIndex,
        const uint32_t& aCharLength,
        const uint8_t& argc) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSpeechSynthesisRequest::Msg_OnBoundary(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aName);
    // Sentinel = 'aName'
    ((&(writer__)))->WriteSentinel(92537315);
    IPC::WriteParam((&(writer__)), aElapsedTime);
    // Sentinel = 'aElapsedTime'
    ((&(writer__)))->WriteSentinel(502334639);
    IPC::WriteParam((&(writer__)), aCharIndex);
    // Sentinel = 'aCharIndex'
    ((&(writer__)))->WriteSentinel(341115864);
    IPC::WriteParam((&(writer__)), aCharLength);
    // Sentinel = 'aCharLength'
    ((&(writer__)))->WriteSentinel(413140034);
    IPC::WriteParam((&(writer__)), argc);
    // Sentinel = 'argc'
    ((&(writer__)))->WriteSentinel(68092318);


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

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

auto PSpeechSynthesisRequestParent::SendOnMark(
        const nsAString& aName,
        const float& aElapsedTime,
        const uint32_t& aCharIndex) -> bool
{
    UniquePtr<IPC::Message> msg__ = PSpeechSynthesisRequest::Msg_OnMark(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aName);
    // Sentinel = 'aName'
    ((&(writer__)))->WriteSentinel(92537315);
    IPC::WriteParam((&(writer__)), aElapsedTime);
    // Sentinel = 'aElapsedTime'
    ((&(writer__)))->WriteSentinel(502334639);
    IPC::WriteParam((&(writer__)), aCharIndex);
    // Sentinel = 'aCharIndex'
    ((&(writer__)))->WriteSentinel(341115864);


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

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

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

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

    }
    switch (msg__.type()) {
    case MANAGED_ENDPOINT_BOUND_MESSAGE_TYPE:
        {
            if (!mAwaitingManagedEndpointBind) {
                NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
                return MsgNotAllowed;
            }
            mAwaitingManagedEndpointBind = false;
            return MsgProcessed;
        }
    case MANAGED_ENDPOINT_DROPPED_MESSAGE_TYPE:
        {
            if (!mAwaitingManagedEndpointBind) {
                NS_WARNING("Unexpected managed endpoint lifecycle message after actor bound!");
                return MsgNotAllowed;
            }
            mAwaitingManagedEndpointBind = false;
            this->ActorDisconnected(ManagedEndpointDropped);
            return MsgProcessed;
        }
    case PSpeechSynthesisRequest::Msg___delete____ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisRequest", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSpeechSynthesisRequestParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSpeechSynthesisRequest::Msg___delete__", OTHER);

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


            this->ActorDisconnected(Deletion);

            return MsgProcessed;
        }
    case PSpeechSynthesisRequest::Msg_Pause__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisRequest", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSpeechSynthesisRequestParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSpeechSynthesisRequest::Msg_Pause", OTHER);

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

            return MsgProcessed;
        }
    case PSpeechSynthesisRequest::Msg_Resume__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisRequest", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSpeechSynthesisRequestParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSpeechSynthesisRequest::Msg_Resume", OTHER);

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

            return MsgProcessed;
        }
    case PSpeechSynthesisRequest::Msg_Cancel__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisRequest", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSpeechSynthesisRequestParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSpeechSynthesisRequest::Msg_Cancel", OTHER);

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

            return MsgProcessed;
        }
    case PSpeechSynthesisRequest::Msg_ForceEnd__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisRequest", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSpeechSynthesisRequestParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSpeechSynthesisRequest::Msg_ForceEnd", OTHER);

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

            return MsgProcessed;
        }
    case PSpeechSynthesisRequest::Msg_SetAudioOutputVolume__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PSpeechSynthesisRequest", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PSpeechSynthesisRequestParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PSpeechSynthesisRequest::Msg_SetAudioOutputVolume", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aVolume = *maybe__aVolume;
            // Sentinel = 'aVolume'
            if ((!(((&(reader__)))->ReadSentinel(187368154)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'float'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (this)->RecvSetAudioOutputVolume(std::move(aVolume));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}

auto PSpeechSynthesisRequestParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PSpeechSynthesisRequestParent::Result
{
    if (!CanSend()) {
        return MsgDropped;

    }
    return MsgNotKnown;
}



} // namespace dom
} // namespace mozilla
