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


#include "mozilla/PRemoteCDMParent.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteCDMParent.h"
#include "mozilla/RemoteMediaData.h"
#include "mozilla/dom/MediaIPCUtils.h"

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


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

MOZ_IMPLICIT PRemoteCDMParent::PRemoteCDMParent() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ParentSide)
{
    MOZ_COUNT_CTOR(PRemoteCDMParent);
}

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

auto PRemoteCDMParent::ActorAlloc() -> void
{
    AddRef();
}

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

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

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

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

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

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

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

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

auto PRemoteCDMParent::SendProvision(
        const RemoteCDMProvisionRequestIPDL& request,
        mozilla::ipc::ResolveCallback<RemoteCDMProvisionResponseIPDL>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_Provision(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

            }
            auto& response = *maybe__response;
            // Sentinel = 'response'
            if ((!((aReader)->ReadSentinel(260965232)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMProvisionResponseIPDL'");
                return MsgValueError;
            }


            aReader->EndRead();

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

auto PRemoteCDMParent::SendProvision(const RemoteCDMProvisionRequestIPDL& request) -> RefPtr<ProvisionPromise>
{
    RefPtr<MozPromise<RemoteCDMProvisionResponseIPDL, ResponseRejectReason, true>::Private> promise__ = new MozPromise<RemoteCDMProvisionResponseIPDL, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendProvision(std::forward<const RemoteCDMProvisionRequestIPDL&>(request), [promise__](RemoteCDMProvisionResponseIPDL&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PRemoteCDMParent::SendOnSessionKeyStatus(const RemoteCDMKeyStatusIPDL& msg) -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_OnSessionKeyStatus(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PRemoteCDMParent::SendOnSessionKeyExpiration(const RemoteCDMKeyExpirationIPDL& msg) -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_OnSessionKeyExpiration(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

auto PRemoteCDMParent::SendOnSessionKeyMessage(const RemoteCDMKeyMessageIPDL& msg) -> bool
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_OnSessionKeyMessage(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

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

auto PRemoteCDMParent::OnMessageReceived(const Message& msg__) -> PRemoteCDMParent::Result
{
    if (!CanSend()) {
        if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
            mozilla::ipc::LogMessageForProtocol(
                "PRemoteCDMParent",
                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 PRemoteCDM::Msg_Init__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_Init", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& request = *maybe__request;
            // Sentinel = 'request'
            if ((!(((&(reader__)))->ReadSentinel(202703626)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMInitRequestIPDL'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PRemoteCDM::Reply_Init(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            InitResolver resolver = [resolver__ = std::move(resolver__)](const MediaResult& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), aParam);
                    // Sentinel = 'result'
                    ((&(writer__)))->WriteSentinel(153223840);

                    if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PRemoteCDMParent",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMParent*>(this))->RecvInit(std::move(request), std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg_CreateSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_CreateSession", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& request = *maybe__request;
            // Sentinel = 'request'
            if ((!(((&(reader__)))->ReadSentinel(202703626)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMCreateSessionRequestIPDL'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PRemoteCDM::Reply_CreateSession(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            CreateSessionResolver resolver = [resolver__ = std::move(resolver__)](const RemoteCDMSessionResponseIPDL& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), aParam);
                    // Sentinel = 'result'
                    ((&(writer__)))->WriteSentinel(153223840);

                    if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PRemoteCDMParent",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMParent*>(this))->RecvCreateSession(std::move(request), std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg_LoadSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_LoadSession", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& request = *maybe__request;
            // Sentinel = 'request'
            if ((!(((&(reader__)))->ReadSentinel(202703626)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMLoadSessionRequestIPDL'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PRemoteCDM::Reply_LoadSession(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            LoadSessionResolver resolver = [resolver__ = std::move(resolver__)](const MediaResult& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), aParam);
                    // Sentinel = 'result'
                    ((&(writer__)))->WriteSentinel(153223840);

                    if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PRemoteCDMParent",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMParent*>(this))->RecvLoadSession(std::move(request), std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg_UpdateSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_UpdateSession", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& request = *maybe__request;
            // Sentinel = 'request'
            if ((!(((&(reader__)))->ReadSentinel(202703626)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMUpdateSessionRequestIPDL'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PRemoteCDM::Reply_UpdateSession(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            UpdateSessionResolver resolver = [resolver__ = std::move(resolver__)](const MediaResult& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), aParam);
                    // Sentinel = 'result'
                    ((&(writer__)))->WriteSentinel(153223840);

                    if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PRemoteCDMParent",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMParent*>(this))->RecvUpdateSession(std::move(request), std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg_RemoveSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_RemoveSession", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& sessionId = *maybe__sessionId;
            // Sentinel = 'sessionId'
            if ((!(((&(reader__)))->ReadSentinel(320603058)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PRemoteCDM::Reply_RemoveSession(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            RemoveSessionResolver resolver = [resolver__ = std::move(resolver__)](const MediaResult& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), aParam);
                    // Sentinel = 'result'
                    ((&(writer__)))->WriteSentinel(153223840);

                    if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PRemoteCDMParent",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMParent*>(this))->RecvRemoveSession(std::move(sessionId), std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg_CloseSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_CloseSession", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& sessionId = *maybe__sessionId;
            // Sentinel = 'sessionId'
            if ((!(((&(reader__)))->ReadSentinel(320603058)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'nsString'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PRemoteCDM::Reply_CloseSession(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            CloseSessionResolver resolver = [resolver__ = std::move(resolver__)](const MediaResult& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), aParam);
                    // Sentinel = 'result'
                    ((&(writer__)))->WriteSentinel(153223840);

                    if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PRemoteCDMParent",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMParent*>(this))->RecvCloseSession(std::move(sessionId), std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg_SetServerCertificate__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_SetServerCertificate", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& certificate = *maybe__certificate;
            // Sentinel = 'certificate'
            if ((!(((&(reader__)))->ReadSentinel(455869572)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'uint8_t[]'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::ActorId id__ = Id();
            UniquePtr<IPC::Message> reply__(PRemoteCDM::Reply_SetServerCertificate(id__));
            reply__->set_seqno(msg__.seqno());

            RefPtr<mozilla::ipc::IPDLResolverInner> resolver__ =
                new mozilla::ipc::IPDLResolverInner(std::move(reply__), this);

            SetServerCertificateResolver resolver = [resolver__ = std::move(resolver__)](const MediaResult& aParam) {
                resolver__->Resolve([&] (IPC::Message* reply__, IProtocol* self__) {
                    IPC::MessageWriter writer__(*reply__, self__);
                    IPC::WriteParam((&(writer__)), aParam);
                    // Sentinel = 'result'
                    ((&(writer__)))->WriteSentinel(153223840);

                    if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                        mozilla::ipc::LogMessageForProtocol(
                            "PRemoteCDMParent",
                            self__->ToplevelProtocol()->OtherPidMaybeInvalid(),
                            "Sending reply ",
                            reply__->type(),
                            mozilla::ipc::MessageDirection::eSending);
                    }

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMParent*>(this))->RecvSetServerCertificate(std::move(certificate), std::move(resolver));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg___delete____ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg___delete__", OTHER);

            DoomSubtree();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMParent*>(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 PRemoteCDM::Reply_Provision__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ParentSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMParent",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_Provision", OTHER);


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    default:
        return MsgNotKnown;
    }
}

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

    }
    return MsgNotKnown;
}



} // namespace mozilla
