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


#include "mozilla/dom/MediaIPCUtils.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/layers/PTextureParent.h"
#include "mozilla/layers/PTextureChild.h"
#include "mozilla/PRemoteCDMParent.h"
#include "mozilla/PRemoteCDMChild.h"
#include "mozilla/PRemoteDecoderParent.h"
#include "mozilla/PRemoteDecoderChild.h"
#include "mozilla/PRemoteEncoderParent.h"
#include "mozilla/PRemoteEncoderChild.h"
#include "gfxipc/ShadowLayerUtils.h"
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/layers/LayersMessageUtils.h"
#include "mozilla/layers/WebRenderMessageUtils.h"
#include "mozilla/dom/MediaIPCUtils.h"
#include "mozilla/PRemoteMediaManager.h"
#include "mozilla/PRemoteMediaManagerParent.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 {
namespace PRemoteMediaManager {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::PRemoteMediaManagerParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::PRemoteMediaManagerChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_PRemoteDecoderConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_PRemoteDecoderConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_PRemoteDecoderConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_PRemoteDecoderConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_PRemoteEncoderConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_PRemoteEncoderConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_PRemoteEncoderConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_PRemoteEncoderConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_PRemoteCDMConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_PRemoteCDMConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_PRemoteCDMConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_PRemoteCDMConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_Readback(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Readback__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::SYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_Readback(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Readback__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::SYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_DeallocateSurfaceDescriptorGPUVideo(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_DeallocateSurfaceDescriptorGPUVideo__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_OnSetCurrent(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_OnSetCurrent__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}

} // namespace PRemoteMediaManager
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct VideoDecoderInfoIPDL|
//
namespace mozilla {
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::VideoDecoderInfoIPDL>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).videoInfo());
    // Sentinel = 'videoInfo'
    (aWriter)->WriteSentinel(308609956);
    (aWriter)->WriteBytes((&((aVar).framerate())), 4);
    // Sentinel = 'framerate'
    (aWriter)->WriteSentinel(311755704);
}

auto ParamTraits<::mozilla::VideoDecoderInfoIPDL>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___videoInfo = IPC::ReadParam<::mozilla::VideoInfo>(aReader);
    if (!maybe___videoInfo) {
        aReader->FatalError("Error deserializing 'videoInfo' (VideoInfo) member of 'VideoDecoderInfoIPDL'");
        return {};

    }
    auto& _videoInfo = *maybe___videoInfo;
    // Sentinel = 'videoInfo'
    if ((!((aReader)->ReadSentinel(308609956)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'videoInfo' (VideoInfo) member of 'VideoDecoderInfoIPDL'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_videoInfo),
            float{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->framerate())), 4)))) {
        aReader->FatalError("Error bulk reading fields from float");
        return {};
    }
    // Sentinel = 'framerate'
    if ((!((aReader)->ReadSentinel(311755704)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from float");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union RemoteDecoderInfoIPDL|
//
namespace mozilla {
auto RemoteDecoderInfoIPDL::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TAudioInfo:
        {
            (ptr_AudioInfo())->~AudioInfo__tdef();
            break;
        }
    case TVideoDecoderInfoIPDL:
        {
            (ptr_VideoDecoderInfoIPDL())->~VideoDecoderInfoIPDL__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT RemoteDecoderInfoIPDL::RemoteDecoderInfoIPDL(const AudioInfo& aOther)
{
    new (mozilla::KnownNotNull, ptr_AudioInfo()) AudioInfo(aOther);
    mType = TAudioInfo;
}

MOZ_IMPLICIT RemoteDecoderInfoIPDL::RemoteDecoderInfoIPDL(AudioInfo&& aOther)
{
    new (mozilla::KnownNotNull, ptr_AudioInfo()) AudioInfo(std::move(aOther));
    mType = TAudioInfo;
}

MOZ_IMPLICIT RemoteDecoderInfoIPDL::RemoteDecoderInfoIPDL(const VideoDecoderInfoIPDL& aOther)
{
    new (mozilla::KnownNotNull, ptr_VideoDecoderInfoIPDL()) VideoDecoderInfoIPDL(aOther);
    mType = TVideoDecoderInfoIPDL;
}

MOZ_IMPLICIT RemoteDecoderInfoIPDL::RemoteDecoderInfoIPDL(VideoDecoderInfoIPDL&& aOther)
{
    new (mozilla::KnownNotNull, ptr_VideoDecoderInfoIPDL()) VideoDecoderInfoIPDL(std::move(aOther));
    mType = TVideoDecoderInfoIPDL;
}

MOZ_IMPLICIT RemoteDecoderInfoIPDL::RemoteDecoderInfoIPDL(const RemoteDecoderInfoIPDL& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TAudioInfo:
        {
            new (mozilla::KnownNotNull, ptr_AudioInfo()) AudioInfo((aOther).get_AudioInfo());
            break;
        }
    case TVideoDecoderInfoIPDL:
        {
            new (mozilla::KnownNotNull, ptr_VideoDecoderInfoIPDL()) VideoDecoderInfoIPDL((aOther).get_VideoDecoderInfoIPDL());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT RemoteDecoderInfoIPDL::RemoteDecoderInfoIPDL(RemoteDecoderInfoIPDL&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TAudioInfo:
        {
            new (mozilla::KnownNotNull, ptr_AudioInfo()) AudioInfo(std::move((aOther).get_AudioInfo()));
            (aOther).MaybeDestroy();
            break;
        }
    case TVideoDecoderInfoIPDL:
        {
            new (mozilla::KnownNotNull, ptr_VideoDecoderInfoIPDL()) VideoDecoderInfoIPDL(std::move((aOther).get_VideoDecoderInfoIPDL()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

RemoteDecoderInfoIPDL::~RemoteDecoderInfoIPDL()
{
    MaybeDestroy();
}

auto RemoteDecoderInfoIPDL::operator=(const AudioInfo& aRhs) -> RemoteDecoderInfoIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_AudioInfo()) AudioInfo(aRhs);
    mType = TAudioInfo;
    return (*(this));
}

auto RemoteDecoderInfoIPDL::operator=(AudioInfo&& aRhs) -> RemoteDecoderInfoIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_AudioInfo()) AudioInfo(std::move(aRhs));
    mType = TAudioInfo;
    return (*(this));
}

auto RemoteDecoderInfoIPDL::operator=(const VideoDecoderInfoIPDL& aRhs) -> RemoteDecoderInfoIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_VideoDecoderInfoIPDL()) VideoDecoderInfoIPDL(aRhs);
    mType = TVideoDecoderInfoIPDL;
    return (*(this));
}

auto RemoteDecoderInfoIPDL::operator=(VideoDecoderInfoIPDL&& aRhs) -> RemoteDecoderInfoIPDL&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_VideoDecoderInfoIPDL()) VideoDecoderInfoIPDL(std::move(aRhs));
    mType = TVideoDecoderInfoIPDL;
    return (*(this));
}

auto RemoteDecoderInfoIPDL::operator=(const RemoteDecoderInfoIPDL& aRhs) -> RemoteDecoderInfoIPDL&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TAudioInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_AudioInfo()) AudioInfo((aRhs).get_AudioInfo());
            break;
        }
    case TVideoDecoderInfoIPDL:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_VideoDecoderInfoIPDL()) VideoDecoderInfoIPDL((aRhs).get_VideoDecoderInfoIPDL());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto RemoteDecoderInfoIPDL::operator=(RemoteDecoderInfoIPDL&& aRhs) -> RemoteDecoderInfoIPDL&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TAudioInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_AudioInfo()) AudioInfo(std::move((aRhs).get_AudioInfo()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TVideoDecoderInfoIPDL:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_VideoDecoderInfoIPDL()) VideoDecoderInfoIPDL(std::move((aRhs).get_VideoDecoderInfoIPDL()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::RemoteDecoderInfoIPDL>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::RemoteDecoderInfoIPDL union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'RemoteDecoderInfoIPDL'
    (aWriter)->WriteSentinel(1499072472);

    switch (type) {
    case union__::TAudioInfo:
        {
            IPC::WriteParam(aWriter, (aVar).get_AudioInfo());
            // Sentinel = 'TAudioInfo'
            (aWriter)->WriteSentinel(340329427);
            return;
        }
    case union__::TVideoDecoderInfoIPDL:
        {
            IPC::WriteParam(aWriter, (aVar).get_VideoDecoderInfoIPDL());
            // Sentinel = 'TVideoDecoderInfoIPDL'
            (aWriter)->WriteSentinel(1457981367);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union RemoteDecoderInfoIPDL");
            return;
        }
    }
}

auto ParamTraits<::mozilla::RemoteDecoderInfoIPDL>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    typedef ::mozilla::RemoteDecoderInfoIPDL union__;
    auto maybe__type = IPC::ReadParam<int>(aReader);
    if (!maybe__type) {
        aReader->FatalError("Error deserializing type of union RemoteDecoderInfoIPDL");
        return {};

    }
    auto& type = *maybe__type;
    // Sentinel = 'RemoteDecoderInfoIPDL'
    if ((!((aReader)->ReadSentinel(1499072472)))) {
        mozilla::ipc::SentinelReadError("Error deserializing type of union RemoteDecoderInfoIPDL");
        return {};
    }

    switch (type) {
    case union__::TAudioInfo:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::AudioInfo>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TAudioInfo of union RemoteDecoderInfoIPDL");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TAudioInfo'
            if ((!((aReader)->ReadSentinel(340329427)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TAudioInfo of union RemoteDecoderInfoIPDL");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TVideoDecoderInfoIPDL:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::VideoDecoderInfoIPDL>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TVideoDecoderInfoIPDL of union RemoteDecoderInfoIPDL");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TVideoDecoderInfoIPDL'
            if ((!((aReader)->ReadSentinel(1457981367)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TVideoDecoderInfoIPDL of union RemoteDecoderInfoIPDL");
                return {};
            }
            return std::move(tmp);
        }
    default:
        {
            aReader->FatalError("unknown variant of union RemoteDecoderInfoIPDL");
            return {};
        }
    }
}

} // namespace IPC
