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


#include "ipc/ErrorIPCUtils.h"
#include "mozilla/dom/ServiceWorkerIPCUtils.h"
#include "mozilla/dom/WorkerIPCUtils.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/ServiceWorkerIPCUtils.h"
#include "mozilla/dom/WorkerIPCUtils.h"
#include "mozilla/dom/IPCServiceWorkerRegistrationDescriptor.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"


//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct IPCServiceWorkerRegistrationDescriptor|
//
namespace mozilla {
namespace dom {
auto IPCServiceWorkerRegistrationDescriptor::operator==(const IPCServiceWorkerRegistrationDescriptor& _o) const -> bool
{
    if ((!((id()) == ((_o).id())))) {
        return false;
    }
    if ((!((version()) == ((_o).version())))) {
        return false;
    }
    if ((!((principalInfo()) == ((_o).principalInfo())))) {
        return false;
    }
    if ((!((scope()) == ((_o).scope())))) {
        return false;
    }
    if ((!((type()) == ((_o).type())))) {
        return false;
    }
    if ((!((updateViaCache()) == ((_o).updateViaCache())))) {
        return false;
    }
    if ((!((installing()) == ((_o).installing())))) {
        return false;
    }
    if ((!((waiting()) == ((_o).waiting())))) {
        return false;
    }
    if ((!((active()) == ((_o).active())))) {
        return false;
    }
    return true;
}

auto IPCServiceWorkerRegistrationDescriptor::operator!=(const IPCServiceWorkerRegistrationDescriptor& _o) const -> bool
{
    return (!(operator==(_o)));
}

auto IPCServiceWorkerRegistrationDescriptor::StaticAssertions() const -> void
{
    static_assert(
        (offsetof(IPCServiceWorkerRegistrationDescriptor, version_) - offsetof(IPCServiceWorkerRegistrationDescriptor, id_)) == 8,
        "Bad assumptions about field layout!");
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::IPCServiceWorkerRegistrationDescriptor>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).principalInfo());
    // Sentinel = 'principalInfo'
    (aWriter)->WriteSentinel(633472335);
    IPC::WriteParam(aWriter, (aVar).scope());
    // Sentinel = 'scope'
    (aWriter)->WriteSentinel(107086363);
    IPC::WriteParam(aWriter, (aVar).type());
    // Sentinel = 'type'
    (aWriter)->WriteSentinel(75760067);
    IPC::WriteParam(aWriter, (aVar).updateViaCache());
    // Sentinel = 'updateViaCache'
    (aWriter)->WriteSentinel(706348408);
    IPC::WriteParam(aWriter, (aVar).installing());
    // Sentinel = 'installing'
    (aWriter)->WriteSentinel(391513142);
    IPC::WriteParam(aWriter, (aVar).waiting());
    // Sentinel = 'waiting'
    (aWriter)->WriteSentinel(199820020);
    IPC::WriteParam(aWriter, (aVar).active());
    // Sentinel = 'active'
    (aWriter)->WriteSentinel(144114301);
    (aWriter)->WriteBytes((&((aVar).id())), 16);
    // Sentinel = 'id | version'
    (aWriter)->WriteSentinel(470090896);
}

auto ParamTraits<::mozilla::dom::IPCServiceWorkerRegistrationDescriptor>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___principalInfo = IPC::ReadParam<::mozilla::ipc::PrincipalInfo>(aReader);
    if (!maybe___principalInfo) {
        aReader->FatalError("Error deserializing 'principalInfo' (PrincipalInfo) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};

    }
    auto& _principalInfo = *maybe___principalInfo;
    // Sentinel = 'principalInfo'
    if ((!((aReader)->ReadSentinel(633472335)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'principalInfo' (PrincipalInfo) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};
    }
    auto maybe___scope = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___scope) {
        aReader->FatalError("Error deserializing 'scope' (nsCString) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};

    }
    auto& _scope = *maybe___scope;
    // Sentinel = 'scope'
    if ((!((aReader)->ReadSentinel(107086363)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'scope' (nsCString) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};
    }
    auto maybe___type = IPC::ReadParam<::mozilla::dom::WorkerType>(aReader);
    if (!maybe___type) {
        aReader->FatalError("Error deserializing 'type' (WorkerType) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};

    }
    auto& _type = *maybe___type;
    // Sentinel = 'type'
    if ((!((aReader)->ReadSentinel(75760067)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'type' (WorkerType) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};
    }
    auto maybe___updateViaCache = IPC::ReadParam<::mozilla::dom::ServiceWorkerUpdateViaCache>(aReader);
    if (!maybe___updateViaCache) {
        aReader->FatalError("Error deserializing 'updateViaCache' (ServiceWorkerUpdateViaCache) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};

    }
    auto& _updateViaCache = *maybe___updateViaCache;
    // Sentinel = 'updateViaCache'
    if ((!((aReader)->ReadSentinel(706348408)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'updateViaCache' (ServiceWorkerUpdateViaCache) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};
    }
    auto maybe___installing = IPC::ReadParam<mozilla::Maybe<::mozilla::dom::IPCServiceWorkerDescriptor>>(aReader);
    if (!maybe___installing) {
        aReader->FatalError("Error deserializing 'installing' (IPCServiceWorkerDescriptor?) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};

    }
    auto& _installing = *maybe___installing;
    // Sentinel = 'installing'
    if ((!((aReader)->ReadSentinel(391513142)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'installing' (IPCServiceWorkerDescriptor?) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};
    }
    auto maybe___waiting = IPC::ReadParam<mozilla::Maybe<::mozilla::dom::IPCServiceWorkerDescriptor>>(aReader);
    if (!maybe___waiting) {
        aReader->FatalError("Error deserializing 'waiting' (IPCServiceWorkerDescriptor?) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};

    }
    auto& _waiting = *maybe___waiting;
    // Sentinel = 'waiting'
    if ((!((aReader)->ReadSentinel(199820020)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'waiting' (IPCServiceWorkerDescriptor?) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};
    }
    auto maybe___active = IPC::ReadParam<mozilla::Maybe<::mozilla::dom::IPCServiceWorkerDescriptor>>(aReader);
    if (!maybe___active) {
        aReader->FatalError("Error deserializing 'active' (IPCServiceWorkerDescriptor?) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};

    }
    auto& _active = *maybe___active;
    // Sentinel = 'active'
    if ((!((aReader)->ReadSentinel(144114301)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'active' (IPCServiceWorkerDescriptor?) member of 'IPCServiceWorkerRegistrationDescriptor'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0},
            ::uint64_t{0},
            std::move(_principalInfo),
            std::move(_scope),
            std::move(_type),
            std::move(_updateViaCache),
            std::move(_installing),
            std::move(_waiting),
            std::move(_active)};
    if ((!((aReader)->ReadBytesInto((&((result__)->id())), 16)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'id | version'
    if ((!((aReader)->ReadSentinel(470090896)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult|
//
namespace mozilla {
namespace dom {
auto IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TIPCServiceWorkerRegistrationDescriptor:
        {
            (ptr_IPCServiceWorkerRegistrationDescriptor())->~IPCServiceWorkerRegistrationDescriptor__tdef();
            break;
        }
    case TCopyableErrorResult:
        {
            (ptr_CopyableErrorResult())->~CopyableErrorResult__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult(const IPCServiceWorkerRegistrationDescriptor& aOther)
{
    new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptor()) IPCServiceWorkerRegistrationDescriptor(aOther);
    mType = TIPCServiceWorkerRegistrationDescriptor;
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult(IPCServiceWorkerRegistrationDescriptor&& aOther)
{
    new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptor()) IPCServiceWorkerRegistrationDescriptor(std::move(aOther));
    mType = TIPCServiceWorkerRegistrationDescriptor;
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult(const CopyableErrorResult& aOther)
{
    new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(aOther);
    mType = TCopyableErrorResult;
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult(CopyableErrorResult&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(std::move(aOther));
    mType = TCopyableErrorResult;
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult(const IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TIPCServiceWorkerRegistrationDescriptor:
        {
            new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptor()) IPCServiceWorkerRegistrationDescriptor((aOther).get_IPCServiceWorkerRegistrationDescriptor());
            break;
        }
    case TCopyableErrorResult:
        {
            new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult((aOther).get_CopyableErrorResult());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult(IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TIPCServiceWorkerRegistrationDescriptor:
        {
            new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptor()) IPCServiceWorkerRegistrationDescriptor(std::move((aOther).get_IPCServiceWorkerRegistrationDescriptor()));
            (aOther).MaybeDestroy();
            break;
        }
    case TCopyableErrorResult:
        {
            new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(std::move((aOther).get_CopyableErrorResult()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::operator=(const IPCServiceWorkerRegistrationDescriptor& aRhs) -> IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptor()) IPCServiceWorkerRegistrationDescriptor(aRhs);
    mType = TIPCServiceWorkerRegistrationDescriptor;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::operator=(IPCServiceWorkerRegistrationDescriptor&& aRhs) -> IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptor()) IPCServiceWorkerRegistrationDescriptor(std::move(aRhs));
    mType = TIPCServiceWorkerRegistrationDescriptor;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::operator=(const CopyableErrorResult& aRhs) -> IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(aRhs);
    mType = TCopyableErrorResult;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::operator=(CopyableErrorResult&& aRhs) -> IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(std::move(aRhs));
    mType = TCopyableErrorResult;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::operator=(const IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult& aRhs) -> IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TIPCServiceWorkerRegistrationDescriptor:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptor()) IPCServiceWorkerRegistrationDescriptor((aRhs).get_IPCServiceWorkerRegistrationDescriptor());
            break;
        }
    case TCopyableErrorResult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult((aRhs).get_CopyableErrorResult());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult::operator=(IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&& aRhs) -> IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TIPCServiceWorkerRegistrationDescriptor:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptor()) IPCServiceWorkerRegistrationDescriptor(std::move((aRhs).get_IPCServiceWorkerRegistrationDescriptor()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TCopyableErrorResult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(std::move((aRhs).get_CopyableErrorResult()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace dom
} // namespace mozilla

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

    switch (type) {
    case union__::TIPCServiceWorkerRegistrationDescriptor:
        {
            IPC::WriteParam(aWriter, (aVar).get_IPCServiceWorkerRegistrationDescriptor());
            // Sentinel = 'TIPCServiceWorkerRegistrationDescriptor'
            (aWriter)->WriteSentinel(751308694);
            return;
        }
    case union__::TCopyableErrorResult:
        {
            IPC::WriteParam(aWriter, (aVar).get_CopyableErrorResult());
            // Sentinel = 'TCopyableErrorResult'
            (aWriter)->WriteSentinel(1376585741);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult");
            return;
        }
    }
}

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

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

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

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TIPCServiceWorkerRegistrationDescriptor'
            if ((!((aReader)->ReadSentinel(751308694)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TIPCServiceWorkerRegistrationDescriptor of union IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TCopyableErrorResult:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::CopyableErrorResult>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TCopyableErrorResult of union IPCServiceWorkerRegistrationDescriptorOrCopyableErrorResult");
                return {};

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

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::IPCServiceWorkerRegistrationDescriptorList>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).values());
    // Sentinel = 'values'
    (aWriter)->WriteSentinel(150667921);
}

auto ParamTraits<::mozilla::dom::IPCServiceWorkerRegistrationDescriptorList>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___values = IPC::ReadParam<nsTArray<::mozilla::dom::IPCServiceWorkerRegistrationDescriptor>>(aReader);
    if (!maybe___values) {
        aReader->FatalError("Error deserializing 'values' (IPCServiceWorkerRegistrationDescriptor[]) member of 'IPCServiceWorkerRegistrationDescriptorList'");
        return {};

    }
    auto& _values = *maybe___values;
    // Sentinel = 'values'
    if ((!((aReader)->ReadSentinel(150667921)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'values' (IPCServiceWorkerRegistrationDescriptor[]) member of 'IPCServiceWorkerRegistrationDescriptorList'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_values)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult|
//
namespace mozilla {
namespace dom {
auto IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TIPCServiceWorkerRegistrationDescriptorList:
        {
            (ptr_IPCServiceWorkerRegistrationDescriptorList())->~IPCServiceWorkerRegistrationDescriptorList__tdef();
            break;
        }
    case TCopyableErrorResult:
        {
            (ptr_CopyableErrorResult())->~CopyableErrorResult__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult(const IPCServiceWorkerRegistrationDescriptorList& aOther)
{
    new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptorList()) IPCServiceWorkerRegistrationDescriptorList(aOther);
    mType = TIPCServiceWorkerRegistrationDescriptorList;
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult(IPCServiceWorkerRegistrationDescriptorList&& aOther)
{
    new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptorList()) IPCServiceWorkerRegistrationDescriptorList(std::move(aOther));
    mType = TIPCServiceWorkerRegistrationDescriptorList;
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult(const CopyableErrorResult& aOther)
{
    new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(aOther);
    mType = TCopyableErrorResult;
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult(CopyableErrorResult&& aOther)
{
    new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(std::move(aOther));
    mType = TCopyableErrorResult;
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult(const IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TIPCServiceWorkerRegistrationDescriptorList:
        {
            new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptorList()) IPCServiceWorkerRegistrationDescriptorList((aOther).get_IPCServiceWorkerRegistrationDescriptorList());
            break;
        }
    case TCopyableErrorResult:
        {
            new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult((aOther).get_CopyableErrorResult());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult(IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TIPCServiceWorkerRegistrationDescriptorList:
        {
            new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptorList()) IPCServiceWorkerRegistrationDescriptorList(std::move((aOther).get_IPCServiceWorkerRegistrationDescriptorList()));
            (aOther).MaybeDestroy();
            break;
        }
    case TCopyableErrorResult:
        {
            new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(std::move((aOther).get_CopyableErrorResult()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::operator=(const IPCServiceWorkerRegistrationDescriptorList& aRhs) -> IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptorList()) IPCServiceWorkerRegistrationDescriptorList(aRhs);
    mType = TIPCServiceWorkerRegistrationDescriptorList;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::operator=(IPCServiceWorkerRegistrationDescriptorList&& aRhs) -> IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptorList()) IPCServiceWorkerRegistrationDescriptorList(std::move(aRhs));
    mType = TIPCServiceWorkerRegistrationDescriptorList;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::operator=(const CopyableErrorResult& aRhs) -> IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(aRhs);
    mType = TCopyableErrorResult;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::operator=(CopyableErrorResult&& aRhs) -> IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(std::move(aRhs));
    mType = TCopyableErrorResult;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::operator=(const IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult& aRhs) -> IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TIPCServiceWorkerRegistrationDescriptorList:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptorList()) IPCServiceWorkerRegistrationDescriptorList((aRhs).get_IPCServiceWorkerRegistrationDescriptorList());
            break;
        }
    case TCopyableErrorResult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult((aRhs).get_CopyableErrorResult());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult::operator=(IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult&& aRhs) -> IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TIPCServiceWorkerRegistrationDescriptorList:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_IPCServiceWorkerRegistrationDescriptorList()) IPCServiceWorkerRegistrationDescriptorList(std::move((aRhs).get_IPCServiceWorkerRegistrationDescriptorList()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TCopyableErrorResult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_CopyableErrorResult()) CopyableErrorResult(std::move((aRhs).get_CopyableErrorResult()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace dom
} // namespace mozilla

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

    switch (type) {
    case union__::TIPCServiceWorkerRegistrationDescriptorList:
        {
            IPC::WriteParam(aWriter, (aVar).get_IPCServiceWorkerRegistrationDescriptorList());
            // Sentinel = 'TIPCServiceWorkerRegistrationDescriptorList'
            (aWriter)->WriteSentinel(1860505906);
            return;
        }
    case union__::TCopyableErrorResult:
        {
            IPC::WriteParam(aWriter, (aVar).get_CopyableErrorResult());
            // Sentinel = 'TCopyableErrorResult'
            (aWriter)->WriteSentinel(1376585741);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult");
            return;
        }
    }
}

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

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

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

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TIPCServiceWorkerRegistrationDescriptorList'
            if ((!((aReader)->ReadSentinel(1860505906)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TIPCServiceWorkerRegistrationDescriptorList of union IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TCopyableErrorResult:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::CopyableErrorResult>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TCopyableErrorResult of union IPCServiceWorkerRegistrationDescriptorListOrCopyableErrorResult");
                return {};

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

} // namespace IPC
