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


#include "mozilla/dom/quota/SerializationHelpers.h"
#include "mozilla/dom/indexedDB/ActorsChild.h"
#include "mozilla/ipc/PBackgroundParent.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseChild.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryRequestParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryRequestChild.h"
#include "mozilla/dom/indexedDB/SerializationHelpers.h"
#include "mozilla/dom/quota/SerializationHelpers.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactory.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.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 dom {
namespace indexedDB {
namespace PBackgroundIDBFactory {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::indexedDB::PBackgroundIDBFactoryParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::indexedDB::PBackgroundIDBFactoryChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_DeleteMe(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_DeleteMe__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_PBackgroundIDBFactoryRequestConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_PBackgroundIDBFactoryRequestConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_PBackgroundIDBFactoryRequestConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_PBackgroundIDBFactoryRequestConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_GetDatabases(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_GetDatabases__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>
Reply_GetDatabases(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_GetDatabases__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::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg___delete__(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg___delete____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>
Reply___delete__(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply___delete____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::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_PBackgroundIDBDatabaseConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_PBackgroundIDBDatabaseConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_PBackgroundIDBDatabaseConstructor(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_PBackgroundIDBDatabaseConstructor__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::REPLY));
}

} // namespace PBackgroundIDBFactory
} // namespace indexedDB
} // namespace dom
} // namespace mozilla

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

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

auto ParamTraits<::mozilla::dom::indexedDB::CommonFactoryRequestParams>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___metadata = IPC::ReadParam<::mozilla::dom::indexedDB::DatabaseMetadata>(aReader);
    if (!maybe___metadata) {
        aReader->FatalError("Error deserializing 'metadata' (DatabaseMetadata) member of 'CommonFactoryRequestParams'");
        return {};

    }
    auto& _metadata = *maybe___metadata;
    // Sentinel = 'metadata'
    if ((!((aReader)->ReadSentinel(248251202)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'metadata' (DatabaseMetadata) member of 'CommonFactoryRequestParams'");
        return {};
    }
    auto maybe___principalInfo = IPC::ReadParam<::mozilla::ipc::PrincipalInfo>(aReader);
    if (!maybe___principalInfo) {
        aReader->FatalError("Error deserializing 'principalInfo' (PrincipalInfo) member of 'CommonFactoryRequestParams'");
        return {};

    }
    auto& _principalInfo = *maybe___principalInfo;
    // Sentinel = 'principalInfo'
    if ((!((aReader)->ReadSentinel(633472335)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'principalInfo' (PrincipalInfo) member of 'CommonFactoryRequestParams'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_metadata),
            std::move(_principalInfo)};
    return result__;
}

} // namespace IPC

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

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

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

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

} // namespace IPC

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

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

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

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

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union FactoryRequestParams|
//
namespace mozilla {
namespace dom {
namespace indexedDB {
auto FactoryRequestParams::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TOpenDatabaseRequestParams:
        {
            (ptr_OpenDatabaseRequestParams())->~OpenDatabaseRequestParams__tdef();
            break;
        }
    case TDeleteDatabaseRequestParams:
        {
            (ptr_DeleteDatabaseRequestParams())->~DeleteDatabaseRequestParams__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT FactoryRequestParams::FactoryRequestParams(const OpenDatabaseRequestParams& aOther)
{
    new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestParams()) OpenDatabaseRequestParams(aOther);
    mType = TOpenDatabaseRequestParams;
}

MOZ_IMPLICIT FactoryRequestParams::FactoryRequestParams(OpenDatabaseRequestParams&& aOther)
{
    new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestParams()) OpenDatabaseRequestParams(std::move(aOther));
    mType = TOpenDatabaseRequestParams;
}

MOZ_IMPLICIT FactoryRequestParams::FactoryRequestParams(const DeleteDatabaseRequestParams& aOther)
{
    new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestParams()) DeleteDatabaseRequestParams(aOther);
    mType = TDeleteDatabaseRequestParams;
}

MOZ_IMPLICIT FactoryRequestParams::FactoryRequestParams(DeleteDatabaseRequestParams&& aOther)
{
    new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestParams()) DeleteDatabaseRequestParams(std::move(aOther));
    mType = TDeleteDatabaseRequestParams;
}

MOZ_IMPLICIT FactoryRequestParams::FactoryRequestParams(const FactoryRequestParams& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TOpenDatabaseRequestParams:
        {
            new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestParams()) OpenDatabaseRequestParams((aOther).get_OpenDatabaseRequestParams());
            break;
        }
    case TDeleteDatabaseRequestParams:
        {
            new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestParams()) DeleteDatabaseRequestParams((aOther).get_DeleteDatabaseRequestParams());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT FactoryRequestParams::FactoryRequestParams(FactoryRequestParams&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TOpenDatabaseRequestParams:
        {
            new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestParams()) OpenDatabaseRequestParams(std::move((aOther).get_OpenDatabaseRequestParams()));
            (aOther).MaybeDestroy();
            break;
        }
    case TDeleteDatabaseRequestParams:
        {
            new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestParams()) DeleteDatabaseRequestParams(std::move((aOther).get_DeleteDatabaseRequestParams()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto FactoryRequestParams::operator=(const OpenDatabaseRequestParams& aRhs) -> FactoryRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestParams()) OpenDatabaseRequestParams(aRhs);
    mType = TOpenDatabaseRequestParams;
    return (*(this));
}

auto FactoryRequestParams::operator=(OpenDatabaseRequestParams&& aRhs) -> FactoryRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestParams()) OpenDatabaseRequestParams(std::move(aRhs));
    mType = TOpenDatabaseRequestParams;
    return (*(this));
}

auto FactoryRequestParams::operator=(const DeleteDatabaseRequestParams& aRhs) -> FactoryRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestParams()) DeleteDatabaseRequestParams(aRhs);
    mType = TDeleteDatabaseRequestParams;
    return (*(this));
}

auto FactoryRequestParams::operator=(DeleteDatabaseRequestParams&& aRhs) -> FactoryRequestParams&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestParams()) DeleteDatabaseRequestParams(std::move(aRhs));
    mType = TDeleteDatabaseRequestParams;
    return (*(this));
}

auto FactoryRequestParams::operator=(const FactoryRequestParams& aRhs) -> FactoryRequestParams&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TOpenDatabaseRequestParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestParams()) OpenDatabaseRequestParams((aRhs).get_OpenDatabaseRequestParams());
            break;
        }
    case TDeleteDatabaseRequestParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestParams()) DeleteDatabaseRequestParams((aRhs).get_DeleteDatabaseRequestParams());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto FactoryRequestParams::operator=(FactoryRequestParams&& aRhs) -> FactoryRequestParams&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TOpenDatabaseRequestParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestParams()) OpenDatabaseRequestParams(std::move((aRhs).get_OpenDatabaseRequestParams()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TDeleteDatabaseRequestParams:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestParams()) DeleteDatabaseRequestParams(std::move((aRhs).get_DeleteDatabaseRequestParams()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace indexedDB
} // namespace dom
} // namespace mozilla

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

    switch (type) {
    case union__::TOpenDatabaseRequestParams:
        {
            IPC::WriteParam(aWriter, (aVar).get_OpenDatabaseRequestParams());
            // Sentinel = 'TOpenDatabaseRequestParams'
            (aWriter)->WriteSentinel(2272004681);
            return;
        }
    case union__::TDeleteDatabaseRequestParams:
        {
            IPC::WriteParam(aWriter, (aVar).get_DeleteDatabaseRequestParams());
            // Sentinel = 'TDeleteDatabaseRequestParams'
            (aWriter)->WriteSentinel(2615413514);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union FactoryRequestParams");
            return;
        }
    }
}

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

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

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

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'TOpenDatabaseRequestParams'
            if ((!((aReader)->ReadSentinel(2272004681)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant TOpenDatabaseRequestParams of union FactoryRequestParams");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TDeleteDatabaseRequestParams:
        {
            auto maybe__tmp = IPC::ReadParam<::mozilla::dom::indexedDB::DeleteDatabaseRequestParams>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TDeleteDatabaseRequestParams of union FactoryRequestParams");
                return {};

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

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union GetDatabasesResponse|
//
namespace mozilla {
namespace dom {
namespace indexedDB {
auto GetDatabasesResponse::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case Tnsresult:
        {
            (ptr_nsresult())->~nsresult__tdef();
            break;
        }
    case TArrayOfDatabaseMetadata:
        {
            (ptr_ArrayOfDatabaseMetadata())->~ArrayOfDatabaseMetadata__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT GetDatabasesResponse::GetDatabasesResponse(const nsresult& aOther)
{
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(aOther);
    mType = Tnsresult;
}

MOZ_IMPLICIT GetDatabasesResponse::GetDatabasesResponse(nsresult&& aOther)
{
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move(aOther));
    mType = Tnsresult;
}

MOZ_IMPLICIT GetDatabasesResponse::GetDatabasesResponse(const nsTArray<DatabaseMetadata>& aOther)
{
    new (mozilla::KnownNotNull, ptr_ArrayOfDatabaseMetadata()) nsTArray<DatabaseMetadata>((aOther).Clone());
    mType = TArrayOfDatabaseMetadata;
}

MOZ_IMPLICIT GetDatabasesResponse::GetDatabasesResponse(nsTArray<DatabaseMetadata>&& aOther)
{
    new (mozilla::KnownNotNull, ptr_ArrayOfDatabaseMetadata()) nsTArray<DatabaseMetadata>(std::move(aOther));
    mType = TArrayOfDatabaseMetadata;
}

MOZ_IMPLICIT GetDatabasesResponse::GetDatabasesResponse(const GetDatabasesResponse& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case Tnsresult:
        {
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aOther).get_nsresult());
            break;
        }
    case TArrayOfDatabaseMetadata:
        {
            new (mozilla::KnownNotNull, ptr_ArrayOfDatabaseMetadata()) nsTArray<DatabaseMetadata>(((aOther).get_ArrayOfDatabaseMetadata()).Clone());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT GetDatabasesResponse::GetDatabasesResponse(GetDatabasesResponse&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case Tnsresult:
        {
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move((aOther).get_nsresult()));
            (aOther).MaybeDestroy();
            break;
        }
    case TArrayOfDatabaseMetadata:
        {
            new (mozilla::KnownNotNull, ptr_ArrayOfDatabaseMetadata()) nsTArray<DatabaseMetadata>(std::move((aOther).get_ArrayOfDatabaseMetadata()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto GetDatabasesResponse::operator=(const nsresult& aRhs) -> GetDatabasesResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(aRhs);
    mType = Tnsresult;
    return (*(this));
}

auto GetDatabasesResponse::operator=(nsresult&& aRhs) -> GetDatabasesResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move(aRhs));
    mType = Tnsresult;
    return (*(this));
}

auto GetDatabasesResponse::operator=(const nsTArray<DatabaseMetadata>& aRhs) -> GetDatabasesResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_ArrayOfDatabaseMetadata()) nsTArray<DatabaseMetadata>((aRhs).Clone());
    mType = TArrayOfDatabaseMetadata;
    return (*(this));
}

auto GetDatabasesResponse::operator=(nsTArray<DatabaseMetadata>&& aRhs) -> GetDatabasesResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_ArrayOfDatabaseMetadata()) nsTArray<DatabaseMetadata>(std::move(aRhs));
    mType = TArrayOfDatabaseMetadata;
    return (*(this));
}

auto GetDatabasesResponse::operator=(const GetDatabasesResponse& aRhs) -> GetDatabasesResponse&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case Tnsresult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aRhs).get_nsresult());
            break;
        }
    case TArrayOfDatabaseMetadata:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_ArrayOfDatabaseMetadata()) nsTArray<DatabaseMetadata>(((aRhs).get_ArrayOfDatabaseMetadata()).Clone());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto GetDatabasesResponse::operator=(GetDatabasesResponse&& aRhs) -> GetDatabasesResponse&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case Tnsresult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult(std::move((aRhs).get_nsresult()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TArrayOfDatabaseMetadata:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_ArrayOfDatabaseMetadata()) nsTArray<DatabaseMetadata>(std::move((aRhs).get_ArrayOfDatabaseMetadata()));
            (aRhs).MaybeDestroy();
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    (aRhs).mType = T__None;
    mType = t;
    return (*(this));
}

} // namespace indexedDB
} // namespace dom
} // namespace mozilla

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

    switch (type) {
    case union__::Tnsresult:
        {
            IPC::WriteParam(aWriter, (aVar).get_nsresult());
            // Sentinel = 'Tnsresult'
            (aWriter)->WriteSentinel(313394133);
            return;
        }
    case union__::TArrayOfDatabaseMetadata:
        {
            IPC::WriteParam(aWriter, (aVar).get_ArrayOfDatabaseMetadata());
            // Sentinel = 'TArrayOfDatabaseMetadata'
            (aWriter)->WriteSentinel(1906182463);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union GetDatabasesResponse");
            return;
        }
    }
}

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

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

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

            }
            auto& tmp = *maybe__tmp;
            // Sentinel = 'Tnsresult'
            if ((!((aReader)->ReadSentinel(313394133)))) {
                mozilla::ipc::SentinelReadError("Error deserializing variant Tnsresult of union GetDatabasesResponse");
                return {};
            }
            return std::move(tmp);
        }
    case union__::TArrayOfDatabaseMetadata:
        {
            auto maybe__tmp = IPC::ReadParam<nsTArray<::mozilla::dom::indexedDB::DatabaseMetadata>>(aReader);
            if (!maybe__tmp) {
                aReader->FatalError("Error deserializing variant TArrayOfDatabaseMetadata of union GetDatabasesResponse");
                return {};

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

} // namespace IPC
