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


#include "mozilla/dom/indexedDB/ActorsChild.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryChild.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBDatabaseChild.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryRequest.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryRequestParent.h"
#include "mozilla/dom/indexedDB/PBackgroundIDBFactoryRequestChild.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 PBackgroundIDBFactoryRequest {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::indexedDB::PBackgroundIDBFactoryRequestParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::indexedDB::PBackgroundIDBFactoryRequestChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
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_Blocked(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Blocked__ID, 0, IPC::Message::HeaderFlags(IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, IPC::Message::EAGER_SEND, IPC::Message::NOT_CONSTRUCTOR, IPC::Message::ASYNC, IPC::Message::NOT_REPLY));
}

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

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

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

auto ParamTraits<::mozilla::dom::indexedDB::OpenDatabaseRequestResponse>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___database = IPC::ReadParam<mozilla::NotNull<::mozilla::ipc::SideVariant<::mozilla::dom::indexedDB::PBackgroundIDBDatabaseParent*, ::mozilla::dom::indexedDB::PBackgroundIDBDatabaseChild*>>>(aReader);
    if (!maybe___database) {
        aReader->FatalError("Error deserializing 'database' (NotNull<PBackgroundIDBDatabase>) member of 'OpenDatabaseRequestResponse'");
        return {};

    }
    auto& _database = *maybe___database;
    // Sentinel = 'database'
    if ((!((aReader)->ReadSentinel(241304374)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'database' (NotNull<PBackgroundIDBDatabase>) member of 'OpenDatabaseRequestResponse'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_database)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::indexedDB::DeleteDatabaseRequestResponse>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    (aWriter)->WriteBytes((&((aVar).previousVersion())), 8);
    // Sentinel = 'previousVersion'
    (aWriter)->WriteSentinel(861341284);
}

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

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union FactoryRequestResponse|
//
namespace mozilla {
namespace dom {
namespace indexedDB {
auto FactoryRequestResponse::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case Tnsresult:
        {
            (ptr_nsresult())->~nsresult__tdef();
            break;
        }
    case TOpenDatabaseRequestResponse:
        {
            (ptr_OpenDatabaseRequestResponse())->~OpenDatabaseRequestResponse__tdef();
            break;
        }
    case TDeleteDatabaseRequestResponse:
        {
            (ptr_DeleteDatabaseRequestResponse())->~DeleteDatabaseRequestResponse__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

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

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

MOZ_IMPLICIT FactoryRequestResponse::FactoryRequestResponse(const OpenDatabaseRequestResponse& aOther)
{
    new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestResponse()) OpenDatabaseRequestResponse(aOther);
    mType = TOpenDatabaseRequestResponse;
}

MOZ_IMPLICIT FactoryRequestResponse::FactoryRequestResponse(OpenDatabaseRequestResponse&& aOther)
{
    new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestResponse()) OpenDatabaseRequestResponse(std::move(aOther));
    mType = TOpenDatabaseRequestResponse;
}

MOZ_IMPLICIT FactoryRequestResponse::FactoryRequestResponse(const DeleteDatabaseRequestResponse& aOther)
{
    new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestResponse()) DeleteDatabaseRequestResponse(aOther);
    mType = TDeleteDatabaseRequestResponse;
}

MOZ_IMPLICIT FactoryRequestResponse::FactoryRequestResponse(DeleteDatabaseRequestResponse&& aOther)
{
    new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestResponse()) DeleteDatabaseRequestResponse(std::move(aOther));
    mType = TDeleteDatabaseRequestResponse;
}

MOZ_IMPLICIT FactoryRequestResponse::FactoryRequestResponse(const FactoryRequestResponse& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case Tnsresult:
        {
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aOther).get_nsresult());
            break;
        }
    case TOpenDatabaseRequestResponse:
        {
            new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestResponse()) OpenDatabaseRequestResponse((aOther).get_OpenDatabaseRequestResponse());
            break;
        }
    case TDeleteDatabaseRequestResponse:
        {
            new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestResponse()) DeleteDatabaseRequestResponse((aOther).get_DeleteDatabaseRequestResponse());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT FactoryRequestResponse::FactoryRequestResponse(FactoryRequestResponse&& 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 TOpenDatabaseRequestResponse:
        {
            new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestResponse()) OpenDatabaseRequestResponse(std::move((aOther).get_OpenDatabaseRequestResponse()));
            (aOther).MaybeDestroy();
            break;
        }
    case TDeleteDatabaseRequestResponse:
        {
            new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestResponse()) DeleteDatabaseRequestResponse(std::move((aOther).get_DeleteDatabaseRequestResponse()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

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

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

auto FactoryRequestResponse::operator=(const OpenDatabaseRequestResponse& aRhs) -> FactoryRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestResponse()) OpenDatabaseRequestResponse(aRhs);
    mType = TOpenDatabaseRequestResponse;
    return (*(this));
}

auto FactoryRequestResponse::operator=(OpenDatabaseRequestResponse&& aRhs) -> FactoryRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestResponse()) OpenDatabaseRequestResponse(std::move(aRhs));
    mType = TOpenDatabaseRequestResponse;
    return (*(this));
}

auto FactoryRequestResponse::operator=(const DeleteDatabaseRequestResponse& aRhs) -> FactoryRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestResponse()) DeleteDatabaseRequestResponse(aRhs);
    mType = TDeleteDatabaseRequestResponse;
    return (*(this));
}

auto FactoryRequestResponse::operator=(DeleteDatabaseRequestResponse&& aRhs) -> FactoryRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestResponse()) DeleteDatabaseRequestResponse(std::move(aRhs));
    mType = TDeleteDatabaseRequestResponse;
    return (*(this));
}

auto FactoryRequestResponse::operator=(const FactoryRequestResponse& aRhs) -> FactoryRequestResponse&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case Tnsresult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aRhs).get_nsresult());
            break;
        }
    case TOpenDatabaseRequestResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestResponse()) OpenDatabaseRequestResponse((aRhs).get_OpenDatabaseRequestResponse());
            break;
        }
    case TDeleteDatabaseRequestResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestResponse()) DeleteDatabaseRequestResponse((aRhs).get_DeleteDatabaseRequestResponse());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto FactoryRequestResponse::operator=(FactoryRequestResponse&& aRhs) -> FactoryRequestResponse&
{
    (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 TOpenDatabaseRequestResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_OpenDatabaseRequestResponse()) OpenDatabaseRequestResponse(std::move((aRhs).get_OpenDatabaseRequestResponse()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TDeleteDatabaseRequestResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_DeleteDatabaseRequestResponse()) DeleteDatabaseRequestResponse(std::move((aRhs).get_DeleteDatabaseRequestResponse()));
            (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::FactoryRequestResponse>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::indexedDB::FactoryRequestResponse union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'FactoryRequestResponse'
    (aWriter)->WriteSentinel(1716717841);

    switch (type) {
    case union__::Tnsresult:
        {
            IPC::WriteParam(aWriter, (aVar).get_nsresult());
            // Sentinel = 'Tnsresult'
            (aWriter)->WriteSentinel(313394133);
            return;
        }
    case union__::TOpenDatabaseRequestResponse:
        {
            IPC::WriteParam(aWriter, (aVar).get_OpenDatabaseRequestResponse());
            // Sentinel = 'TOpenDatabaseRequestResponse'
            (aWriter)->WriteSentinel(2646543156);
            return;
        }
    case union__::TDeleteDatabaseRequestResponse:
        {
            IPC::WriteParam(aWriter, (aVar).get_DeleteDatabaseRequestResponse());
            // Sentinel = 'TDeleteDatabaseRequestResponse'
            (aWriter)->WriteSentinel(3015248885);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union FactoryRequestResponse");
            return;
        }
    }
}

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

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

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

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

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

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

} // namespace IPC
