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


#include "mozilla/dom/localstorage/SerializationHelpers.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/PBackgroundLSSharedTypes.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 LSRequestCommonParams|
//
namespace mozilla {
namespace dom {
} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::LSRequestCommonParams>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).principalInfo());
    // Sentinel = 'principalInfo'
    (aWriter)->WriteSentinel(633472335);
    IPC::WriteParam(aWriter, (aVar).storagePrincipalInfo());
    // Sentinel = 'storagePrincipalInfo'
    (aWriter)->WriteSentinel(1455425572);
    IPC::WriteParam(aWriter, (aVar).originKey());
    // Sentinel = 'originKey'
    (aWriter)->WriteSentinel(313656242);
}

auto ParamTraits<::mozilla::dom::LSRequestCommonParams>::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 'LSRequestCommonParams'");
        return {};

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

    }
    auto& _storagePrincipalInfo = *maybe___storagePrincipalInfo;
    // Sentinel = 'storagePrincipalInfo'
    if ((!((aReader)->ReadSentinel(1455425572)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'storagePrincipalInfo' (PrincipalInfo) member of 'LSRequestCommonParams'");
        return {};
    }
    auto maybe___originKey = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___originKey) {
        aReader->FatalError("Error deserializing 'originKey' (nsCString) member of 'LSRequestCommonParams'");
        return {};

    }
    auto& _originKey = *maybe___originKey;
    // Sentinel = 'originKey'
    if ((!((aReader)->ReadSentinel(313656242)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'originKey' (nsCString) member of 'LSRequestCommonParams'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_principalInfo),
            std::move(_storagePrincipalInfo),
            std::move(_originKey)};
    return result__;
}

} // namespace IPC

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

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

auto ParamTraits<::mozilla::dom::LSRequestPreloadDatastoreParams>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___commonParams = IPC::ReadParam<::mozilla::dom::LSRequestCommonParams>(aReader);
    if (!maybe___commonParams) {
        aReader->FatalError("Error deserializing 'commonParams' (LSRequestCommonParams) member of 'LSRequestPreloadDatastoreParams'");
        return {};

    }
    auto& _commonParams = *maybe___commonParams;
    // Sentinel = 'commonParams'
    if ((!((aReader)->ReadSentinel(537068782)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'commonParams' (LSRequestCommonParams) member of 'LSRequestPreloadDatastoreParams'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_commonParams)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::LSRequestPrepareDatastoreParams>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).commonParams());
    // Sentinel = 'commonParams'
    (aWriter)->WriteSentinel(537068782);
    IPC::WriteParam(aWriter, (aVar).clientId());
    // Sentinel = 'clientId'
    (aWriter)->WriteSentinel(244122413);
    IPC::WriteParam(aWriter, (aVar).clientPrincipalInfo());
    // Sentinel = 'clientPrincipalInfo'
    (aWriter)->WriteSentinel(1294731182);
}

auto ParamTraits<::mozilla::dom::LSRequestPrepareDatastoreParams>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___commonParams = IPC::ReadParam<::mozilla::dom::LSRequestCommonParams>(aReader);
    if (!maybe___commonParams) {
        aReader->FatalError("Error deserializing 'commonParams' (LSRequestCommonParams) member of 'LSRequestPrepareDatastoreParams'");
        return {};

    }
    auto& _commonParams = *maybe___commonParams;
    // Sentinel = 'commonParams'
    if ((!((aReader)->ReadSentinel(537068782)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'commonParams' (LSRequestCommonParams) member of 'LSRequestPrepareDatastoreParams'");
        return {};
    }
    auto maybe___clientId = IPC::ReadParam<mozilla::Maybe<::nsID>>(aReader);
    if (!maybe___clientId) {
        aReader->FatalError("Error deserializing 'clientId' (nsID?) member of 'LSRequestPrepareDatastoreParams'");
        return {};

    }
    auto& _clientId = *maybe___clientId;
    // Sentinel = 'clientId'
    if ((!((aReader)->ReadSentinel(244122413)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'clientId' (nsID?) member of 'LSRequestPrepareDatastoreParams'");
        return {};
    }
    auto maybe___clientPrincipalInfo = IPC::ReadParam<mozilla::Maybe<::mozilla::ipc::PrincipalInfo>>(aReader);
    if (!maybe___clientPrincipalInfo) {
        aReader->FatalError("Error deserializing 'clientPrincipalInfo' (PrincipalInfo?) member of 'LSRequestPrepareDatastoreParams'");
        return {};

    }
    auto& _clientPrincipalInfo = *maybe___clientPrincipalInfo;
    // Sentinel = 'clientPrincipalInfo'
    if ((!((aReader)->ReadSentinel(1294731182)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'clientPrincipalInfo' (PrincipalInfo?) member of 'LSRequestPrepareDatastoreParams'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_commonParams),
            std::move(_clientId),
            std::move(_clientPrincipalInfo)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::LSRequestPrepareObserverParams>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).principalInfo());
    // Sentinel = 'principalInfo'
    (aWriter)->WriteSentinel(633472335);
    IPC::WriteParam(aWriter, (aVar).storagePrincipalInfo());
    // Sentinel = 'storagePrincipalInfo'
    (aWriter)->WriteSentinel(1455425572);
    IPC::WriteParam(aWriter, (aVar).clientId());
    // Sentinel = 'clientId'
    (aWriter)->WriteSentinel(244122413);
    IPC::WriteParam(aWriter, (aVar).clientPrincipalInfo());
    // Sentinel = 'clientPrincipalInfo'
    (aWriter)->WriteSentinel(1294731182);
}

auto ParamTraits<::mozilla::dom::LSRequestPrepareObserverParams>::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 'LSRequestPrepareObserverParams'");
        return {};

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

    }
    auto& _storagePrincipalInfo = *maybe___storagePrincipalInfo;
    // Sentinel = 'storagePrincipalInfo'
    if ((!((aReader)->ReadSentinel(1455425572)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'storagePrincipalInfo' (PrincipalInfo) member of 'LSRequestPrepareObserverParams'");
        return {};
    }
    auto maybe___clientId = IPC::ReadParam<mozilla::Maybe<::nsID>>(aReader);
    if (!maybe___clientId) {
        aReader->FatalError("Error deserializing 'clientId' (nsID?) member of 'LSRequestPrepareObserverParams'");
        return {};

    }
    auto& _clientId = *maybe___clientId;
    // Sentinel = 'clientId'
    if ((!((aReader)->ReadSentinel(244122413)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'clientId' (nsID?) member of 'LSRequestPrepareObserverParams'");
        return {};
    }
    auto maybe___clientPrincipalInfo = IPC::ReadParam<mozilla::Maybe<::mozilla::ipc::PrincipalInfo>>(aReader);
    if (!maybe___clientPrincipalInfo) {
        aReader->FatalError("Error deserializing 'clientPrincipalInfo' (PrincipalInfo?) member of 'LSRequestPrepareObserverParams'");
        return {};

    }
    auto& _clientPrincipalInfo = *maybe___clientPrincipalInfo;
    // Sentinel = 'clientPrincipalInfo'
    if ((!((aReader)->ReadSentinel(1294731182)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'clientPrincipalInfo' (PrincipalInfo?) member of 'LSRequestPrepareObserverParams'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_principalInfo),
            std::move(_storagePrincipalInfo),
            std::move(_clientId),
            std::move(_clientPrincipalInfo)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union LSRequestParams|
//
namespace mozilla {
namespace dom {
auto LSRequestParams::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TLSRequestPreloadDatastoreParams:
        {
            (ptr_LSRequestPreloadDatastoreParams())->~LSRequestPreloadDatastoreParams__tdef();
            break;
        }
    case TLSRequestPrepareDatastoreParams:
        {
            (ptr_LSRequestPrepareDatastoreParams())->~LSRequestPrepareDatastoreParams__tdef();
            break;
        }
    case TLSRequestPrepareObserverParams:
        {
            (ptr_LSRequestPrepareObserverParams())->~LSRequestPrepareObserverParams__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT LSRequestParams::LSRequestParams(const LSRequestPreloadDatastoreParams& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreParams()) LSRequestPreloadDatastoreParams(aOther);
    mType = TLSRequestPreloadDatastoreParams;
}

MOZ_IMPLICIT LSRequestParams::LSRequestParams(LSRequestPreloadDatastoreParams&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreParams()) LSRequestPreloadDatastoreParams(std::move(aOther));
    mType = TLSRequestPreloadDatastoreParams;
}

MOZ_IMPLICIT LSRequestParams::LSRequestParams(const LSRequestPrepareDatastoreParams& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreParams()) LSRequestPrepareDatastoreParams(aOther);
    mType = TLSRequestPrepareDatastoreParams;
}

MOZ_IMPLICIT LSRequestParams::LSRequestParams(LSRequestPrepareDatastoreParams&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreParams()) LSRequestPrepareDatastoreParams(std::move(aOther));
    mType = TLSRequestPrepareDatastoreParams;
}

MOZ_IMPLICIT LSRequestParams::LSRequestParams(const LSRequestPrepareObserverParams& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverParams()) LSRequestPrepareObserverParams(aOther);
    mType = TLSRequestPrepareObserverParams;
}

MOZ_IMPLICIT LSRequestParams::LSRequestParams(LSRequestPrepareObserverParams&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverParams()) LSRequestPrepareObserverParams(std::move(aOther));
    mType = TLSRequestPrepareObserverParams;
}

MOZ_IMPLICIT LSRequestParams::LSRequestParams(const LSRequestParams& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TLSRequestPreloadDatastoreParams:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreParams()) LSRequestPreloadDatastoreParams((aOther).get_LSRequestPreloadDatastoreParams());
            break;
        }
    case TLSRequestPrepareDatastoreParams:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreParams()) LSRequestPrepareDatastoreParams((aOther).get_LSRequestPrepareDatastoreParams());
            break;
        }
    case TLSRequestPrepareObserverParams:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverParams()) LSRequestPrepareObserverParams((aOther).get_LSRequestPrepareObserverParams());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT LSRequestParams::LSRequestParams(LSRequestParams&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TLSRequestPreloadDatastoreParams:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreParams()) LSRequestPreloadDatastoreParams(std::move((aOther).get_LSRequestPreloadDatastoreParams()));
            (aOther).MaybeDestroy();
            break;
        }
    case TLSRequestPrepareDatastoreParams:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreParams()) LSRequestPrepareDatastoreParams(std::move((aOther).get_LSRequestPrepareDatastoreParams()));
            (aOther).MaybeDestroy();
            break;
        }
    case TLSRequestPrepareObserverParams:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverParams()) LSRequestPrepareObserverParams(std::move((aOther).get_LSRequestPrepareObserverParams()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto LSRequestParams::operator=(const LSRequestPreloadDatastoreParams& aRhs) -> LSRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreParams()) LSRequestPreloadDatastoreParams(aRhs);
    mType = TLSRequestPreloadDatastoreParams;
    return (*(this));
}

auto LSRequestParams::operator=(LSRequestPreloadDatastoreParams&& aRhs) -> LSRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreParams()) LSRequestPreloadDatastoreParams(std::move(aRhs));
    mType = TLSRequestPreloadDatastoreParams;
    return (*(this));
}

auto LSRequestParams::operator=(const LSRequestPrepareDatastoreParams& aRhs) -> LSRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreParams()) LSRequestPrepareDatastoreParams(aRhs);
    mType = TLSRequestPrepareDatastoreParams;
    return (*(this));
}

auto LSRequestParams::operator=(LSRequestPrepareDatastoreParams&& aRhs) -> LSRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreParams()) LSRequestPrepareDatastoreParams(std::move(aRhs));
    mType = TLSRequestPrepareDatastoreParams;
    return (*(this));
}

auto LSRequestParams::operator=(const LSRequestPrepareObserverParams& aRhs) -> LSRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverParams()) LSRequestPrepareObserverParams(aRhs);
    mType = TLSRequestPrepareObserverParams;
    return (*(this));
}

auto LSRequestParams::operator=(LSRequestPrepareObserverParams&& aRhs) -> LSRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverParams()) LSRequestPrepareObserverParams(std::move(aRhs));
    mType = TLSRequestPrepareObserverParams;
    return (*(this));
}

auto LSRequestParams::operator=(const LSRequestParams& aRhs) -> LSRequestParams&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TLSRequestPreloadDatastoreParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreParams()) LSRequestPreloadDatastoreParams((aRhs).get_LSRequestPreloadDatastoreParams());
            break;
        }
    case TLSRequestPrepareDatastoreParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreParams()) LSRequestPrepareDatastoreParams((aRhs).get_LSRequestPrepareDatastoreParams());
            break;
        }
    case TLSRequestPrepareObserverParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverParams()) LSRequestPrepareObserverParams((aRhs).get_LSRequestPrepareObserverParams());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto LSRequestParams::operator=(LSRequestParams&& aRhs) -> LSRequestParams&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TLSRequestPreloadDatastoreParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreParams()) LSRequestPreloadDatastoreParams(std::move((aRhs).get_LSRequestPreloadDatastoreParams()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TLSRequestPrepareDatastoreParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreParams()) LSRequestPrepareDatastoreParams(std::move((aRhs).get_LSRequestPrepareDatastoreParams()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TLSRequestPrepareObserverParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverParams()) LSRequestPrepareObserverParams(std::move((aRhs).get_LSRequestPrepareObserverParams()));
            (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::LSRequestParams>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::LSRequestParams union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'LSRequestParams'
    (aWriter)->WriteSentinel(766379501);

    switch (type) {
    case union__::TLSRequestPreloadDatastoreParams:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSRequestPreloadDatastoreParams());
            // Sentinel = 'TLSRequestPreloadDatastoreParams'
            (aWriter)->WriteSentinel(3435990191);
            return;
        }
    case union__::TLSRequestPrepareDatastoreParams:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSRequestPrepareDatastoreParams());
            // Sentinel = 'TLSRequestPrepareDatastoreParams'
            (aWriter)->WriteSentinel(3444444343);
            return;
        }
    case union__::TLSRequestPrepareObserverParams:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSRequestPrepareObserverParams());
            // Sentinel = 'TLSRequestPrepareObserverParams'
            (aWriter)->WriteSentinel(3239840856);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union LSRequestParams");
            return;
        }
    }
}

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

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

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

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TLSRequestPreloadDatastoreParams'
            if ((!((aReader)->ReadSentinel(3435990191)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TLSRequestPreloadDatastoreParams of union LSRequestParams");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TLSRequestPrepareDatastoreParams:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::LSRequestPrepareDatastoreParams>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TLSRequestPrepareDatastoreParams of union LSRequestParams");
                return {};

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TLSRequestPrepareDatastoreParams'
            if ((!((aReader)->ReadSentinel(3444444343)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TLSRequestPrepareDatastoreParams of union LSRequestParams");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TLSRequestPrepareObserverParams:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::LSRequestPrepareObserverParams>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TLSRequestPrepareObserverParams of union LSRequestParams");
                return {};

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

} // namespace IPC

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

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

auto ParamTraits<::mozilla::dom::LSSimpleRequestPreloadedParams>::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 'LSSimpleRequestPreloadedParams'");
        return {};

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

    }
    auto& _storagePrincipalInfo = *maybe___storagePrincipalInfo;
    // Sentinel = 'storagePrincipalInfo'
    if ((!((aReader)->ReadSentinel(1455425572)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'storagePrincipalInfo' (PrincipalInfo) member of 'LSSimpleRequestPreloadedParams'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_principalInfo),
            std::move(_storagePrincipalInfo)};
    return result__;
}

} // namespace IPC

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

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

auto ParamTraits<::mozilla::dom::LSSimpleRequestGetStateParams>::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 'LSSimpleRequestGetStateParams'");
        return {};

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

    }
    auto& _storagePrincipalInfo = *maybe___storagePrincipalInfo;
    // Sentinel = 'storagePrincipalInfo'
    if ((!((aReader)->ReadSentinel(1455425572)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'storagePrincipalInfo' (PrincipalInfo) member of 'LSSimpleRequestGetStateParams'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_principalInfo),
            std::move(_storagePrincipalInfo)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union LSSimpleRequestParams|
//
namespace mozilla {
namespace dom {
auto LSSimpleRequestParams::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TLSSimpleRequestPreloadedParams:
        {
            (ptr_LSSimpleRequestPreloadedParams())->~LSSimpleRequestPreloadedParams__tdef();
            break;
        }
    case TLSSimpleRequestGetStateParams:
        {
            (ptr_LSSimpleRequestGetStateParams())->~LSSimpleRequestGetStateParams__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT LSSimpleRequestParams::LSSimpleRequestParams(const LSSimpleRequestPreloadedParams& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedParams()) LSSimpleRequestPreloadedParams(aOther);
    mType = TLSSimpleRequestPreloadedParams;
}

MOZ_IMPLICIT LSSimpleRequestParams::LSSimpleRequestParams(LSSimpleRequestPreloadedParams&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedParams()) LSSimpleRequestPreloadedParams(std::move(aOther));
    mType = TLSSimpleRequestPreloadedParams;
}

MOZ_IMPLICIT LSSimpleRequestParams::LSSimpleRequestParams(const LSSimpleRequestGetStateParams& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateParams()) LSSimpleRequestGetStateParams(aOther);
    mType = TLSSimpleRequestGetStateParams;
}

MOZ_IMPLICIT LSSimpleRequestParams::LSSimpleRequestParams(LSSimpleRequestGetStateParams&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateParams()) LSSimpleRequestGetStateParams(std::move(aOther));
    mType = TLSSimpleRequestGetStateParams;
}

MOZ_IMPLICIT LSSimpleRequestParams::LSSimpleRequestParams(const LSSimpleRequestParams& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TLSSimpleRequestPreloadedParams:
        {
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedParams()) LSSimpleRequestPreloadedParams((aOther).get_LSSimpleRequestPreloadedParams());
            break;
        }
    case TLSSimpleRequestGetStateParams:
        {
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateParams()) LSSimpleRequestGetStateParams((aOther).get_LSSimpleRequestGetStateParams());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT LSSimpleRequestParams::LSSimpleRequestParams(LSSimpleRequestParams&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TLSSimpleRequestPreloadedParams:
        {
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedParams()) LSSimpleRequestPreloadedParams(std::move((aOther).get_LSSimpleRequestPreloadedParams()));
            (aOther).MaybeDestroy();
            break;
        }
    case TLSSimpleRequestGetStateParams:
        {
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateParams()) LSSimpleRequestGetStateParams(std::move((aOther).get_LSSimpleRequestGetStateParams()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto LSSimpleRequestParams::operator=(const LSSimpleRequestPreloadedParams& aRhs) -> LSSimpleRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedParams()) LSSimpleRequestPreloadedParams(aRhs);
    mType = TLSSimpleRequestPreloadedParams;
    return (*(this));
}

auto LSSimpleRequestParams::operator=(LSSimpleRequestPreloadedParams&& aRhs) -> LSSimpleRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedParams()) LSSimpleRequestPreloadedParams(std::move(aRhs));
    mType = TLSSimpleRequestPreloadedParams;
    return (*(this));
}

auto LSSimpleRequestParams::operator=(const LSSimpleRequestGetStateParams& aRhs) -> LSSimpleRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateParams()) LSSimpleRequestGetStateParams(aRhs);
    mType = TLSSimpleRequestGetStateParams;
    return (*(this));
}

auto LSSimpleRequestParams::operator=(LSSimpleRequestGetStateParams&& aRhs) -> LSSimpleRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateParams()) LSSimpleRequestGetStateParams(std::move(aRhs));
    mType = TLSSimpleRequestGetStateParams;
    return (*(this));
}

auto LSSimpleRequestParams::operator=(const LSSimpleRequestParams& aRhs) -> LSSimpleRequestParams&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TLSSimpleRequestPreloadedParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedParams()) LSSimpleRequestPreloadedParams((aRhs).get_LSSimpleRequestPreloadedParams());
            break;
        }
    case TLSSimpleRequestGetStateParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateParams()) LSSimpleRequestGetStateParams((aRhs).get_LSSimpleRequestGetStateParams());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto LSSimpleRequestParams::operator=(LSSimpleRequestParams&& aRhs) -> LSSimpleRequestParams&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TLSSimpleRequestPreloadedParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedParams()) LSSimpleRequestPreloadedParams(std::move((aRhs).get_LSSimpleRequestPreloadedParams()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TLSSimpleRequestGetStateParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateParams()) LSSimpleRequestGetStateParams(std::move((aRhs).get_LSSimpleRequestGetStateParams()));
            (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::LSSimpleRequestParams>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::LSSimpleRequestParams union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'LSSimpleRequestParams'
    (aWriter)->WriteSentinel(1494222935);

    switch (type) {
    case union__::TLSSimpleRequestPreloadedParams:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSSimpleRequestPreloadedParams());
            // Sentinel = 'TLSSimpleRequestPreloadedParams'
            (aWriter)->WriteSentinel(3218869307);
            return;
        }
    case union__::TLSSimpleRequestGetStateParams:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSSimpleRequestGetStateParams());
            // Sentinel = 'TLSSimpleRequestGetStateParams'
            (aWriter)->WriteSentinel(3000568780);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union LSSimpleRequestParams");
            return;
        }
    }
}

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

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

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

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TLSSimpleRequestPreloadedParams'
            if ((!((aReader)->ReadSentinel(3218869307)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TLSSimpleRequestPreloadedParams of union LSSimpleRequestParams");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TLSSimpleRequestGetStateParams:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::LSSimpleRequestGetStateParams>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TLSSimpleRequestGetStateParams of union LSSimpleRequestParams");
                return {};

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

} // namespace IPC

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

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

auto ParamTraits<::mozilla::dom::LSItemInfo>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___key = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___key) {
        aReader->FatalError("Error deserializing 'key' (nsString) member of 'LSItemInfo'");
        return {};

    }
    auto& _key = *maybe___key;
    // Sentinel = 'key'
    if ((!((aReader)->ReadSentinel(42402122)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'key' (nsString) member of 'LSItemInfo'");
        return {};
    }
    auto maybe___value = IPC::ReadParam<::mozilla::dom::LSValue>(aReader);
    if (!maybe___value) {
        aReader->FatalError("Error deserializing 'value' (LSValue) member of 'LSItemInfo'");
        return {};

    }
    auto& _value = *maybe___value;
    // Sentinel = 'value'
    if ((!((aReader)->ReadSentinel(107610654)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'value' (LSValue) member of 'LSItemInfo'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_key),
            std::move(_value)};
    return result__;
}

} // namespace IPC
