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


#include "mozilla/dom/PRemoteWorkerDebuggerManagerChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/dom/ClientIPCUtils.h"
#include "mozilla/dom/ReferrerInfoUtils.h"
#include "mozilla/dom/RemoteWorkerDebuggerManagerChild.h"
#include "mozilla/dom/WorkerIPCUtils.h"
#include "mozilla/ipc/IPCCore.h"
#include "nsIPrincipal.h"

#include "mozilla/dom/PRemoteWorkerDebuggerChild.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 PRemoteWorkerDebuggerManagerChild::ProcessingError(
        Result aCode,
        const char* aReason) -> void
{
}

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

MOZ_IMPLICIT PRemoteWorkerDebuggerManagerChild::PRemoteWorkerDebuggerManagerChild() :
    mozilla::ipc::IToplevelProtocol("PRemoteWorkerDebuggerManagerChild", kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PRemoteWorkerDebuggerManagerChild);
}

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

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

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

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

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

auto PRemoteWorkerDebuggerManagerChild::SendRegister(
        const RemoteWorkerDebuggerInfo& aDebuggerInfo,
        Endpoint<::mozilla::dom::PRemoteWorkerDebuggerParent>&& aParentEp) -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteWorkerDebuggerManager::Msg_Register(MSG_ROUTING_CONTROL);
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

    IPC::WriteParam((&(writer__)), aDebuggerInfo);
    // Sentinel = 'aDebuggerInfo'
    ((&(writer__)))->WriteSentinel(582747411);
    IPC::WriteParam((&(writer__)), std::move(aParentEp));
    // Sentinel = 'aParentEp'
    ((&(writer__)))->WriteSentinel(290194305);


    if (mozilla::ipc::LoggingEnabledFor("PRemoteWorkerDebuggerManager", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PRemoteWorkerDebuggerManagerChild",
            this->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PRemoteWorkerDebuggerManager::Msg_Register", OTHER);

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

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

auto PRemoteWorkerDebuggerManagerChild::OnMessageReceived(const Message& msg__) -> PRemoteWorkerDebuggerManagerChild::Result
{
    switch (msg__.type()) {
    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 PRemoteWorkerDebuggerManagerChild::OnMessageReceived(
        const Message& msg__,
        UniquePtr<Message>& reply__) -> PRemoteWorkerDebuggerManagerChild::Result
{
    MOZ_ASSERT_UNREACHABLE("message protocol not supported");
    return MsgNotKnown;
}



} // namespace dom
} // namespace mozilla
namespace IPC {
auto ParamTraits<::mozilla::dom::PRemoteWorkerDebuggerManagerChild*>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, static_cast<mozilla::ipc::IProtocol*>(aVar));
    // Sentinel = 'PRemoteWorkerDebuggerManager'
    (aWriter)->WriteSentinel(2676951831);
}

auto ParamTraits<::mozilla::dom::PRemoteWorkerDebuggerManagerChild*>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe__actor = IPC::ReadParam<mozilla::ipc::IProtocol*>(aReader);
    if (!maybe__actor) {
        aReader->FatalError("Error deserializing managed PRemoteWorkerDebuggerManager actor");
        return {};

    }
    auto& actor = *maybe__actor;
    // Sentinel = 'PRemoteWorkerDebuggerManager'
    if ((!((aReader)->ReadSentinel(2676951831)))) {
        mozilla::ipc::SentinelReadError("Error deserializing managed PRemoteWorkerDebuggerManager actor");
        return {};
    }

    if (actor && actor->GetProtocolId() != PRemoteWorkerDebuggerManagerMsgStart) {
        aReader->FatalError("Unexpected actor type (expected PRemoteWorkerDebuggerManager)");

        return {};
    }
    return static_cast<::mozilla::dom::PRemoteWorkerDebuggerManagerChild*>(actor);
}

} // namespace IPC
