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


#include "mozilla/ipc/PBackgroundParent.h"
#include "mozilla/ipc/PBackgroundChild.h"
#include "mozilla/dom/PBackgroundSessionStorageManagerParent.h"
#include "mozilla/dom/PBackgroundSessionStorageManagerChild.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/PBackgroundSessionStorageCache.h"
#include "mozilla/dom/PBackgroundSessionStorageCacheParent.h"
#include "mozilla/dom/PBackgroundSessionStorageCacheChild.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 PBackgroundSessionStorageCache {

nsresult
CreateEndpoints(
        mozilla::ipc::EndpointProcInfo aParentDestInfo,
        mozilla::ipc::EndpointProcInfo aChildDestInfo,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundSessionStorageCacheParent>* aParent,
        mozilla::ipc::Endpoint<::mozilla::dom::PBackgroundSessionStorageCacheChild>* 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_Load(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Load__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::SYNC, IPC::Message::NOT_REPLY));
}
mozilla::UniquePtr<IPC::Message>
Reply_Load(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Reply_Load__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::SYNC, IPC::Message::REPLY));
}
mozilla::UniquePtr<IPC::Message>
Msg_Checkpoint(IPC::Message::routeid_t routingId)
{
    return IPC::Message::IPDLMessage(routingId, Msg_Checkpoint__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));
}

} // namespace PBackgroundSessionStorageCache
} // namespace dom
} // namespace mozilla

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

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

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

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

} // namespace IPC

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

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

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

    }
    auto& _key = *maybe___key;
    // Sentinel = 'key'
    if ((!((aReader)->ReadSentinel(42402122)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'key' (nsString) member of 'SSRemoveItemInfo'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_key)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::SSClearInfo>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
}

auto ParamTraits<::mozilla::dom::SSClearInfo>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    IPC::ReadResult<paramType> result__{std::in_place};
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union SSWriteInfo|
//
namespace mozilla {
namespace dom {
auto SSWriteInfo::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TSSSetItemInfo:
        {
            (ptr_SSSetItemInfo())->~SSSetItemInfo__tdef();
            break;
        }
    case TSSRemoveItemInfo:
        {
            (ptr_SSRemoveItemInfo())->~SSRemoveItemInfo__tdef();
            break;
        }
    case TSSClearInfo:
        {
            (ptr_SSClearInfo())->~SSClearInfo__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT SSWriteInfo::SSWriteInfo(const SSSetItemInfo& aOther)
{
    new (mozilla::KnownNotNull, ptr_SSSetItemInfo()) SSSetItemInfo(aOther);
    mType = TSSSetItemInfo;
}

MOZ_IMPLICIT SSWriteInfo::SSWriteInfo(SSSetItemInfo&& aOther)
{
    new (mozilla::KnownNotNull, ptr_SSSetItemInfo()) SSSetItemInfo(std::move(aOther));
    mType = TSSSetItemInfo;
}

MOZ_IMPLICIT SSWriteInfo::SSWriteInfo(const SSRemoveItemInfo& aOther)
{
    new (mozilla::KnownNotNull, ptr_SSRemoveItemInfo()) SSRemoveItemInfo(aOther);
    mType = TSSRemoveItemInfo;
}

MOZ_IMPLICIT SSWriteInfo::SSWriteInfo(SSRemoveItemInfo&& aOther)
{
    new (mozilla::KnownNotNull, ptr_SSRemoveItemInfo()) SSRemoveItemInfo(std::move(aOther));
    mType = TSSRemoveItemInfo;
}

MOZ_IMPLICIT SSWriteInfo::SSWriteInfo(const SSClearInfo& aOther)
{
    new (mozilla::KnownNotNull, ptr_SSClearInfo()) SSClearInfo(aOther);
    mType = TSSClearInfo;
}

MOZ_IMPLICIT SSWriteInfo::SSWriteInfo(SSClearInfo&& aOther)
{
    new (mozilla::KnownNotNull, ptr_SSClearInfo()) SSClearInfo(std::move(aOther));
    mType = TSSClearInfo;
}

MOZ_IMPLICIT SSWriteInfo::SSWriteInfo(const SSWriteInfo& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TSSSetItemInfo:
        {
            new (mozilla::KnownNotNull, ptr_SSSetItemInfo()) SSSetItemInfo((aOther).get_SSSetItemInfo());
            break;
        }
    case TSSRemoveItemInfo:
        {
            new (mozilla::KnownNotNull, ptr_SSRemoveItemInfo()) SSRemoveItemInfo((aOther).get_SSRemoveItemInfo());
            break;
        }
    case TSSClearInfo:
        {
            new (mozilla::KnownNotNull, ptr_SSClearInfo()) SSClearInfo((aOther).get_SSClearInfo());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT SSWriteInfo::SSWriteInfo(SSWriteInfo&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TSSSetItemInfo:
        {
            new (mozilla::KnownNotNull, ptr_SSSetItemInfo()) SSSetItemInfo(std::move((aOther).get_SSSetItemInfo()));
            (aOther).MaybeDestroy();
            break;
        }
    case TSSRemoveItemInfo:
        {
            new (mozilla::KnownNotNull, ptr_SSRemoveItemInfo()) SSRemoveItemInfo(std::move((aOther).get_SSRemoveItemInfo()));
            (aOther).MaybeDestroy();
            break;
        }
    case TSSClearInfo:
        {
            new (mozilla::KnownNotNull, ptr_SSClearInfo()) SSClearInfo(std::move((aOther).get_SSClearInfo()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto SSWriteInfo::operator=(const SSSetItemInfo& aRhs) -> SSWriteInfo&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_SSSetItemInfo()) SSSetItemInfo(aRhs);
    mType = TSSSetItemInfo;
    return (*(this));
}

auto SSWriteInfo::operator=(SSSetItemInfo&& aRhs) -> SSWriteInfo&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_SSSetItemInfo()) SSSetItemInfo(std::move(aRhs));
    mType = TSSSetItemInfo;
    return (*(this));
}

auto SSWriteInfo::operator=(const SSRemoveItemInfo& aRhs) -> SSWriteInfo&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_SSRemoveItemInfo()) SSRemoveItemInfo(aRhs);
    mType = TSSRemoveItemInfo;
    return (*(this));
}

auto SSWriteInfo::operator=(SSRemoveItemInfo&& aRhs) -> SSWriteInfo&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_SSRemoveItemInfo()) SSRemoveItemInfo(std::move(aRhs));
    mType = TSSRemoveItemInfo;
    return (*(this));
}

auto SSWriteInfo::operator=(const SSClearInfo& aRhs) -> SSWriteInfo&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_SSClearInfo()) SSClearInfo(aRhs);
    mType = TSSClearInfo;
    return (*(this));
}

auto SSWriteInfo::operator=(SSClearInfo&& aRhs) -> SSWriteInfo&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_SSClearInfo()) SSClearInfo(std::move(aRhs));
    mType = TSSClearInfo;
    return (*(this));
}

auto SSWriteInfo::operator=(const SSWriteInfo& aRhs) -> SSWriteInfo&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TSSSetItemInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_SSSetItemInfo()) SSSetItemInfo((aRhs).get_SSSetItemInfo());
            break;
        }
    case TSSRemoveItemInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_SSRemoveItemInfo()) SSRemoveItemInfo((aRhs).get_SSRemoveItemInfo());
            break;
        }
    case TSSClearInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_SSClearInfo()) SSClearInfo((aRhs).get_SSClearInfo());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto SSWriteInfo::operator=(SSWriteInfo&& aRhs) -> SSWriteInfo&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TSSSetItemInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_SSSetItemInfo()) SSSetItemInfo(std::move((aRhs).get_SSSetItemInfo()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TSSRemoveItemInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_SSRemoveItemInfo()) SSRemoveItemInfo(std::move((aRhs).get_SSRemoveItemInfo()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TSSClearInfo:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_SSClearInfo()) SSClearInfo(std::move((aRhs).get_SSClearInfo()));
            (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::SSWriteInfo>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::SSWriteInfo union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'SSWriteInfo'
    (aWriter)->WriteSentinel(414319678);

    switch (type) {
    case union__::TSSSetItemInfo:
        {
            IPC::WriteParam(aWriter, (aVar).get_SSSetItemInfo());
            // Sentinel = 'TSSSetItemInfo'
            (aWriter)->WriteSentinel(636749122);
            return;
        }
    case union__::TSSRemoveItemInfo:
        {
            IPC::WriteParam(aWriter, (aVar).get_SSRemoveItemInfo());
            // Sentinel = 'TSSRemoveItemInfo'
            (aWriter)->WriteSentinel(955582084);
            return;
        }
    case union__::TSSClearInfo:
        {
            IPC::WriteParam(aWriter, (aVar).get_SSClearInfo());
            // Sentinel = 'TSSClearInfo'
            (aWriter)->WriteSentinel(460457070);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union SSWriteInfo");
            return;
        }
    }
}

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

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

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

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

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

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

} // namespace IPC

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

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

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

    }
    auto& _originKey = *maybe___originKey;
    // Sentinel = 'originKey'
    if ((!((aReader)->ReadSentinel(313656242)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'originKey' (nsCString) member of 'SSCacheCopy'");
        return {};
    }
    auto maybe___principalInfo = IPC::ReadParam<::mozilla::ipc::PrincipalInfo>(aReader);
    if (!maybe___principalInfo) {
        aReader->FatalError("Error deserializing 'principalInfo' (PrincipalInfo) member of 'SSCacheCopy'");
        return {};

    }
    auto& _principalInfo = *maybe___principalInfo;
    // Sentinel = 'principalInfo'
    if ((!((aReader)->ReadSentinel(633472335)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'principalInfo' (PrincipalInfo) member of 'SSCacheCopy'");
        return {};
    }
    auto maybe___data = IPC::ReadParam<nsTArray<::mozilla::dom::SSSetItemInfo>>(aReader);
    if (!maybe___data) {
        aReader->FatalError("Error deserializing 'data' (SSSetItemInfo[]) member of 'SSCacheCopy'");
        return {};

    }
    auto& _data = *maybe___data;
    // Sentinel = 'data'
    if ((!((aReader)->ReadSentinel(67109275)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'data' (SSSetItemInfo[]) member of 'SSCacheCopy'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_originKey),
            std::move(_principalInfo),
            std::move(_data)};
    return result__;
}

} // namespace IPC
