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

#ifndef PChromiumCDMChild_h
#define PChromiumCDMChild_h

#include "mozilla/gmp/PChromiumCDM.h"
#ifdef DEBUG
#include "prenv.h"
#endif  // DEBUG

#include "mozilla/Tainting.h"
#include "mozilla/ipc/MessageChannel.h"
#include "mozilla/ipc/ProtocolUtils.h"
// Headers for things that cannot be forward declared
#include "GMPSanitizedExports.h"
#include "gmp-video-codec.h"

namespace mozilla {
namespace gmp {
class PGMPContentChild;
} // namespace gmp
} // namespace mozilla
namespace mozilla {
namespace gmp {
class PGMPContentParent;
} // namespace gmp
} // namespace mozilla

namespace mozilla {
namespace gmp {
class PGMPContentChild;
} // namespace gmp
} // namespace mozilla

namespace mozilla {
namespace gmp {


class PChromiumCDMChild :
    public mozilla::ipc::IRefCountedProtocol
{
private:
    friend class ::mozilla::gmp::PGMPContentChild;
public:
    static constexpr ::mozilla::ipc::ProtocolId kProtocolId = PChromiumCDMMsgStart;
protected:
    typedef mozilla::ipc::ActorId ActorId;
    typedef ::mozilla::ipc::ByteBuf ByteBuf;
    typedef ::mozilla::gmp::CDMInputBuffer CDMInputBuffer;
    typedef ::mozilla::gmp::CDMKeyInformation CDMKeyInformation;
    typedef ::mozilla::gmp::CDMVideoDecoderConfig CDMVideoDecoderConfig;
    typedef ::mozilla::gmp::CDMVideoFrame CDMVideoFrame;
    typedef ::mozilla::gmp::CDMVideoPlane CDMVideoPlane;
    typedef ::cdm::EncryptionScheme EncryptionScheme;
    template<class FooSide> using Endpoint = mozilla::ipc::Endpoint<FooSide>;
    typedef ::mozilla::ipc::FileDescriptor FileDescriptor;
    typedef ::GMPBufferType GMPBufferType;
    typedef ::mozilla::gmp::GMPPlaneData GMPPlaneData;
    typedef ::mozilla::gmp::GMPVideoEncodedFrameData GMPVideoEncodedFrameData;
    typedef ::mozilla::gmp::GMPVideoi420FrameData GMPVideoi420FrameData;
    typedef ::cdm::HdcpVersion HdcpVersion;
    template<class FooSide> using ManagedEndpoint = mozilla::ipc::ManagedEndpoint<FooSide>;
    typedef ::mozilla::gmp::NodeIdParts NodeIdParts;
    typedef ::mozilla::gmp::NodeIdVariant NodeIdVariant;
    typedef ::mozilla::gmp::PGMPContentChild PGMPContentChild;
    typedef ::mozilla::gmp::PGMPContentParent PGMPContentParent;
    typedef base::ProcessId ProcessId;
    typedef mozilla::ipc::ProtocolId ProtocolId;
    typedef mozilla::ipc::ResponseRejectReason ResponseRejectReason;
    typedef ::mozilla::ipc::Shmem Shmem;
    template<class T> using UniquePtr = mozilla::UniquePtr<T>;
    typedef ::int16_t int16_t;
    typedef ::int32_t int32_t;
    typedef ::int64_t int64_t;
    typedef ::int8_t int8_t;
    typedef ::intptr_t intptr_t;
    typedef ::nsCString nsCString;
    typedef ::nsString nsString;
    typedef ::nsresult nsresult;
    typedef ::uint16_t uint16_t;
    typedef ::uint32_t uint32_t;
    typedef ::uint64_t uint64_t;
    typedef ::uint8_t uint8_t;
    typedef ::uintptr_t uintptr_t;

public:
    typedef std::function<void(const bool&)> InitResolver;

protected:
    virtual mozilla::ipc::IPCResult
    RecvInit(
            const bool& aAllowDistinctiveIdentifier,
            const bool& aAllowPersistentState,
            InitResolver&& aResolve) = 0;
    virtual mozilla::ipc::IPCResult
    RecvGetStatusForPolicy(
            const uint32_t& aPromiseId,
            const HdcpVersion& aMinHdcpVersion) = 0;
    virtual mozilla::ipc::IPCResult
    RecvSetServerCertificate(
            const uint32_t& aPromiseId,
            nsTArray<uint8_t>&& aServerCert) = 0;
    virtual mozilla::ipc::IPCResult
    RecvCreateSessionAndGenerateRequest(
            const uint32_t& aPromiseId,
            const uint32_t& aSessionType,
            const uint32_t& aInitDataType,
            nsTArray<uint8_t>&& aInitData) = 0;
    virtual mozilla::ipc::IPCResult
    RecvLoadSession(
            const uint32_t& aPromiseId,
            const uint32_t& aSessionType,
            const nsACString& aSessionId) = 0;
    virtual mozilla::ipc::IPCResult
    RecvUpdateSession(
            const uint32_t& aPromiseId,
            const nsACString& aSessionId,
            nsTArray<uint8_t>&& aResponse) = 0;
    virtual mozilla::ipc::IPCResult
    RecvCloseSession(
            const uint32_t& aPromiseId,
            const nsACString& aSessionId) = 0;
    virtual mozilla::ipc::IPCResult
    RecvRemoveSession(
            const uint32_t& aPromiseId,
            const nsACString& aSessionId) = 0;
    virtual mozilla::ipc::IPCResult
    RecvCompleteQueryOutputProtectionStatus(
            const bool& aSuccess,
            const uint32_t& aLinkMask,
            const uint32_t& aProtectionMask) = 0;
    virtual mozilla::ipc::IPCResult
    RecvDecrypt(
            const uint32_t& aId,
            const CDMInputBuffer& aBuffer) = 0;
    virtual mozilla::ipc::IPCResult
    RecvInitializeVideoDecoder(const CDMVideoDecoderConfig& aConfig) = 0;
    virtual mozilla::ipc::IPCResult
    RecvDeinitializeVideoDecoder() = 0;
    virtual mozilla::ipc::IPCResult
    RecvResetVideoDecoder() = 0;
    virtual mozilla::ipc::IPCResult
    RecvDecryptAndDecodeFrame(const CDMInputBuffer& aBuffer) = 0;
    virtual mozilla::ipc::IPCResult
    RecvDrain() = 0;
    virtual mozilla::ipc::IPCResult
    RecvDestroy() = 0;
    virtual mozilla::ipc::IPCResult
    RecvGiveBuffer(Shmem&& aShmem) = 0;
    virtual mozilla::ipc::IPCResult
    RecvPurgeShmems() = 0;
public:
    typedef mozilla::ipc::IProtocol IProtocol;
    typedef IPC::Message Message;
    typedef base::ProcessHandle ProcessHandle;
    typedef mozilla::ipc::MessageChannel MessageChannel;

public:
    MOZ_IMPLICIT PChromiumCDMChild();

    virtual ~PChromiumCDMChild();

protected:
    void
    ActorAlloc() final;
    void
    ActorDealloc() final;
public:
    ::base::ProcessId
    OtherPid() const;
    ::GeckoChildID
    OtherChildID() const;
    ::mozilla::ipc::EndpointProcInfo
    OtherEndpointProcInfo() const;

    PGMPContentChild*
    Manager() const;

    mozilla::Span<mozilla::ipc::ProtocolId const>
    ManagedProtocolIds() const final;

    UntypedManagedContainer*
    GetManagedActors(mozilla::ipc::ProtocolId aProtocol) final;

    void
    RejectPendingResponses(ResponseRejectReason aReason) final;

    static bool
    Send__delete__(PChromiumCDMChild* actor);

    bool
    SendOnResolvePromiseWithKeyStatus(
            const uint32_t& aPromiseId,
            const uint32_t& aKeyStatus);

    bool
    SendOnResolveNewSessionPromise(
            const uint32_t& aPromiseId,
            const nsACString& aSessionId);

    bool
    SendOnResolvePromise(const uint32_t& aPromiseId);

    bool
    SendOnRejectPromise(
            const uint32_t& aPromiseId,
            const uint32_t& aException,
            const uint32_t& aSystemCode,
            const nsACString& aErrorMessage);

    bool
    SendOnSessionMessage(
            const nsACString& aSessionId,
            const uint32_t& aMessageType,
            mozilla::Span<uint8_t const> aMessage);

    bool
    SendOnSessionKeysChange(
            const nsACString& aSessionId,
            mozilla::Span<CDMKeyInformation const> aKeysInfo);

    bool
    SendOnExpirationChange(
            const nsACString& aSessionId,
            const double& aSecondsSinceEpoch);

    bool
    SendOnSessionClosed(const nsACString& aSessionId);

    bool
    SendOnQueryOutputProtectionStatus();

    bool
    SendResolveLoadSessionPromise(
            const uint32_t& aPromiseId,
            const bool& aSuccessful);

    bool
    SendDecryptedShmem(
            const uint32_t& aId,
            const uint32_t& aStatus,
            Shmem&& aData);

    bool
    SendDecryptedData(
            const uint32_t& aId,
            const uint32_t& aStatus,
            mozilla::Span<uint8_t const> aData);

    bool
    SendDecryptFailed(
            const uint32_t& aId,
            const uint32_t& aStatus);

    bool
    SendOnDecoderInitDone(const uint32_t& aStatus);

    bool
    SendDecodedShmem(
            const CDMVideoFrame& aFrame,
            Shmem&& aData);

    bool
    SendDecodedData(
            const CDMVideoFrame& aFrame,
            mozilla::Span<uint8_t const> aData);

    bool
    SendDecodeFailed(const uint32_t& aStatus);

    bool
    SendResetVideoDecoderComplete();

    bool
    SendDrainComplete();

    bool
    SendShutdown();

    bool
    SendIncreaseShmemPoolSize();

    void
    DeallocManagee(
            mozilla::ipc::ProtocolId aProtocolId,
            IProtocol* aListener) override;

    Result
    OnMessageReceived(const Message& msg__) override;

    Result
    OnMessageReceived(
            const Message& msg__,
            UniquePtr<Message>& reply__) override;

private:
    mozilla::ipc::IPDLAsyncReturnsCallbacks mAsyncCallbacks;

    bool mAwaitingManagedEndpointBind = false;

};


} // namespace gmp
} // namespace mozilla
namespace IPC {
template<>
struct ParamTraits <::mozilla::gmp::PChromiumCDMChild*>
{
    typedef ::mozilla::gmp::PChromiumCDMChild* paramType;
    static void
    Write(
            IPC::MessageWriter* aWriter,
            const paramType& aVar);
    static IPC::ReadResult<paramType>
    Read(IPC::MessageReader* aReader);
};
} // namespace IPC

#endif // ifndef PChromiumCDMChild_h
