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


#include "mozilla/GfxMessageUtils.h"
#include "mozilla/layers/PNativeLayerRemote.h"
#include "mozilla/layers/PNativeLayerRemoteParent.h"
#include "mozilla/layers/PNativeLayerRemoteChild.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 layers {
namespace PNativeLayerRemote {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::layers::PNativeLayerRemoteParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::layers::PNativeLayerRemoteChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_CommitNativeLayerCommands(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_CommitNativeLayerCommands__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_RequestReadback(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_RequestReadback__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_RequestReadback(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_RequestReadback__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_Flush(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Flush__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_Flush(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Flush__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));
}

} // namespace PNativeLayerRemote
} // namespace layers
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union NativeLayerCommand|
//
namespace mozilla {
namespace layers {
auto NativeLayerCommand::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TCommandCreateLayer:
        {
            (ptr_CommandCreateLayer())->~CommandCreateLayer__tdef();
            break;
        }
    case TCommandCreateLayerForExternalTexture:
        {
            (ptr_CommandCreateLayerForExternalTexture())->~CommandCreateLayerForExternalTexture__tdef();
            break;
        }
    case TCommandCreateLayerForColor:
        {
            (ptr_CommandCreateLayerForColor())->~CommandCreateLayerForColor__tdef();
            break;
        }
    case TCommandLayerDestroyed:
        {
            (ptr_CommandLayerDestroyed())->~CommandLayerDestroyed__tdef();
            break;
        }
    case TCommandSetLayers:
        {
            (ptr_CommandSetLayers())->~CommandSetLayers__tdef();
            break;
        }
    case TCommandLayerInfo:
        {
            (ptr_CommandLayerInfo())->~CommandLayerInfo__tdef();
            break;
        }
    case TCommandChangedSurface:
        {
            (ptr_CommandChangedSurface())->~CommandChangedSurface__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(const CommandCreateLayer& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandCreateLayer()) CommandCreateLayer(aOther);
    mType = TCommandCreateLayer;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(CommandCreateLayer&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandCreateLayer()) CommandCreateLayer(std::move(aOther));
    mType = TCommandCreateLayer;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(const CommandCreateLayerForExternalTexture& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandCreateLayerForExternalTexture()) CommandCreateLayerForExternalTexture(aOther);
    mType = TCommandCreateLayerForExternalTexture;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(CommandCreateLayerForExternalTexture&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandCreateLayerForExternalTexture()) CommandCreateLayerForExternalTexture(std::move(aOther));
    mType = TCommandCreateLayerForExternalTexture;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(const CommandCreateLayerForColor& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandCreateLayerForColor()) CommandCreateLayerForColor(aOther);
    mType = TCommandCreateLayerForColor;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(CommandCreateLayerForColor&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandCreateLayerForColor()) CommandCreateLayerForColor(std::move(aOther));
    mType = TCommandCreateLayerForColor;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(const CommandLayerDestroyed& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandLayerDestroyed()) CommandLayerDestroyed(aOther);
    mType = TCommandLayerDestroyed;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(CommandLayerDestroyed&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandLayerDestroyed()) CommandLayerDestroyed(std::move(aOther));
    mType = TCommandLayerDestroyed;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(const CommandSetLayers& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandSetLayers()) CommandSetLayers(aOther);
    mType = TCommandSetLayers;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(CommandSetLayers&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandSetLayers()) CommandSetLayers(std::move(aOther));
    mType = TCommandSetLayers;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(const CommandLayerInfo& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandLayerInfo()) CommandLayerInfo(aOther);
    mType = TCommandLayerInfo;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(CommandLayerInfo&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandLayerInfo()) CommandLayerInfo(std::move(aOther));
    mType = TCommandLayerInfo;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(CommandChangedSurface&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CommandChangedSurface()) CommandChangedSurface(std::move(aOther));
    mType = TCommandChangedSurface;
}

MOZ_IMPLICIT NativeLayerCommand::NativeLayerCommand(NativeLayerCommand&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TCommandCreateLayer:
        {
            new (mozilla::KnownNotNull, ptr_CommandCreateLayer()) CommandCreateLayer(std::move((aOther).get_CommandCreateLayer()));
            (aOther).MaybeDestroy();
            break;
        }
    case TCommandCreateLayerForExternalTexture:
        {
            new (mozilla::KnownNotNull, ptr_CommandCreateLayerForExternalTexture()) CommandCreateLayerForExternalTexture(std::move((aOther).get_CommandCreateLayerForExternalTexture()));
            (aOther).MaybeDestroy();
            break;
        }
    case TCommandCreateLayerForColor:
        {
            new (mozilla::KnownNotNull, ptr_CommandCreateLayerForColor()) CommandCreateLayerForColor(std::move((aOther).get_CommandCreateLayerForColor()));
            (aOther).MaybeDestroy();
            break;
        }
    case TCommandLayerDestroyed:
        {
            new (mozilla::KnownNotNull, ptr_CommandLayerDestroyed()) CommandLayerDestroyed(std::move((aOther).get_CommandLayerDestroyed()));
            (aOther).MaybeDestroy();
            break;
        }
    case TCommandSetLayers:
        {
            new (mozilla::KnownNotNull, ptr_CommandSetLayers()) CommandSetLayers(std::move((aOther).get_CommandSetLayers()));
            (aOther).MaybeDestroy();
            break;
        }
    case TCommandLayerInfo:
        {
            new (mozilla::KnownNotNull, ptr_CommandLayerInfo()) CommandLayerInfo(std::move((aOther).get_CommandLayerInfo()));
            (aOther).MaybeDestroy();
            break;
        }
    case TCommandChangedSurface:
        {
            new (mozilla::KnownNotNull, ptr_CommandChangedSurface()) CommandChangedSurface(std::move((aOther).get_CommandChangedSurface()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto NativeLayerCommand::operator=(const CommandCreateLayer& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandCreateLayer()) CommandCreateLayer(aRhs);
    mType = TCommandCreateLayer;
    return (*(this));
}

auto NativeLayerCommand::operator=(CommandCreateLayer&& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandCreateLayer()) CommandCreateLayer(std::move(aRhs));
    mType = TCommandCreateLayer;
    return (*(this));
}

auto NativeLayerCommand::operator=(const CommandCreateLayerForExternalTexture& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandCreateLayerForExternalTexture()) CommandCreateLayerForExternalTexture(aRhs);
    mType = TCommandCreateLayerForExternalTexture;
    return (*(this));
}

auto NativeLayerCommand::operator=(CommandCreateLayerForExternalTexture&& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandCreateLayerForExternalTexture()) CommandCreateLayerForExternalTexture(std::move(aRhs));
    mType = TCommandCreateLayerForExternalTexture;
    return (*(this));
}

auto NativeLayerCommand::operator=(const CommandCreateLayerForColor& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandCreateLayerForColor()) CommandCreateLayerForColor(aRhs);
    mType = TCommandCreateLayerForColor;
    return (*(this));
}

auto NativeLayerCommand::operator=(CommandCreateLayerForColor&& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandCreateLayerForColor()) CommandCreateLayerForColor(std::move(aRhs));
    mType = TCommandCreateLayerForColor;
    return (*(this));
}

auto NativeLayerCommand::operator=(const CommandLayerDestroyed& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandLayerDestroyed()) CommandLayerDestroyed(aRhs);
    mType = TCommandLayerDestroyed;
    return (*(this));
}

auto NativeLayerCommand::operator=(CommandLayerDestroyed&& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandLayerDestroyed()) CommandLayerDestroyed(std::move(aRhs));
    mType = TCommandLayerDestroyed;
    return (*(this));
}

auto NativeLayerCommand::operator=(const CommandSetLayers& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandSetLayers()) CommandSetLayers(aRhs);
    mType = TCommandSetLayers;
    return (*(this));
}

auto NativeLayerCommand::operator=(CommandSetLayers&& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandSetLayers()) CommandSetLayers(std::move(aRhs));
    mType = TCommandSetLayers;
    return (*(this));
}

auto NativeLayerCommand::operator=(const CommandLayerInfo& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandLayerInfo()) CommandLayerInfo(aRhs);
    mType = TCommandLayerInfo;
    return (*(this));
}

auto NativeLayerCommand::operator=(CommandLayerInfo&& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandLayerInfo()) CommandLayerInfo(std::move(aRhs));
    mType = TCommandLayerInfo;
    return (*(this));
}

auto NativeLayerCommand::operator=(CommandChangedSurface&& aRhs) -> NativeLayerCommand&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CommandChangedSurface()) CommandChangedSurface(std::move(aRhs));
    mType = TCommandChangedSurface;
    return (*(this));
}

auto NativeLayerCommand::operator=(NativeLayerCommand&& aRhs) -> NativeLayerCommand&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TCommandCreateLayer:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CommandCreateLayer()) CommandCreateLayer(std::move((aRhs).get_CommandCreateLayer()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TCommandCreateLayerForExternalTexture:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CommandCreateLayerForExternalTexture()) CommandCreateLayerForExternalTexture(std::move((aRhs).get_CommandCreateLayerForExternalTexture()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TCommandCreateLayerForColor:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CommandCreateLayerForColor()) CommandCreateLayerForColor(std::move((aRhs).get_CommandCreateLayerForColor()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TCommandLayerDestroyed:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CommandLayerDestroyed()) CommandLayerDestroyed(std::move((aRhs).get_CommandLayerDestroyed()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TCommandSetLayers:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CommandSetLayers()) CommandSetLayers(std::move((aRhs).get_CommandSetLayers()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TCommandLayerInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CommandLayerInfo()) CommandLayerInfo(std::move((aRhs).get_CommandLayerInfo()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TCommandChangedSurface:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CommandChangedSurface()) CommandChangedSurface(std::move((aRhs).get_CommandChangedSurface()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace layers
} // namespace mozilla

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

    switch (type) {
    case union__::TCommandCreateLayer:
        {
            IPC::WriteParam(aWriter, (aVar).get_CommandCreateLayer());
            // Sentinel = 'TCommandCreateLayer'
            (aWriter)->WriteSentinel(1212548965);
            return;
        }
    case union__::TCommandCreateLayerForExternalTexture:
        {
            IPC::WriteParam(aWriter, (aVar).get_CommandCreateLayerForExternalTexture());
            // Sentinel = 'TCommandCreateLayerForExternalTexture'
            (aWriter)->WriteSentinel(294260416);
            return;
        }
    case union__::TCommandCreateLayerForColor:
        {
            IPC::WriteParam(aWriter, (aVar).get_CommandCreateLayerForColor());
            // Sentinel = 'TCommandCreateLayerForColor'
            (aWriter)->WriteSentinel(2431781515);
            return;
        }
    case union__::TCommandLayerDestroyed:
        {
            IPC::WriteParam(aWriter, (aVar).get_CommandLayerDestroyed());
            // Sentinel = 'TCommandLayerDestroyed'
            (aWriter)->WriteSentinel(1642793156);
            return;
        }
    case union__::TCommandSetLayers:
        {
            IPC::WriteParam(aWriter, (aVar).get_CommandSetLayers());
            // Sentinel = 'TCommandSetLayers'
            (aWriter)->WriteSentinel(978912944);
            return;
        }
    case union__::TCommandLayerInfo:
        {
            IPC::WriteParam(aWriter, (aVar).get_CommandLayerInfo());
            // Sentinel = 'TCommandLayerInfo'
            (aWriter)->WriteSentinel(977733277);
            return;
        }
    case union__::TCommandChangedSurface:
        {
            IPC::WriteParam(aWriter, std::move((aVar).get_CommandChangedSurface()));
            // Sentinel = 'TCommandChangedSurface'
            (aWriter)->WriteSentinel(1618282631);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union NativeLayerCommand");
            return;
        }
    }
}

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

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

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

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TCommandCreateLayer'
            if ((!((aReader)->ReadSentinel(1212548965)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TCommandCreateLayer of union NativeLayerCommand");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TCommandCreateLayerForExternalTexture:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::layers::CommandCreateLayerForExternalTexture>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TCommandCreateLayerForExternalTexture of union NativeLayerCommand");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TCommandCreateLayerForExternalTexture'
            if ((!((aReader)->ReadSentinel(294260416)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TCommandCreateLayerForExternalTexture of union NativeLayerCommand");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TCommandCreateLayerForColor:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::layers::CommandCreateLayerForColor>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TCommandCreateLayerForColor of union NativeLayerCommand");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TCommandCreateLayerForColor'
            if ((!((aReader)->ReadSentinel(2431781515)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TCommandCreateLayerForColor of union NativeLayerCommand");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TCommandLayerDestroyed:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::layers::CommandLayerDestroyed>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TCommandLayerDestroyed of union NativeLayerCommand");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TCommandLayerDestroyed'
            if ((!((aReader)->ReadSentinel(1642793156)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TCommandLayerDestroyed of union NativeLayerCommand");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TCommandSetLayers:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::layers::CommandSetLayers>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TCommandSetLayers of union NativeLayerCommand");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TCommandSetLayers'
            if ((!((aReader)->ReadSentinel(978912944)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TCommandSetLayers of union NativeLayerCommand");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TCommandLayerInfo:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::layers::CommandLayerInfo>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TCommandLayerInfo of union NativeLayerCommand");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TCommandLayerInfo'
            if ((!((aReader)->ReadSentinel(977733277)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TCommandLayerInfo of union NativeLayerCommand");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TCommandChangedSurface:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::layers::CommandChangedSurface>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TCommandChangedSurface of union NativeLayerCommand");
                return {};

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

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::layers::CommandCreateLayer>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).Size());
    // Sentinel = 'Size'
    (aWriter)->WriteSentinel(65274268);
    IPC::WriteParam(aWriter, (aVar).Opaque());
    // Sentinel = 'Opaque'
    (aWriter)->WriteSentinel(137757292);
    (aWriter)->WriteBytes((&((aVar).ID())), 8);
    // Sentinel = 'ID'
    (aWriter)->WriteSentinel(14155918);
}

auto ParamTraits<::mozilla::layers::CommandCreateLayer>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___Size = IPC::ReadParam<::mozilla::gfx::IntSize>(aReader);
    if (!maybe___Size) {
        aReader->FatalError("Error deserializing 'Size' (IntSize) member of 'CommandCreateLayer'");
        return {};

    }
    auto& _Size = *maybe___Size;
    // Sentinel = 'Size'
    if ((!((aReader)->ReadSentinel(65274268)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'Size' (IntSize) member of 'CommandCreateLayer'");
        return {};
    }
    auto maybe___Opaque = IPC::ReadParam<bool>(aReader);
    if (!maybe___Opaque) {
        aReader->FatalError("Error deserializing 'Opaque' (bool) member of 'CommandCreateLayer'");
        return {};

    }
    auto& _Opaque = *maybe___Opaque;
    // Sentinel = 'Opaque'
    if ((!((aReader)->ReadSentinel(137757292)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'Opaque' (bool) member of 'CommandCreateLayer'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0},
            std::move(_Size),
            std::move(_Opaque)};
    if ((!((aReader)->ReadBytesInto((&((result__)->ID())), 8)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'ID'
    if ((!((aReader)->ReadSentinel(14155918)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::layers::CommandCreateLayerForExternalTexture>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).Opaque());
    // Sentinel = 'Opaque'
    (aWriter)->WriteSentinel(137757292);
    (aWriter)->WriteBytes((&((aVar).ID())), 8);
    // Sentinel = 'ID'
    (aWriter)->WriteSentinel(14155918);
}

auto ParamTraits<::mozilla::layers::CommandCreateLayerForExternalTexture>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___Opaque = IPC::ReadParam<bool>(aReader);
    if (!maybe___Opaque) {
        aReader->FatalError("Error deserializing 'Opaque' (bool) member of 'CommandCreateLayerForExternalTexture'");
        return {};

    }
    auto& _Opaque = *maybe___Opaque;
    // Sentinel = 'Opaque'
    if ((!((aReader)->ReadSentinel(137757292)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'Opaque' (bool) member of 'CommandCreateLayerForExternalTexture'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0},
            std::move(_Opaque)};
    if ((!((aReader)->ReadBytesInto((&((result__)->ID())), 8)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'ID'
    if ((!((aReader)->ReadSentinel(14155918)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::layers::CommandCreateLayerForColor>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).Color());
    // Sentinel = 'Color'
    (aWriter)->WriteSentinel(94634496);
    (aWriter)->WriteBytes((&((aVar).ID())), 8);
    // Sentinel = 'ID'
    (aWriter)->WriteSentinel(14155918);
}

auto ParamTraits<::mozilla::layers::CommandCreateLayerForColor>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___Color = IPC::ReadParam<::mozilla::gfx::DeviceColor>(aReader);
    if (!maybe___Color) {
        aReader->FatalError("Error deserializing 'Color' (DeviceColor) member of 'CommandCreateLayerForColor'");
        return {};

    }
    auto& _Color = *maybe___Color;
    // Sentinel = 'Color'
    if ((!((aReader)->ReadSentinel(94634496)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'Color' (DeviceColor) member of 'CommandCreateLayerForColor'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0},
            std::move(_Color)};
    if ((!((aReader)->ReadBytesInto((&((result__)->ID())), 8)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'ID'
    if ((!((aReader)->ReadSentinel(14155918)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::layers::CommandLayerDestroyed>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    (aWriter)->WriteBytes((&((aVar).ID())), 8);
    // Sentinel = 'ID'
    (aWriter)->WriteSentinel(14155918);
}

auto ParamTraits<::mozilla::layers::CommandLayerDestroyed>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->ID())), 8)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'ID'
    if ((!((aReader)->ReadSentinel(14155918)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::layers::CommandSetLayers>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).IDs());
    // Sentinel = 'IDs'
    (aWriter)->WriteSentinel(30998785);
}

auto ParamTraits<::mozilla::layers::CommandSetLayers>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___IDs = IPC::ReadParam<nsTArray<::uint64_t>>(aReader);
    if (!maybe___IDs) {
        aReader->FatalError("Error deserializing 'IDs' (uint64_t[]) member of 'CommandSetLayers'");
        return {};

    }
    auto& _IDs = *maybe___IDs;
    // Sentinel = 'IDs'
    if ((!((aReader)->ReadSentinel(30998785)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'IDs' (uint64_t[]) member of 'CommandSetLayers'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_IDs)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::layers::CommandLayerInfo>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).Position());
    // Sentinel = 'Position'
    (aWriter)->WriteSentinel(245826390);
    IPC::WriteParam(aWriter, (aVar).DisplayRect());
    // Sentinel = 'DisplayRect'
    (aWriter)->WriteSentinel(434373733);
    IPC::WriteParam(aWriter, (aVar).ClipRect());
    // Sentinel = 'ClipRect'
    (aWriter)->WriteSentinel(225116951);
    IPC::WriteParam(aWriter, (aVar).RoundedClipRect());
    // Sentinel = 'RoundedClipRect'
    (aWriter)->WriteSentinel(791479784);
    IPC::WriteParam(aWriter, (aVar).Transform());
    // Sentinel = 'Transform'
    (aWriter)->WriteSentinel(305988541);
    IPC::WriteParam(aWriter, (aVar).SurfaceIsFlipped());
    // Sentinel = 'SurfaceIsFlipped'
    (aWriter)->WriteSentinel(891946570);
    (aWriter)->WriteBytes((&((aVar).ID())), 8);
    // Sentinel = 'ID'
    (aWriter)->WriteSentinel(14155918);
    (aWriter)->WriteBytes((&((aVar).SamplingFilter())), 1);
    // Sentinel = 'SamplingFilter'
    (aWriter)->WriteSentinel(697566626);
}

auto ParamTraits<::mozilla::layers::CommandLayerInfo>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___Position = IPC::ReadParam<::mozilla::gfx::IntPoint>(aReader);
    if (!maybe___Position) {
        aReader->FatalError("Error deserializing 'Position' (IntPoint) member of 'CommandLayerInfo'");
        return {};

    }
    auto& _Position = *maybe___Position;
    // Sentinel = 'Position'
    if ((!((aReader)->ReadSentinel(245826390)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'Position' (IntPoint) member of 'CommandLayerInfo'");
        return {};
    }
    auto maybe___DisplayRect = IPC::ReadParam<::mozilla::gfx::IntRect>(aReader);
    if (!maybe___DisplayRect) {
        aReader->FatalError("Error deserializing 'DisplayRect' (IntRect) member of 'CommandLayerInfo'");
        return {};

    }
    auto& _DisplayRect = *maybe___DisplayRect;
    // Sentinel = 'DisplayRect'
    if ((!((aReader)->ReadSentinel(434373733)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'DisplayRect' (IntRect) member of 'CommandLayerInfo'");
        return {};
    }
    auto maybe___ClipRect = IPC::ReadParam<mozilla::Maybe<::mozilla::gfx::IntRect>>(aReader);
    if (!maybe___ClipRect) {
        aReader->FatalError("Error deserializing 'ClipRect' (IntRect?) member of 'CommandLayerInfo'");
        return {};

    }
    auto& _ClipRect = *maybe___ClipRect;
    // Sentinel = 'ClipRect'
    if ((!((aReader)->ReadSentinel(225116951)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'ClipRect' (IntRect?) member of 'CommandLayerInfo'");
        return {};
    }
    auto maybe___RoundedClipRect = IPC::ReadParam<mozilla::Maybe<::mozilla::gfx::RoundedRect>>(aReader);
    if (!maybe___RoundedClipRect) {
        aReader->FatalError("Error deserializing 'RoundedClipRect' (RoundedRect?) member of 'CommandLayerInfo'");
        return {};

    }
    auto& _RoundedClipRect = *maybe___RoundedClipRect;
    // Sentinel = 'RoundedClipRect'
    if ((!((aReader)->ReadSentinel(791479784)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'RoundedClipRect' (RoundedRect?) member of 'CommandLayerInfo'");
        return {};
    }
    auto maybe___Transform = IPC::ReadParam<::mozilla::gfx::Matrix4x4>(aReader);
    if (!maybe___Transform) {
        aReader->FatalError("Error deserializing 'Transform' (Matrix4x4) member of 'CommandLayerInfo'");
        return {};

    }
    auto& _Transform = *maybe___Transform;
    // Sentinel = 'Transform'
    if ((!((aReader)->ReadSentinel(305988541)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'Transform' (Matrix4x4) member of 'CommandLayerInfo'");
        return {};
    }
    auto maybe___SurfaceIsFlipped = IPC::ReadParam<bool>(aReader);
    if (!maybe___SurfaceIsFlipped) {
        aReader->FatalError("Error deserializing 'SurfaceIsFlipped' (bool) member of 'CommandLayerInfo'");
        return {};

    }
    auto& _SurfaceIsFlipped = *maybe___SurfaceIsFlipped;
    // Sentinel = 'SurfaceIsFlipped'
    if ((!((aReader)->ReadSentinel(891946570)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'SurfaceIsFlipped' (bool) member of 'CommandLayerInfo'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0},
            std::move(_Position),
            std::move(_DisplayRect),
            std::move(_ClipRect),
            std::move(_RoundedClipRect),
            std::move(_Transform),
            ::int8_t{0},
            std::move(_SurfaceIsFlipped)};
    if ((!((aReader)->ReadBytesInto((&((result__)->ID())), 8)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'ID'
    if ((!((aReader)->ReadSentinel(14155918)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    if ((!((aReader)->ReadBytesInto((&((result__)->SamplingFilter())), 1)))) {
        aReader->FatalError("Error bulk reading fields from int8_t");
        return {};
    }
    // Sentinel = 'SamplingFilter'
    if ((!((aReader)->ReadSentinel(697566626)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from int8_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::layers::CommandChangedSurface>::Write(
        IPC::MessageWriter* aWriter,
        paramType&& aVar) -> void
{
    IPC::WriteParam(aWriter, std::move((aVar).Surface()));
    // Sentinel = 'Surface'
    (aWriter)->WriteSentinel(187302602);
    IPC::WriteParam(aWriter, (aVar).IsDRM());
    // Sentinel = 'IsDRM'
    (aWriter)->WriteSentinel(83558816);
    IPC::WriteParam(aWriter, (aVar).IsHDR());
    // Sentinel = 'IsHDR'
    (aWriter)->WriteSentinel(82837915);
    IPC::WriteParam(aWriter, (aVar).Size());
    // Sentinel = 'Size'
    (aWriter)->WriteSentinel(65274268);
    (aWriter)->WriteBytes((&((aVar).ID())), 8);
    // Sentinel = 'ID'
    (aWriter)->WriteSentinel(14155918);
}

auto ParamTraits<::mozilla::layers::CommandChangedSurface>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___Surface = IPC::ReadParam<::mozilla::layers::IOSurfacePort>(aReader);
    if (!maybe___Surface) {
        aReader->FatalError("Error deserializing 'Surface' (IOSurfacePort) member of 'CommandChangedSurface'");
        return {};

    }
    auto& _Surface = *maybe___Surface;
    // Sentinel = 'Surface'
    if ((!((aReader)->ReadSentinel(187302602)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'Surface' (IOSurfacePort) member of 'CommandChangedSurface'");
        return {};
    }
    auto maybe___IsDRM = IPC::ReadParam<bool>(aReader);
    if (!maybe___IsDRM) {
        aReader->FatalError("Error deserializing 'IsDRM' (bool) member of 'CommandChangedSurface'");
        return {};

    }
    auto& _IsDRM = *maybe___IsDRM;
    // Sentinel = 'IsDRM'
    if ((!((aReader)->ReadSentinel(83558816)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'IsDRM' (bool) member of 'CommandChangedSurface'");
        return {};
    }
    auto maybe___IsHDR = IPC::ReadParam<bool>(aReader);
    if (!maybe___IsHDR) {
        aReader->FatalError("Error deserializing 'IsHDR' (bool) member of 'CommandChangedSurface'");
        return {};

    }
    auto& _IsHDR = *maybe___IsHDR;
    // Sentinel = 'IsHDR'
    if ((!((aReader)->ReadSentinel(82837915)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'IsHDR' (bool) member of 'CommandChangedSurface'");
        return {};
    }
    auto maybe___Size = IPC::ReadParam<::mozilla::gfx::IntSize>(aReader);
    if (!maybe___Size) {
        aReader->FatalError("Error deserializing 'Size' (IntSize) member of 'CommandChangedSurface'");
        return {};

    }
    auto& _Size = *maybe___Size;
    // Sentinel = 'Size'
    if ((!((aReader)->ReadSentinel(65274268)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'Size' (IntSize) member of 'CommandChangedSurface'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0},
            std::move(_Surface),
            std::move(_IsDRM),
            std::move(_IsHDR),
            std::move(_Size)};
    if ((!((aReader)->ReadBytesInto((&((result__)->ID())), 8)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'ID'
    if ((!((aReader)->ReadSentinel(14155918)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    return result__;
}

} // namespace IPC
