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


#include "mozilla/ipc/PBackgroundParent.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/dom/localstorage/SerializationHelpers.h"
#include "mozilla/dom/PBackgroundLSSimpleRequest.h"
#include "mozilla/dom/PBackgroundLSSimpleRequestParent.h"
#include "mozilla/dom/PBackgroundLSSimpleRequestChild.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 PBackgroundLSSimpleRequest {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSSimpleRequestParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundLSSimpleRequestChild>* 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));
}

} // namespace PBackgroundLSSimpleRequest
} // namespace dom
} // namespace mozilla

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

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

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

    }
    auto& _preloaded = *maybe___preloaded;
    // Sentinel = 'preloaded'
    if ((!((aReader)->ReadSentinel(316474289)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'preloaded' (bool) member of 'LSSimpleRequestPreloadedResponse'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_preloaded)};
    return result__;
}

} // namespace IPC

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

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

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

    }
    auto& _itemInfos = *maybe___itemInfos;
    // Sentinel = 'itemInfos'
    if ((!((aReader)->ReadSentinel(307430319)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'itemInfos' (LSItemInfo[]) member of 'LSSimpleRequestGetStateResponse'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_itemInfos)};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union LSSimpleRequestResponse|
//
namespace mozilla {
namespace dom {
auto LSSimpleRequestResponse::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case Tnsresult:
        {
            (ptr_nsresult())->~nsresult__tdef();
            break;
        }
    case TLSSimpleRequestPreloadedResponse:
        {
            (ptr_LSSimpleRequestPreloadedResponse())->~LSSimpleRequestPreloadedResponse__tdef();
            break;
        }
    case TLSSimpleRequestGetStateResponse:
        {
            (ptr_LSSimpleRequestGetStateResponse())->~LSSimpleRequestGetStateResponse__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

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

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

MOZ_IMPLICIT LSSimpleRequestResponse::LSSimpleRequestResponse(const LSSimpleRequestPreloadedResponse& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedResponse()) LSSimpleRequestPreloadedResponse(aOther);
    mType = TLSSimpleRequestPreloadedResponse;
}

MOZ_IMPLICIT LSSimpleRequestResponse::LSSimpleRequestResponse(LSSimpleRequestPreloadedResponse&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedResponse()) LSSimpleRequestPreloadedResponse(std::move(aOther));
    mType = TLSSimpleRequestPreloadedResponse;
}

MOZ_IMPLICIT LSSimpleRequestResponse::LSSimpleRequestResponse(const LSSimpleRequestGetStateResponse& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateResponse()) LSSimpleRequestGetStateResponse(aOther);
    mType = TLSSimpleRequestGetStateResponse;
}

MOZ_IMPLICIT LSSimpleRequestResponse::LSSimpleRequestResponse(LSSimpleRequestGetStateResponse&& aOther)
{
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateResponse()) LSSimpleRequestGetStateResponse(std::move(aOther));
    mType = TLSSimpleRequestGetStateResponse;
}

MOZ_IMPLICIT LSSimpleRequestResponse::LSSimpleRequestResponse(const LSSimpleRequestResponse& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case Tnsresult:
        {
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aOther).get_nsresult());
            break;
        }
    case TLSSimpleRequestPreloadedResponse:
        {
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedResponse()) LSSimpleRequestPreloadedResponse((aOther).get_LSSimpleRequestPreloadedResponse());
            break;
        }
    case TLSSimpleRequestGetStateResponse:
        {
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateResponse()) LSSimpleRequestGetStateResponse((aOther).get_LSSimpleRequestGetStateResponse());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT LSSimpleRequestResponse::LSSimpleRequestResponse(LSSimpleRequestResponse&& 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 TLSSimpleRequestPreloadedResponse:
        {
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedResponse()) LSSimpleRequestPreloadedResponse(std::move((aOther).get_LSSimpleRequestPreloadedResponse()));
            (aOther).MaybeDestroy();
            break;
        }
    case TLSSimpleRequestGetStateResponse:
        {
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateResponse()) LSSimpleRequestGetStateResponse(std::move((aOther).get_LSSimpleRequestGetStateResponse()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

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

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

auto LSSimpleRequestResponse::operator=(const LSSimpleRequestPreloadedResponse& aRhs) -> LSSimpleRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedResponse()) LSSimpleRequestPreloadedResponse(aRhs);
    mType = TLSSimpleRequestPreloadedResponse;
    return (*(this));
}

auto LSSimpleRequestResponse::operator=(LSSimpleRequestPreloadedResponse&& aRhs) -> LSSimpleRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedResponse()) LSSimpleRequestPreloadedResponse(std::move(aRhs));
    mType = TLSSimpleRequestPreloadedResponse;
    return (*(this));
}

auto LSSimpleRequestResponse::operator=(const LSSimpleRequestGetStateResponse& aRhs) -> LSSimpleRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateResponse()) LSSimpleRequestGetStateResponse(aRhs);
    mType = TLSSimpleRequestGetStateResponse;
    return (*(this));
}

auto LSSimpleRequestResponse::operator=(LSSimpleRequestGetStateResponse&& aRhs) -> LSSimpleRequestResponse&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateResponse()) LSSimpleRequestGetStateResponse(std::move(aRhs));
    mType = TLSSimpleRequestGetStateResponse;
    return (*(this));
}

auto LSSimpleRequestResponse::operator=(const LSSimpleRequestResponse& aRhs) -> LSSimpleRequestResponse&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case Tnsresult:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_nsresult()) nsresult((aRhs).get_nsresult());
            break;
        }
    case TLSSimpleRequestPreloadedResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedResponse()) LSSimpleRequestPreloadedResponse((aRhs).get_LSSimpleRequestPreloadedResponse());
            break;
        }
    case TLSSimpleRequestGetStateResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateResponse()) LSSimpleRequestGetStateResponse((aRhs).get_LSSimpleRequestGetStateResponse());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto LSSimpleRequestResponse::operator=(LSSimpleRequestResponse&& aRhs) -> LSSimpleRequestResponse&
{
    (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 TLSSimpleRequestPreloadedResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestPreloadedResponse()) LSSimpleRequestPreloadedResponse(std::move((aRhs).get_LSSimpleRequestPreloadedResponse()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TLSSimpleRequestGetStateResponse:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_LSSimpleRequestGetStateResponse()) LSSimpleRequestGetStateResponse(std::move((aRhs).get_LSSimpleRequestGetStateResponse()));
            (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::LSSimpleRequestResponse>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::LSSimpleRequestResponse union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'LSSimpleRequestResponse'
    (aWriter)->WriteSentinel(1803487554);

    switch (type) {
    case union__::Tnsresult:
        {
            IPC::WriteParam(aWriter, (aVar).get_nsresult());
            // Sentinel = 'Tnsresult'
            (aWriter)->WriteSentinel(313394133);
            return;
        }
    case union__::TLSSimpleRequestPreloadedResponse:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSSimpleRequestPreloadedResponse());
            // Sentinel = 'TLSSimpleRequestPreloadedResponse'
            (aWriter)->WriteSentinel(3658681638);
            return;
        }
    case union__::TLSSimpleRequestGetStateResponse:
        {
            IPC::WriteParam(aWriter, (aVar).get_LSSimpleRequestGetStateResponse());
            // Sentinel = 'TLSSimpleRequestGetStateResponse'
            (aWriter)->WriteSentinel(3425832119);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union LSSimpleRequestResponse");
            return;
        }
    }
}

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

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

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

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

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

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

} // namespace IPC
