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


#include "mozilla/dom/PRemoteWorkerDebuggerParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/ClientIPCUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/RemoteType.h"
#include "mozilla/dom/RemoteWorkerDebuggerParent.h"
#include "mozilla/dom/WorkerIPCUtils.h"
#include "mozilla/ipc/IPCCore.h"
#include "nsIPrincipal.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 PRemoteWorkerDebuggerParent::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

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

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

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

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

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

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

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

auto PRemoteWorkerDebuggerParent::SendRegisterDone() -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteWorkerDebugger::Msg_RegisterDone(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



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

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

auto PRemoteWorkerDebuggerParent::SendUnregisterDone() -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteWorkerDebugger::Msg_UnregisterDone(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};



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

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

auto PRemoteWorkerDebuggerParent::SendInitialize(const nsAString& aURL) -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteWorkerDebugger::Msg_Initialize(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PRemoteWorkerDebuggerParent::SendPostMessage(const nsAString& aMessage) -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteWorkerDebugger::Msg_PostMessage(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PRemoteWorkerDebuggerParent::SendSetDebuggerReady(const bool& aReady) -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteWorkerDebugger::Msg_SetDebuggerReady(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

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

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

    }
    switch (msg__.type()) {
    case PRemoteWorkerDebugger::Msg_Unregister__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteWorkerDebugger", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteWorkerDebuggerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteWorkerDebugger::Msg_Unregister", OTHER);

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

            return MsgProcessed;
        }
    case PRemoteWorkerDebugger::Msg_PostMessageToDebugger__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteWorkerDebugger", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteWorkerDebuggerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteWorkerDebugger::Msg_PostMessageToDebugger", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aMessage = *maybe__aMessage;
            // Sentinel = 'aMessage'
            if ((!(((&(reader__)))->ReadSentinel(233440039)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::dom::RemoteWorkerDebuggerParent*>(this))->RecvPostMessageToDebugger(std::move(aMessage));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteWorkerDebugger::Msg_ReportErrorToDebugger__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteWorkerDebugger", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteWorkerDebuggerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteWorkerDebugger::Msg_ReportErrorToDebugger", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aErrorInfo = *maybe__aErrorInfo;
            // Sentinel = 'aErrorInfo'
            if ((!(((&(reader__)))->ReadSentinel(359400440)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteWorkerDebuggerErrorInfo'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::dom::RemoteWorkerDebuggerParent*>(this))->RecvReportErrorToDebugger(std::move(aErrorInfo));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteWorkerDebugger::Msg_SetAsInitialized__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteWorkerDebugger", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteWorkerDebuggerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteWorkerDebugger::Msg_SetAsInitialized", OTHER);

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

            return MsgProcessed;
        }
    case PRemoteWorkerDebugger::Msg_SetAsClosed__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteWorkerDebugger", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteWorkerDebuggerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteWorkerDebugger::Msg_SetAsClosed", OTHER);

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

            return MsgProcessed;
        }
    case PRemoteWorkerDebugger::Msg_AddWindowID__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteWorkerDebugger", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteWorkerDebuggerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteWorkerDebugger::Msg_AddWindowID", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aWindowID = *maybe__aWindowID;
            // Sentinel = 'aWindowID'
            if ((!(((&(reader__)))->ReadSentinel(294126439)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::dom::RemoteWorkerDebuggerParent*>(this))->RecvAddWindowID(std::move(aWindowID));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteWorkerDebugger::Msg_RemoveWindowID__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteWorkerDebugger", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteWorkerDebuggerParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteWorkerDebugger::Msg_RemoveWindowID", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& aWindowID = *maybe__aWindowID;
            // Sentinel = 'aWindowID'
            if ((!(((&(reader__)))->ReadSentinel(294126439)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint64_t'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::dom::RemoteWorkerDebuggerParent*>(this))->RecvRemoveWindowID(std::move(aWindowID));
            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 PRemoteWorkerDebuggerParent::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PRemoteWorkerDebuggerParent::Result
{
    if (!CanSend()) {
        return MsgDropped;

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



} // namespace dom
} // namespace mozilla
