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


#include "mozilla/PRemoteCDMChild.h"
#include "mozilla/ProfilerLabels.h"
#include "mozilla/RemoteCDMChild.h"
#include "mozilla/RemoteMediaData.h"
#include "mozilla/dom/MediaIPCUtils.h"

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


MOZ_IMPLICIT PRemoteCDMChild::PRemoteCDMChild() :
    mozilla::ipc::IRefCountedProtocol(kProtocolId, mozilla::ipc::ChildSide)
{
    MOZ_COUNT_CTOR(PRemoteCDMChild);
}

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

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

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

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

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

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

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

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

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

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

auto PRemoteCDMChild::SendInit(
        const RemoteCDMInitRequestIPDL& request,
        mozilla::ipc::ResolveCallback<MediaResult>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_Init(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

            }
            auto& result = *maybe__result;
            // Sentinel = 'result'
            if ((!((aReader)->ReadSentinel(153223840)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'MediaResult'");
                return MsgValueError;
            }


            aReader->EndRead();

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

auto PRemoteCDMChild::SendInit(const RemoteCDMInitRequestIPDL& request) -> RefPtr<InitPromise>
{
    RefPtr<MozPromise<MediaResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<MediaResult, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendInit(std::forward<const RemoteCDMInitRequestIPDL&>(request), [promise__](MediaResult&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PRemoteCDMChild::SendCreateSession(
        const RemoteCDMCreateSessionRequestIPDL& request,
        mozilla::ipc::ResolveCallback<RemoteCDMSessionResponseIPDL>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_CreateSession(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

            }
            auto& result = *maybe__result;
            // Sentinel = 'result'
            if ((!((aReader)->ReadSentinel(153223840)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMSessionResponseIPDL'");
                return MsgValueError;
            }


            aReader->EndRead();

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

auto PRemoteCDMChild::SendCreateSession(const RemoteCDMCreateSessionRequestIPDL& request) -> RefPtr<CreateSessionPromise>
{
    RefPtr<MozPromise<RemoteCDMSessionResponseIPDL, ResponseRejectReason, true>::Private> promise__ = new MozPromise<RemoteCDMSessionResponseIPDL, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendCreateSession(std::forward<const RemoteCDMCreateSessionRequestIPDL&>(request), [promise__](RemoteCDMSessionResponseIPDL&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PRemoteCDMChild::SendLoadSession(
        const RemoteCDMLoadSessionRequestIPDL& request,
        mozilla::ipc::ResolveCallback<MediaResult>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_LoadSession(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

            }
            auto& result = *maybe__result;
            // Sentinel = 'result'
            if ((!((aReader)->ReadSentinel(153223840)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'MediaResult'");
                return MsgValueError;
            }


            aReader->EndRead();

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

auto PRemoteCDMChild::SendLoadSession(const RemoteCDMLoadSessionRequestIPDL& request) -> RefPtr<LoadSessionPromise>
{
    RefPtr<MozPromise<MediaResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<MediaResult, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendLoadSession(std::forward<const RemoteCDMLoadSessionRequestIPDL&>(request), [promise__](MediaResult&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PRemoteCDMChild::SendUpdateSession(
        const RemoteCDMUpdateSessionRequestIPDL& request,
        mozilla::ipc::ResolveCallback<MediaResult>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_UpdateSession(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

            }
            auto& result = *maybe__result;
            // Sentinel = 'result'
            if ((!((aReader)->ReadSentinel(153223840)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'MediaResult'");
                return MsgValueError;
            }


            aReader->EndRead();

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

auto PRemoteCDMChild::SendUpdateSession(const RemoteCDMUpdateSessionRequestIPDL& request) -> RefPtr<UpdateSessionPromise>
{
    RefPtr<MozPromise<MediaResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<MediaResult, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendUpdateSession(std::forward<const RemoteCDMUpdateSessionRequestIPDL&>(request), [promise__](MediaResult&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PRemoteCDMChild::SendRemoveSession(
        const nsAString& sessionId,
        mozilla::ipc::ResolveCallback<MediaResult>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_RemoveSession(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

            }
            auto& result = *maybe__result;
            // Sentinel = 'result'
            if ((!((aReader)->ReadSentinel(153223840)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'MediaResult'");
                return MsgValueError;
            }


            aReader->EndRead();

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

auto PRemoteCDMChild::SendRemoveSession(const nsAString& sessionId) -> RefPtr<RemoveSessionPromise>
{
    RefPtr<MozPromise<MediaResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<MediaResult, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendRemoveSession(std::forward<const nsAString&>(sessionId), [promise__](MediaResult&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PRemoteCDMChild::SendCloseSession(
        const nsAString& sessionId,
        mozilla::ipc::ResolveCallback<MediaResult>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_CloseSession(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

            }
            auto& result = *maybe__result;
            // Sentinel = 'result'
            if ((!((aReader)->ReadSentinel(153223840)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'MediaResult'");
                return MsgValueError;
            }


            aReader->EndRead();

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

auto PRemoteCDMChild::SendCloseSession(const nsAString& sessionId) -> RefPtr<CloseSessionPromise>
{
    RefPtr<MozPromise<MediaResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<MediaResult, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendCloseSession(std::forward<const nsAString&>(sessionId), [promise__](MediaResult&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PRemoteCDMChild::SendSetServerCertificate(
        mozilla::Span<uint8_t const> certificate,
        mozilla::ipc::ResolveCallback<MediaResult>&& aResolve,
        mozilla::ipc::RejectCallback&& aReject) -> void
{
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg_SetServerCertificate(Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            this};

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


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

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

            }
            auto& result = *maybe__result;
            // Sentinel = 'result'
            if ((!((aReader)->ReadSentinel(153223840)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'MediaResult'");
                return MsgValueError;
            }


            aReader->EndRead();

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

auto PRemoteCDMChild::SendSetServerCertificate(mozilla::Span<uint8_t const> certificate) -> RefPtr<SetServerCertificatePromise>
{
    RefPtr<MozPromise<MediaResult, ResponseRejectReason, true>::Private> promise__ = new MozPromise<MediaResult, ResponseRejectReason, true>::Private(__func__);
    promise__->UseDirectTaskDispatch(__func__);
    SendSetServerCertificate(std::forward<mozilla::Span<uint8_t const>>(certificate), [promise__](MediaResult&& aValue) {
        promise__->Resolve(std::move(aValue), __func__);
    }, [promise__](ResponseRejectReason&& aReason) {
        promise__->Reject(std::move(aReason), __func__);
    });
    return promise__;
}

auto PRemoteCDMChild::Send__delete__(PRemoteCDMChild* actor) -> bool
{
    if (!actor || !actor->CanSend()) {
        NS_WARNING("Attempt to __delete__ missing or closed actor");
        return false;
    }
    UniquePtr<IPC::Message> msg__ = PRemoteCDM::Msg___delete__((actor)->Id());
    IPC::MessageWriter writer__{
            (*(msg__)),
            actor};


    if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
        mozilla::ipc::LogMessageForProtocol(
            "PRemoteCDMChild",
            actor->ToplevelProtocol()->OtherPidMaybeInvalid(),
            "Sending ",
            msg__->type(),
            mozilla::ipc::MessageDirection::eSending);
    }
    AUTO_PROFILER_LABEL("PRemoteCDM::Msg___delete__", OTHER);

    bool sendok__ = (actor)->ChannelSend(std::move(msg__));

    actor->ActorDisconnected(Deletion);
    return sendok__;
}

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

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

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


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PRemoteCDM::Reply_CreateSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

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


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PRemoteCDM::Reply_LoadSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

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


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PRemoteCDM::Reply_UpdateSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

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


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PRemoteCDM::Reply_RemoveSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

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


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PRemoteCDM::Reply_CloseSession__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

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


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PRemoteCDM::Reply_SetServerCertificate__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }

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


            return mAsyncCallbacks.GotReply(this, msg__);
        }
    case PRemoteCDM::Reply___delete____ID:
        {
            return MsgProcessed;
        }
    case PRemoteCDM::Msg_Provision__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_Provision", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

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

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

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

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

                });
            };
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMChild*>(this))->RecvProvision(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_OnSessionKeyStatus__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_OnSessionKeyStatus", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& msg = *maybe__msg;
            // Sentinel = 'msg'
            if ((!(((&(reader__)))->ReadSentinel(43450696)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMKeyStatusIPDL'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMChild*>(this))->RecvOnSessionKeyStatus(std::move(msg));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg_OnSessionKeyExpiration__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_OnSessionKeyExpiration", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& msg = *maybe__msg;
            // Sentinel = 'msg'
            if ((!(((&(reader__)))->ReadSentinel(43450696)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMKeyExpirationIPDL'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMChild*>(this))->RecvOnSessionKeyExpiration(std::move(msg));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    case PRemoteCDM::Msg_OnSessionKeyMessage__ID:
        {
            if (mozilla::ipc::LoggingEnabledFor("PRemoteCDM", mozilla::ipc::ChildSide)) {
                mozilla::ipc::LogMessageForProtocol(
                    "PRemoteCDMChild",
                    this->ToplevelProtocol()->OtherPidMaybeInvalid(),
                    "Received ",
                    (&(msg__))->type(),
                    mozilla::ipc::MessageDirection::eReceiving);
            }
            AUTO_PROFILER_LABEL("PRemoteCDM::Msg_OnSessionKeyMessage", OTHER);

            IPC::MessageReader reader__{
                    msg__,
                    this};

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

            }
            auto& msg = *maybe__msg;
            // Sentinel = 'msg'
            if ((!(((&(reader__)))->ReadSentinel(43450696)))) {
                mozilla::ipc::SentinelReadError("Error deserializing 'RemoteCDMKeyMessageIPDL'");
                return MsgValueError;
            }
            reader__.EndRead();
            mozilla::ipc::IPCResult __ok = (static_cast<::mozilla::RemoteCDMChild*>(this))->RecvOnSessionKeyMessage(std::move(msg));
            if ((!(__ok))) {
                mozilla::ipc::ProtocolErrorBreakpoint("Handler returned error code!");
                // Error handled in mozilla::ipc::IPCResult
                return MsgProcessingError;
            }

            return MsgProcessed;
        }
    default:
        return MsgNotKnown;
    }
}

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

    }
    return MsgNotKnown;
}



} // namespace mozilla
