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


#include "mozilla/ipc/PBackgroundParent.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/dom/PBackgroundLSDatabaseParent.h"
#include "mozilla/dom/PBackgroundLSDatabaseChild.h"
#include "mozilla/dom/PBackgroundLSRequest.h"
#include "mozilla/dom/PBackgroundLSRequestParent.h"
#include "mozilla/dom/PBackgroundLSRequestChild.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 PBackgroundLSRequest {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSRequestParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSRequestChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(
        mozilla::ipc::PrivateIPDLInterface(),
        aParentDestInfo, aChildDestInfo, aParent, aChild);
}
mozilla::UniquePtr<IPC::Message>
Msg_Cancel(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Cancel__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_Finish(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Finish__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___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_Ready(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Ready__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 PBackgroundLSRequest
} // namespace dom
} // namespace mozilla

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

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

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

    }
    auto& _invalidated = *maybe___invalidated;
    // Sentinel = 'invalidated'
    if ((!((aReader)->ReadSentinel(460588166)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'invalidated' (bool) member of 'LSRequestPreloadDatastoreResponse'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_invalidated)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::LSRequestPrepareDatastoreResponse>::Write(
        IPC::MessageWriter* aWriter,
        paramType&& aVar) -> void
{
    IPC::WriteParam(aWriter, std::move((aVar).databaseChildEndpoint()));
    // Sentinel = 'databaseChildEndpoint'
    (aWriter)->WriteSentinel(1520371803);
    IPC::WriteParam(aWriter, (aVar).invalidated());
    // Sentinel = 'invalidated'
    (aWriter)->WriteSentinel(460588166);
}

auto ParamTraits<::mozilla::dom::LSRequestPrepareDatastoreResponse>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___databaseChildEndpoint = IPC::ReadParam<::mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSDatabaseChild>>(aReader);
    if (!maybe___databaseChildEndpoint) {
        aReader->FatalError("Error deserializing 'databaseChildEndpoint' (Endpoint<::mozilla::dom::PBackgroundLSDatabaseChild>) member of 'LSRequestPrepareDatastoreResponse'");
        return {};

    }
    auto& _databaseChildEndpoint = *maybe___databaseChildEndpoint;
    // Sentinel = 'databaseChildEndpoint'
    if ((!((aReader)->ReadSentinel(1520371803)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'databaseChildEndpoint' (Endpoint<::mozilla::dom::PBackgroundLSDatabaseChild>) member of 'LSRequestPrepareDatastoreResponse'");
        return {};
    }
    auto maybe___invalidated = IPC::ReadParam<bool>(aReader);
    if (!maybe___invalidated) {
        aReader->FatalError("Error deserializing 'invalidated' (bool) member of 'LSRequestPrepareDatastoreResponse'");
        return {};

    }
    auto& _invalidated = *maybe___invalidated;
    // Sentinel = 'invalidated'
    if ((!((aReader)->ReadSentinel(460588166)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'invalidated' (bool) member of 'LSRequestPrepareDatastoreResponse'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_databaseChildEndpoint),
            std::move(_invalidated)};
    return result__;
}

} // namespace IPC

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

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

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

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union LSRequestResponse|
//
namespace mozilla {
namespace dom {
auto LSRequestResponse::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case Tnsresult:
        {
            (ptr_nsresult())->~nsresult__tdef();
            break;
        }
    case TLSRequestPreloadDatastoreResponse:
        {
            (ptr_LSRequestPreloadDatastoreResponse())->~LSRequestPreloadDatastoreResponse__tdef();
            break;
        }
    case TLSRequestPrepareDatastoreResponse:
        {
            (ptr_LSRequestPrepareDatastoreResponse())->~LSRequestPrepareDatastoreResponse__tdef();
            break;
        }
    case TLSRequestPrepareObserverResponse:
        {
            (ptr_LSRequestPrepareObserverResponse())->~LSRequestPrepareObserverResponse__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

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

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

MOZ_IMPLICIT LSRequestResponse::LSRequestResponse(const LSRequestPreloadDatastoreResponse& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreResponse()) LSRequestPreloadDatastoreResponse(aOther);
    mType = TLSRequestPreloadDatastoreResponse;
}

MOZ_IMPLICIT LSRequestResponse::LSRequestResponse(LSRequestPreloadDatastoreResponse&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreResponse()) LSRequestPreloadDatastoreResponse(std::move(aOther));
    mType = TLSRequestPreloadDatastoreResponse;
}

MOZ_IMPLICIT LSRequestResponse::LSRequestResponse(LSRequestPrepareDatastoreResponse&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreResponse()) LSRequestPrepareDatastoreResponse(std::move(aOther));
    mType = TLSRequestPrepareDatastoreResponse;
}

MOZ_IMPLICIT LSRequestResponse::LSRequestResponse(const LSRequestPrepareObserverResponse& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverResponse()) LSRequestPrepareObserverResponse(aOther);
    mType = TLSRequestPrepareObserverResponse;
}

MOZ_IMPLICIT LSRequestResponse::LSRequestResponse(LSRequestPrepareObserverResponse&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverResponse()) LSRequestPrepareObserverResponse(std::move(aOther));
    mType = TLSRequestPrepareObserverResponse;
}

MOZ_IMPLICIT LSRequestResponse::LSRequestResponse(LSRequestResponse&& 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 TLSRequestPreloadDatastoreResponse:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreResponse()) LSRequestPreloadDatastoreResponse(std::move((aOther).get_LSRequestPreloadDatastoreResponse()));
            (aOther).MaybeDestroy();
            break;
        }
    case TLSRequestPrepareDatastoreResponse:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreResponse()) LSRequestPrepareDatastoreResponse(std::move((aOther).get_LSRequestPrepareDatastoreResponse()));
            (aOther).MaybeDestroy();
            break;
        }
    case TLSRequestPrepareObserverResponse:
        {
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverResponse()) LSRequestPrepareObserverResponse(std::move((aOther).get_LSRequestPrepareObserverResponse()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

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

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

auto LSRequestResponse::operator=(const LSRequestPreloadDatastoreResponse& aRhs) -> LSRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreResponse()) LSRequestPreloadDatastoreResponse(aRhs);
    mType = TLSRequestPreloadDatastoreResponse;
    return (*(this));
}

auto LSRequestResponse::operator=(LSRequestPreloadDatastoreResponse&& aRhs) -> LSRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreResponse()) LSRequestPreloadDatastoreResponse(std::move(aRhs));
    mType = TLSRequestPreloadDatastoreResponse;
    return (*(this));
}

auto LSRequestResponse::operator=(LSRequestPrepareDatastoreResponse&& aRhs) -> LSRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreResponse()) LSRequestPrepareDatastoreResponse(std::move(aRhs));
    mType = TLSRequestPrepareDatastoreResponse;
    return (*(this));
}

auto LSRequestResponse::operator=(const LSRequestPrepareObserverResponse& aRhs) -> LSRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverResponse()) LSRequestPrepareObserverResponse(aRhs);
    mType = TLSRequestPrepareObserverResponse;
    return (*(this));
}

auto LSRequestResponse::operator=(LSRequestPrepareObserverResponse&& aRhs) -> LSRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverResponse()) LSRequestPrepareObserverResponse(std::move(aRhs));
    mType = TLSRequestPrepareObserverResponse;
    return (*(this));
}

auto LSRequestResponse::operator=(LSRequestResponse&& aRhs) -> LSRequestResponse&
{
    (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 TLSRequestPreloadDatastoreResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPreloadDatastoreResponse()) LSRequestPreloadDatastoreResponse(std::move((aRhs).get_LSRequestPreloadDatastoreResponse()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TLSRequestPrepareDatastoreResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareDatastoreResponse()) LSRequestPrepareDatastoreResponse(std::move((aRhs).get_LSRequestPrepareDatastoreResponse()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TLSRequestPrepareObserverResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSRequestPrepareObserverResponse()) LSRequestPrepareObserverResponse(std::move((aRhs).get_LSRequestPrepareObserverResponse()));
            (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::LSRequestResponse>::Write(
        IPC::MessageWriter* aWriter,
        paramType&& aVar) -> void
{
    typedef ::mozilla::dom::LSRequestResponse union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'LSRequestResponse'
    (aWriter)->WriteSentinel(994641624);

    switch (type) {
    case union__::Tnsresult:
        {
            IPC::WriteParam(aWriter, (aVar).get_nsresult());
            // Sentinel = 'Tnsresult'
            (aWriter)->WriteSentinel(313394133);
            return;
        }
    case union__::TLSRequestPreloadDatastoreResponse:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSRequestPreloadDatastoreResponse());
            // Sentinel = 'TLSRequestPreloadDatastoreResponse'
            (aWriter)->WriteSentinel(3891006874);
            return;
        }
    case union__::TLSRequestPrepareDatastoreResponse:
        {
            IPC::WriteParam(aWriter, std::move((aVar).get_LSRequestPrepareDatastoreResponse()));
            // Sentinel = 'TLSRequestPrepareDatastoreResponse'
            (aWriter)->WriteSentinel(3900509602);
            return;
        }
    case union__::TLSRequestPrepareObserverResponse:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSRequestPrepareObserverResponse());
            // Sentinel = 'TLSRequestPrepareObserverResponse'
            (aWriter)->WriteSentinel(3683454275);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union LSRequestResponse");
            return;
        }
    }
}

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

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

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

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

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

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

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

} // namespace IPC
