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


#include "mozilla/dom/cache/IPCUtils.h"
#include "mozilla/dom/WorkerIPCUtils.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/ServiceWorkerRegistrarTypes.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"


//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct ServiceWorkerRegistrationData|
//
namespace mozilla {
namespace dom {
auto ServiceWorkerRegistrationData::StaticAssertions() const -> void
{
    static_assert(
        (offsetof(ServiceWorkerRegistrationData, lastUpdateTime_) - offsetof(ServiceWorkerRegistrationData, numberOfAttemptedActivations_)) == 32,
        "Bad assumptions about field layout!");
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::ServiceWorkerRegistrationData>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).isBroken());
    // Sentinel = 'isBroken'
    (aWriter)->WriteSentinel(242221886);
    IPC::WriteParam(aWriter, (aVar).scope());
    // Sentinel = 'scope'
    (aWriter)->WriteSentinel(107086363);
    IPC::WriteParam(aWriter, (aVar).type());
    // Sentinel = 'type'
    (aWriter)->WriteSentinel(75760067);
    IPC::WriteParam(aWriter, (aVar).currentWorkerURL());
    // Sentinel = 'currentWorkerURL'
    (aWriter)->WriteSentinel(955647601);
    IPC::WriteParam(aWriter, (aVar).currentWorkerHandlesFetch());
    // Sentinel = 'currentWorkerHandlesFetch'
    (aWriter)->WriteSentinel(2250312231);
    IPC::WriteParam(aWriter, (aVar).cacheName());
    // Sentinel = 'cacheName'
    (aWriter)->WriteSentinel(289670006);
    IPC::WriteParam(aWriter, (aVar).principal());
    // Sentinel = 'principal'
    (aWriter)->WriteSentinel(319620035);
    IPC::WriteParam(aWriter, (aVar).navigationPreloadState());
    // Sentinel = 'navigationPreloadState'
    (aWriter)->WriteSentinel(1744439545);
    (aWriter)->WriteBytes((&((aVar).numberOfAttemptedActivations())), 40);
    // Sentinel = 'numberOfAttemptedActivations | cacheAPIId | currentWorkerInstalledTime | currentWorkerActivatedTime | lastUpdateTime'
    (aWriter)->WriteSentinel(998124746);
    (aWriter)->WriteBytes((&((aVar).updateViaCache())), 2);
    // Sentinel = 'updateViaCache'
    (aWriter)->WriteSentinel(706348408);
}

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

    }
    auto& _isBroken = *maybe___isBroken;
    // Sentinel = 'isBroken'
    if ((!((aReader)->ReadSentinel(242221886)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'isBroken' (bool) member of 'ServiceWorkerRegistrationData'");
        return {};
    }
    auto maybe___scope = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___scope) {
        aReader->FatalError("Error deserializing 'scope' (nsCString) member of 'ServiceWorkerRegistrationData'");
        return {};

    }
    auto& _scope = *maybe___scope;
    // Sentinel = 'scope'
    if ((!((aReader)->ReadSentinel(107086363)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'scope' (nsCString) member of 'ServiceWorkerRegistrationData'");
        return {};
    }
    auto maybe___type = IPC::ReadParam<::mozilla::dom::WorkerType>(aReader);
    if (!maybe___type) {
        aReader->FatalError("Error deserializing 'type' (WorkerType) member of 'ServiceWorkerRegistrationData'");
        return {};

    }
    auto& _type = *maybe___type;
    // Sentinel = 'type'
    if ((!((aReader)->ReadSentinel(75760067)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'type' (WorkerType) member of 'ServiceWorkerRegistrationData'");
        return {};
    }
    auto maybe___currentWorkerURL = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___currentWorkerURL) {
        aReader->FatalError("Error deserializing 'currentWorkerURL' (nsCString) member of 'ServiceWorkerRegistrationData'");
        return {};

    }
    auto& _currentWorkerURL = *maybe___currentWorkerURL;
    // Sentinel = 'currentWorkerURL'
    if ((!((aReader)->ReadSentinel(955647601)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'currentWorkerURL' (nsCString) member of 'ServiceWorkerRegistrationData'");
        return {};
    }
    auto maybe___currentWorkerHandlesFetch = IPC::ReadParam<bool>(aReader);
    if (!maybe___currentWorkerHandlesFetch) {
        aReader->FatalError("Error deserializing 'currentWorkerHandlesFetch' (bool) member of 'ServiceWorkerRegistrationData'");
        return {};

    }
    auto& _currentWorkerHandlesFetch = *maybe___currentWorkerHandlesFetch;
    // Sentinel = 'currentWorkerHandlesFetch'
    if ((!((aReader)->ReadSentinel(2250312231)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'currentWorkerHandlesFetch' (bool) member of 'ServiceWorkerRegistrationData'");
        return {};
    }
    auto maybe___cacheName = IPC::ReadParam<::nsString>(aReader);
    if (!maybe___cacheName) {
        aReader->FatalError("Error deserializing 'cacheName' (nsString) member of 'ServiceWorkerRegistrationData'");
        return {};

    }
    auto& _cacheName = *maybe___cacheName;
    // Sentinel = 'cacheName'
    if ((!((aReader)->ReadSentinel(289670006)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'cacheName' (nsString) member of 'ServiceWorkerRegistrationData'");
        return {};
    }
    auto maybe___principal = IPC::ReadParam<::mozilla::ipc::PrincipalInfo>(aReader);
    if (!maybe___principal) {
        aReader->FatalError("Error deserializing 'principal' (PrincipalInfo) member of 'ServiceWorkerRegistrationData'");
        return {};

    }
    auto& _principal = *maybe___principal;
    // Sentinel = 'principal'
    if ((!((aReader)->ReadSentinel(319620035)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'principal' (PrincipalInfo) member of 'ServiceWorkerRegistrationData'");
        return {};
    }
    auto maybe___navigationPreloadState = IPC::ReadParam<::mozilla::dom::IPCNavigationPreloadState>(aReader);
    if (!maybe___navigationPreloadState) {
        aReader->FatalError("Error deserializing 'navigationPreloadState' (IPCNavigationPreloadState) member of 'ServiceWorkerRegistrationData'");
        return {};

    }
    auto& _navigationPreloadState = *maybe___navigationPreloadState;
    // Sentinel = 'navigationPreloadState'
    if ((!((aReader)->ReadSentinel(1744439545)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'navigationPreloadState' (IPCNavigationPreloadState) member of 'ServiceWorkerRegistrationData'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::int64_t{0},
            std::move(_isBroken),
            ::int64_t{0},
            std::move(_scope),
            std::move(_type),
            std::move(_currentWorkerURL),
            std::move(_currentWorkerHandlesFetch),
            std::move(_cacheName),
            std::move(_principal),
            ::uint16_t{0},
            ::int64_t{0},
            ::int64_t{0},
            ::int64_t{0},
            std::move(_navigationPreloadState)};
    if ((!((aReader)->ReadBytesInto((&((result__)->numberOfAttemptedActivations())), 40)))) {
        aReader->FatalError("Error bulk reading fields from int64_t");
        return {};
    }
    // Sentinel = 'numberOfAttemptedActivations | cacheAPIId | currentWorkerInstalledTime | currentWorkerActivatedTime | lastUpdateTime'
    if ((!((aReader)->ReadSentinel(998124746)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from int64_t");
        return {};
    }
    if ((!((aReader)->ReadBytesInto((&((result__)->updateViaCache())), 2)))) {
        aReader->FatalError("Error bulk reading fields from uint16_t");
        return {};
    }
    // Sentinel = 'updateViaCache'
    if ((!((aReader)->ReadSentinel(706348408)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint16_t");
        return {};
    }
    return result__;
}

} // namespace IPC
