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


#include "mozilla/dom/ServiceWorkerIPCUtils.h"
#include "mozilla/dom/WorkerIPCUtils.h"
#include "mozilla/dom/DomSecurityIPCUtils.h"
#include "mozilla/dom/IPCServiceWorkerDescriptor.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 IPCServiceWorkerDescriptor|
//
namespace mozilla {
namespace dom {
auto IPCServiceWorkerDescriptor::operator==(const IPCServiceWorkerDescriptor& _o) const -> bool
{
    if ((!((id()) == ((_o).id())))) {
        return false;
    }
    if ((!((registrationId()) == ((_o).registrationId())))) {
        return false;
    }
    if ((!((registrationVersion()) == ((_o).registrationVersion())))) {
        return false;
    }
    if ((!((principalInfo()) == ((_o).principalInfo())))) {
        return false;
    }
    if ((!((scope()) == ((_o).scope())))) {
        return false;
    }
    if ((!((type()) == ((_o).type())))) {
        return false;
    }
    if ((!((scriptURL()) == ((_o).scriptURL())))) {
        return false;
    }
    if ((!((state()) == ((_o).state())))) {
        return false;
    }
    if ((!((handlesFetch()) == ((_o).handlesFetch())))) {
        return false;
    }
    return true;
}

auto IPCServiceWorkerDescriptor::operator!=(const IPCServiceWorkerDescriptor& _o) const -> bool
{
    return (!(operator==(_o)));
}

auto IPCServiceWorkerDescriptor::StaticAssertions() const -> void
{
    static_assert(
        (offsetof(IPCServiceWorkerDescriptor, registrationVersion_) - offsetof(IPCServiceWorkerDescriptor, id_)) == 16,
        "Bad assumptions about field layout!");
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::IPCServiceWorkerDescriptor>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).principalInfo());
    // Sentinel = 'principalInfo'
    (aWriter)->WriteSentinel(633472335);
    IPC::WriteParam(aWriter, (aVar).scope());
    // Sentinel = 'scope'
    (aWriter)->WriteSentinel(107086363);
    IPC::WriteParam(aWriter, (aVar).type());
    // Sentinel = 'type'
    (aWriter)->WriteSentinel(75760067);
    IPC::WriteParam(aWriter, (aVar).scriptURL());
    // Sentinel = 'scriptURL'
    (aWriter)->WriteSentinel(313459593);
    IPC::WriteParam(aWriter, (aVar).state());
    // Sentinel = 'state'
    (aWriter)->WriteSentinel(109314594);
    IPC::WriteParam(aWriter, (aVar).handlesFetch());
    // Sentinel = 'handlesFetch'
    (aWriter)->WriteSentinel(523764938);
    (aWriter)->WriteBytes((&((aVar).id())), 24);
    // Sentinel = 'id | registrationId | registrationVersion'
    (aWriter)->WriteSentinel(1199509519);
}

auto ParamTraits<::mozilla::dom::IPCServiceWorkerDescriptor>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    auto maybe___principalInfo = IPC::ReadParam<::mozilla::ipc::PrincipalInfo>(aReader);
    if (!maybe___principalInfo) {
        aReader->FatalError("Error deserializing 'principalInfo' (PrincipalInfo) member of 'IPCServiceWorkerDescriptor'");
        return {};

    }
    auto& _principalInfo = *maybe___principalInfo;
    // Sentinel = 'principalInfo'
    if ((!((aReader)->ReadSentinel(633472335)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'principalInfo' (PrincipalInfo) member of 'IPCServiceWorkerDescriptor'");
        return {};
    }
    auto maybe___scope = IPC::ReadParam<::nsCString>(aReader);
    if (!maybe___scope) {
        aReader->FatalError("Error deserializing 'scope' (nsCString) member of 'IPCServiceWorkerDescriptor'");
        return {};

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

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

    }
    auto& _scriptURL = *maybe___scriptURL;
    // Sentinel = 'scriptURL'
    if ((!((aReader)->ReadSentinel(313459593)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'scriptURL' (nsCString) member of 'IPCServiceWorkerDescriptor'");
        return {};
    }
    auto maybe___state = IPC::ReadParam<::mozilla::dom::ServiceWorkerState>(aReader);
    if (!maybe___state) {
        aReader->FatalError("Error deserializing 'state' (ServiceWorkerState) member of 'IPCServiceWorkerDescriptor'");
        return {};

    }
    auto& _state = *maybe___state;
    // Sentinel = 'state'
    if ((!((aReader)->ReadSentinel(109314594)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'state' (ServiceWorkerState) member of 'IPCServiceWorkerDescriptor'");
        return {};
    }
    auto maybe___handlesFetch = IPC::ReadParam<bool>(aReader);
    if (!maybe___handlesFetch) {
        aReader->FatalError("Error deserializing 'handlesFetch' (bool) member of 'IPCServiceWorkerDescriptor'");
        return {};

    }
    auto& _handlesFetch = *maybe___handlesFetch;
    // Sentinel = 'handlesFetch'
    if ((!((aReader)->ReadSentinel(523764938)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'handlesFetch' (bool) member of 'IPCServiceWorkerDescriptor'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint64_t{0},
            ::uint64_t{0},
            ::uint64_t{0},
            std::move(_principalInfo),
            std::move(_scope),
            std::move(_type),
            std::move(_scriptURL),
            std::move(_state),
            std::move(_handlesFetch)};
    if ((!((aReader)->ReadBytesInto((&((result__)->id())), 24)))) {
        aReader->FatalError("Error bulk reading fields from uint64_t");
        return {};
    }
    // Sentinel = 'id | registrationId | registrationVersion'
    if ((!((aReader)->ReadSentinel(1199509519)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint64_t");
        return {};
    }
    return result__;
}

} // namespace IPC
