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


#include "mozilla/dom/GamepadMessageUtils.h"
#include "mozilla/dom/GamepadEventTypes.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 GamepadAdded|
//
namespace mozilla {
namespace dom {
auto GamepadAdded::StaticAssertions() const -> void
{
    static_assert(
        (offsetof(GamepadAdded, num_touches_) - offsetof(GamepadAdded, num_buttons_)) == 16,
        "Bad assumptions about field layout!");
}

} // namespace dom
} // namespace mozilla

namespace IPC {
auto ParamTraits<::mozilla::dom::GamepadAdded>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).id());
    // Sentinel = 'id'
    (aWriter)->WriteSentinel(20447438);
    IPC::WriteParam(aWriter, (aVar).mapping());
    // Sentinel = 'mapping'
    (aWriter)->WriteSentinel(196477677);
    IPC::WriteParam(aWriter, (aVar).hand());
    // Sentinel = 'hand'
    (aWriter)->WriteSentinel(67568028);
    (aWriter)->WriteBytes((&((aVar).num_buttons())), 20);
    // Sentinel = 'num_buttons | num_axes | num_haptics | num_lights | num_touches'
    (aWriter)->WriteSentinel(315431054);
}

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

    }
    auto& _id = *maybe___id;
    // Sentinel = 'id'
    if ((!((aReader)->ReadSentinel(20447438)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'id' (nsString) member of 'GamepadAdded'");
        return {};
    }
    auto maybe___mapping = IPC::ReadParam<::mozilla::dom::GamepadMappingType>(aReader);
    if (!maybe___mapping) {
        aReader->FatalError("Error deserializing 'mapping' (GamepadMappingType) member of 'GamepadAdded'");
        return {};

    }
    auto& _mapping = *maybe___mapping;
    // Sentinel = 'mapping'
    if ((!((aReader)->ReadSentinel(196477677)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'mapping' (GamepadMappingType) member of 'GamepadAdded'");
        return {};
    }
    auto maybe___hand = IPC::ReadParam<::mozilla::dom::GamepadHand>(aReader);
    if (!maybe___hand) {
        aReader->FatalError("Error deserializing 'hand' (GamepadHand) member of 'GamepadAdded'");
        return {};

    }
    auto& _hand = *maybe___hand;
    // Sentinel = 'hand'
    if ((!((aReader)->ReadSentinel(67568028)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'hand' (GamepadHand) member of 'GamepadAdded'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_id),
            std::move(_mapping),
            std::move(_hand),
            ::uint32_t{0},
            ::uint32_t{0},
            ::uint32_t{0},
            ::uint32_t{0},
            ::uint32_t{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->num_buttons())), 20)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'num_buttons | num_axes | num_haptics | num_lights | num_touches'
    if ((!((aReader)->ReadSentinel(315431054)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

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

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

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::GamepadAxisInformation>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    (aWriter)->WriteBytes((&((aVar).value())), 8);
    // Sentinel = 'value'
    (aWriter)->WriteSentinel(107610654);
    (aWriter)->WriteBytes((&((aVar).axis())), 4);
    // Sentinel = 'axis'
    (aWriter)->WriteSentinel(70582710);
}

auto ParamTraits<::mozilla::dom::GamepadAxisInformation>::Read(IPC::MessageReader* aReader) -> IPC::ReadResult<paramType>
{
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint32_t{0},
            double{0}};
    if ((!((aReader)->ReadBytesInto((&((result__)->value())), 8)))) {
        aReader->FatalError("Error bulk reading fields from double");
        return {};
    }
    // Sentinel = 'value'
    if ((!((aReader)->ReadSentinel(107610654)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from double");
        return {};
    }
    if ((!((aReader)->ReadBytesInto((&((result__)->axis())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'axis'
    if ((!((aReader)->ReadSentinel(70582710)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::GamepadButtonInformation>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).pressed());
    // Sentinel = 'pressed'
    (aWriter)->WriteSentinel(202310391);
    IPC::WriteParam(aWriter, (aVar).touched());
    // Sentinel = 'touched'
    (aWriter)->WriteSentinel(201851629);
    (aWriter)->WriteBytes((&((aVar).value())), 8);
    // Sentinel = 'value'
    (aWriter)->WriteSentinel(107610654);
    (aWriter)->WriteBytes((&((aVar).button())), 4);
    // Sentinel = 'button'
    (aWriter)->WriteSentinel(152240797);
}

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

    }
    auto& _pressed = *maybe___pressed;
    // Sentinel = 'pressed'
    if ((!((aReader)->ReadSentinel(202310391)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'pressed' (bool) member of 'GamepadButtonInformation'");
        return {};
    }
    auto maybe___touched = IPC::ReadParam<bool>(aReader);
    if (!maybe___touched) {
        aReader->FatalError("Error deserializing 'touched' (bool) member of 'GamepadButtonInformation'");
        return {};

    }
    auto& _touched = *maybe___touched;
    // Sentinel = 'touched'
    if ((!((aReader)->ReadSentinel(201851629)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'touched' (bool) member of 'GamepadButtonInformation'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint32_t{0},
            double{0},
            std::move(_pressed),
            std::move(_touched)};
    if ((!((aReader)->ReadBytesInto((&((result__)->value())), 8)))) {
        aReader->FatalError("Error bulk reading fields from double");
        return {};
    }
    // Sentinel = 'value'
    if ((!((aReader)->ReadSentinel(107610654)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from double");
        return {};
    }
    if ((!((aReader)->ReadBytesInto((&((result__)->button())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'button'
    if ((!((aReader)->ReadSentinel(152240797)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

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

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

    }
    auto& _pose_state = *maybe___pose_state;
    // Sentinel = 'pose_state'
    if ((!((aReader)->ReadSentinel(392496184)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'pose_state' (GamepadPoseState) member of 'GamepadPoseInformation'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_pose_state)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::GamepadLightIndicatorTypeInformation>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).type());
    // Sentinel = 'type'
    (aWriter)->WriteSentinel(75760067);
    (aWriter)->WriteBytes((&((aVar).light())), 4);
    // Sentinel = 'light'
    (aWriter)->WriteSentinel(104727065);
}

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

    }
    auto& _type = *maybe___type;
    // Sentinel = 'type'
    if ((!((aReader)->ReadSentinel(75760067)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'type' (GamepadLightIndicatorType) member of 'GamepadLightIndicatorTypeInformation'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint32_t{0},
            std::move(_type)};
    if ((!((aReader)->ReadBytesInto((&((result__)->light())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'light'
    if ((!((aReader)->ReadSentinel(104727065)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

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

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

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

    }
    auto& _hand = *maybe___hand;
    // Sentinel = 'hand'
    if ((!((aReader)->ReadSentinel(67568028)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'hand' (GamepadHand) member of 'GamepadHandInformation'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_hand)};
    return result__;
}

} // namespace IPC

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

namespace IPC {
auto ParamTraits<::mozilla::dom::GamepadTouchInformation>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    IPC::WriteParam(aWriter, (aVar).touch_state());
    // Sentinel = 'touch_state'
    (aWriter)->WriteSentinel(472056996);
    (aWriter)->WriteBytes((&((aVar).index())), 4);
    // Sentinel = 'index'
    (aWriter)->WriteSentinel(104333849);
}

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

    }
    auto& _touch_state = *maybe___touch_state;
    // Sentinel = 'touch_state'
    if ((!((aReader)->ReadSentinel(472056996)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'touch_state' (GamepadTouchState) member of 'GamepadTouchInformation'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            ::uint32_t{0},
            std::move(_touch_state)};
    if ((!((aReader)->ReadBytesInto((&((result__)->index())), 4)))) {
        aReader->FatalError("Error bulk reading fields from uint32_t");
        return {};
    }
    // Sentinel = 'index'
    if ((!((aReader)->ReadSentinel(104333849)))) {
        mozilla::ipc::SentinelReadError("Error bulk reading fields from uint32_t");
        return {};
    }
    return result__;
}

} // namespace IPC

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union GamepadChangeEventBody|
//
namespace mozilla {
namespace dom {
auto GamepadChangeEventBody::MaybeDestroy() -> void
{
    if ((mType) == (T__None)) {
        return;
    }
    switch (mType) {
    case TGamepadAdded:
        {
            (ptr_GamepadAdded())->~GamepadAdded__tdef();
            break;
        }
    case TGamepadRemoved:
        {
            (ptr_GamepadRemoved())->~GamepadRemoved__tdef();
            break;
        }
    case TGamepadAxisInformation:
        {
            (ptr_GamepadAxisInformation())->~GamepadAxisInformation__tdef();
            break;
        }
    case TGamepadButtonInformation:
        {
            (ptr_GamepadButtonInformation())->~GamepadButtonInformation__tdef();
            break;
        }
    case TGamepadHandInformation:
        {
            (ptr_GamepadHandInformation())->~GamepadHandInformation__tdef();
            break;
        }
    case TGamepadLightIndicatorTypeInformation:
        {
            (ptr_GamepadLightIndicatorTypeInformation())->~GamepadLightIndicatorTypeInformation__tdef();
            break;
        }
    case TGamepadPoseInformation:
        {
            (ptr_GamepadPoseInformation())->~GamepadPoseInformation__tdef();
            break;
        }
    case TGamepadTouchInformation:
        {
            (ptr_GamepadTouchInformation())->~GamepadTouchInformation__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadAdded& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadAdded()) GamepadAdded(aOther);
    mType = TGamepadAdded;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadAdded&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadAdded()) GamepadAdded(std::move(aOther));
    mType = TGamepadAdded;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadRemoved& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadRemoved()) GamepadRemoved(aOther);
    mType = TGamepadRemoved;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadRemoved&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadRemoved()) GamepadRemoved(std::move(aOther));
    mType = TGamepadRemoved;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadAxisInformation& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadAxisInformation()) GamepadAxisInformation(aOther);
    mType = TGamepadAxisInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadAxisInformation&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadAxisInformation()) GamepadAxisInformation(std::move(aOther));
    mType = TGamepadAxisInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadButtonInformation& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadButtonInformation()) GamepadButtonInformation(aOther);
    mType = TGamepadButtonInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadButtonInformation&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadButtonInformation()) GamepadButtonInformation(std::move(aOther));
    mType = TGamepadButtonInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadHandInformation& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadHandInformation()) GamepadHandInformation(aOther);
    mType = TGamepadHandInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadHandInformation&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadHandInformation()) GamepadHandInformation(std::move(aOther));
    mType = TGamepadHandInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadLightIndicatorTypeInformation& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadLightIndicatorTypeInformation()) GamepadLightIndicatorTypeInformation(aOther);
    mType = TGamepadLightIndicatorTypeInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadLightIndicatorTypeInformation&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadLightIndicatorTypeInformation()) GamepadLightIndicatorTypeInformation(std::move(aOther));
    mType = TGamepadLightIndicatorTypeInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadPoseInformation& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadPoseInformation()) GamepadPoseInformation(aOther);
    mType = TGamepadPoseInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadPoseInformation&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadPoseInformation()) GamepadPoseInformation(std::move(aOther));
    mType = TGamepadPoseInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadTouchInformation& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadTouchInformation()) GamepadTouchInformation(aOther);
    mType = TGamepadTouchInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadTouchInformation&& aOther)
{
    new (mozilla::KnownNotNull, ptr_GamepadTouchInformation()) GamepadTouchInformation(std::move(aOther));
    mType = TGamepadTouchInformation;
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(const GamepadChangeEventBody& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TGamepadAdded:
        {
            new (mozilla::KnownNotNull, ptr_GamepadAdded()) GamepadAdded((aOther).get_GamepadAdded());
            break;
        }
    case TGamepadRemoved:
        {
            new (mozilla::KnownNotNull, ptr_GamepadRemoved()) GamepadRemoved((aOther).get_GamepadRemoved());
            break;
        }
    case TGamepadAxisInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadAxisInformation()) GamepadAxisInformation((aOther).get_GamepadAxisInformation());
            break;
        }
    case TGamepadButtonInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadButtonInformation()) GamepadButtonInformation((aOther).get_GamepadButtonInformation());
            break;
        }
    case TGamepadHandInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadHandInformation()) GamepadHandInformation((aOther).get_GamepadHandInformation());
            break;
        }
    case TGamepadLightIndicatorTypeInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadLightIndicatorTypeInformation()) GamepadLightIndicatorTypeInformation((aOther).get_GamepadLightIndicatorTypeInformation());
            break;
        }
    case TGamepadPoseInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadPoseInformation()) GamepadPoseInformation((aOther).get_GamepadPoseInformation());
            break;
        }
    case TGamepadTouchInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadTouchInformation()) GamepadTouchInformation((aOther).get_GamepadTouchInformation());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

MOZ_IMPLICIT GamepadChangeEventBody::GamepadChangeEventBody(GamepadChangeEventBody&& aOther)
{
    (aOther).AssertSanity();
    Type t = (aOther).type();
    switch (t) {
    case TGamepadAdded:
        {
            new (mozilla::KnownNotNull, ptr_GamepadAdded()) GamepadAdded(std::move((aOther).get_GamepadAdded()));
            (aOther).MaybeDestroy();
            break;
        }
    case TGamepadRemoved:
        {
            new (mozilla::KnownNotNull, ptr_GamepadRemoved()) GamepadRemoved(std::move((aOther).get_GamepadRemoved()));
            (aOther).MaybeDestroy();
            break;
        }
    case TGamepadAxisInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadAxisInformation()) GamepadAxisInformation(std::move((aOther).get_GamepadAxisInformation()));
            (aOther).MaybeDestroy();
            break;
        }
    case TGamepadButtonInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadButtonInformation()) GamepadButtonInformation(std::move((aOther).get_GamepadButtonInformation()));
            (aOther).MaybeDestroy();
            break;
        }
    case TGamepadHandInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadHandInformation()) GamepadHandInformation(std::move((aOther).get_GamepadHandInformation()));
            (aOther).MaybeDestroy();
            break;
        }
    case TGamepadLightIndicatorTypeInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadLightIndicatorTypeInformation()) GamepadLightIndicatorTypeInformation(std::move((aOther).get_GamepadLightIndicatorTypeInformation()));
            (aOther).MaybeDestroy();
            break;
        }
    case TGamepadPoseInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadPoseInformation()) GamepadPoseInformation(std::move((aOther).get_GamepadPoseInformation()));
            (aOther).MaybeDestroy();
            break;
        }
    case TGamepadTouchInformation:
        {
            new (mozilla::KnownNotNull, ptr_GamepadTouchInformation()) GamepadTouchInformation(std::move((aOther).get_GamepadTouchInformation()));
            (aOther).MaybeDestroy();
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    (aOther).mType = T__None;
    mType = t;
}

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

auto GamepadChangeEventBody::operator=(const GamepadAdded& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadAdded()) GamepadAdded(aRhs);
    mType = TGamepadAdded;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadAdded&& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadAdded()) GamepadAdded(std::move(aRhs));
    mType = TGamepadAdded;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(const GamepadRemoved& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadRemoved()) GamepadRemoved(aRhs);
    mType = TGamepadRemoved;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadRemoved&& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadRemoved()) GamepadRemoved(std::move(aRhs));
    mType = TGamepadRemoved;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(const GamepadAxisInformation& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadAxisInformation()) GamepadAxisInformation(aRhs);
    mType = TGamepadAxisInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadAxisInformation&& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadAxisInformation()) GamepadAxisInformation(std::move(aRhs));
    mType = TGamepadAxisInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(const GamepadButtonInformation& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadButtonInformation()) GamepadButtonInformation(aRhs);
    mType = TGamepadButtonInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadButtonInformation&& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadButtonInformation()) GamepadButtonInformation(std::move(aRhs));
    mType = TGamepadButtonInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(const GamepadHandInformation& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadHandInformation()) GamepadHandInformation(aRhs);
    mType = TGamepadHandInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadHandInformation&& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadHandInformation()) GamepadHandInformation(std::move(aRhs));
    mType = TGamepadHandInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(const GamepadLightIndicatorTypeInformation& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadLightIndicatorTypeInformation()) GamepadLightIndicatorTypeInformation(aRhs);
    mType = TGamepadLightIndicatorTypeInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadLightIndicatorTypeInformation&& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadLightIndicatorTypeInformation()) GamepadLightIndicatorTypeInformation(std::move(aRhs));
    mType = TGamepadLightIndicatorTypeInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(const GamepadPoseInformation& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadPoseInformation()) GamepadPoseInformation(aRhs);
    mType = TGamepadPoseInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadPoseInformation&& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadPoseInformation()) GamepadPoseInformation(std::move(aRhs));
    mType = TGamepadPoseInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(const GamepadTouchInformation& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadTouchInformation()) GamepadTouchInformation(aRhs);
    mType = TGamepadTouchInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadTouchInformation&& aRhs) -> GamepadChangeEventBody&
{
    MaybeDestroy();
    new (mozilla::KnownNotNull, ptr_GamepadTouchInformation()) GamepadTouchInformation(std::move(aRhs));
    mType = TGamepadTouchInformation;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(const GamepadChangeEventBody& aRhs) -> GamepadChangeEventBody&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TGamepadAdded:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadAdded()) GamepadAdded((aRhs).get_GamepadAdded());
            break;
        }
    case TGamepadRemoved:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadRemoved()) GamepadRemoved((aRhs).get_GamepadRemoved());
            break;
        }
    case TGamepadAxisInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadAxisInformation()) GamepadAxisInformation((aRhs).get_GamepadAxisInformation());
            break;
        }
    case TGamepadButtonInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadButtonInformation()) GamepadButtonInformation((aRhs).get_GamepadButtonInformation());
            break;
        }
    case TGamepadHandInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadHandInformation()) GamepadHandInformation((aRhs).get_GamepadHandInformation());
            break;
        }
    case TGamepadLightIndicatorTypeInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadLightIndicatorTypeInformation()) GamepadLightIndicatorTypeInformation((aRhs).get_GamepadLightIndicatorTypeInformation());
            break;
        }
    case TGamepadPoseInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadPoseInformation()) GamepadPoseInformation((aRhs).get_GamepadPoseInformation());
            break;
        }
    case TGamepadTouchInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadTouchInformation()) GamepadTouchInformation((aRhs).get_GamepadTouchInformation());
            break;
        }
    case T__None:
        {
            MaybeDestroy();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto GamepadChangeEventBody::operator=(GamepadChangeEventBody&& aRhs) -> GamepadChangeEventBody&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TGamepadAdded:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadAdded()) GamepadAdded(std::move((aRhs).get_GamepadAdded()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TGamepadRemoved:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadRemoved()) GamepadRemoved(std::move((aRhs).get_GamepadRemoved()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TGamepadAxisInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadAxisInformation()) GamepadAxisInformation(std::move((aRhs).get_GamepadAxisInformation()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TGamepadButtonInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadButtonInformation()) GamepadButtonInformation(std::move((aRhs).get_GamepadButtonInformation()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TGamepadHandInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadHandInformation()) GamepadHandInformation(std::move((aRhs).get_GamepadHandInformation()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TGamepadLightIndicatorTypeInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadLightIndicatorTypeInformation()) GamepadLightIndicatorTypeInformation(std::move((aRhs).get_GamepadLightIndicatorTypeInformation()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TGamepadPoseInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadPoseInformation()) GamepadPoseInformation(std::move((aRhs).get_GamepadPoseInformation()));
            (aRhs).MaybeDestroy();
            break;
        }
    case TGamepadTouchInformation:
        {
            MaybeDestroy();
            new (mozilla::KnownNotNull, ptr_GamepadTouchInformation()) GamepadTouchInformation(std::move((aRhs).get_GamepadTouchInformation()));
            (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::GamepadChangeEventBody>::Write(
        IPC::MessageWriter* aWriter,
        const paramType& aVar) -> void
{
    typedef ::mozilla::dom::GamepadChangeEventBody union__;
    int type = (aVar).type();
    IPC::WriteParam(aWriter, type);
    // Sentinel = 'GamepadChangeEventBody'
    (aWriter)->WriteSentinel(1612187782);

    switch (type) {
    case union__::TGamepadAdded:
        {
            IPC::WriteParam(aWriter, (aVar).get_GamepadAdded());
            // Sentinel = 'TGamepadAdded'
            (aWriter)->WriteSentinel(558695638);
            return;
        }
    case union__::TGamepadRemoved:
        {
            IPC::WriteParam(aWriter, (aVar).get_GamepadRemoved());
            // Sentinel = 'TGamepadRemoved'
            (aWriter)->WriteSentinel(758056406);
            return;
        }
    case union__::TGamepadAxisInformation:
        {
            IPC::WriteParam(aWriter, (aVar).get_GamepadAxisInformation());
            // Sentinel = 'TGamepadAxisInformation'
            (aWriter)->WriteSentinel(1774389535);
            return;
        }
    case union__::TGamepadButtonInformation:
        {
            IPC::WriteParam(aWriter, (aVar).get_GamepadButtonInformation());
            // Sentinel = 'TGamepadButtonInformation'
            (aWriter)->WriteSentinel(2119436806);
            return;
        }
    case union__::TGamepadHandInformation:
        {
            IPC::WriteParam(aWriter, (aVar).get_GamepadHandInformation());
            // Sentinel = 'TGamepadHandInformation'
            (aWriter)->WriteSentinel(1752631557);
            return;
        }
    case union__::TGamepadLightIndicatorTypeInformation:
        {
            IPC::WriteParam(aWriter, (aVar).get_GamepadLightIndicatorTypeInformation());
            // Sentinel = 'TGamepadLightIndicatorTypeInformation'
            (aWriter)->WriteSentinel(289803969);
            return;
        }
    case union__::TGamepadPoseInformation:
        {
            IPC::WriteParam(aWriter, (aVar).get_GamepadPoseInformation());
            // Sentinel = 'TGamepadPoseInformation'
            (aWriter)->WriteSentinel(1778387233);
            return;
        }
    case union__::TGamepadTouchInformation:
        {
            IPC::WriteParam(aWriter, (aVar).get_GamepadTouchInformation());
            // Sentinel = 'TGamepadTouchInformation'
            (aWriter)->WriteSentinel(1941768589);
            return;
        }
    default:
        {
            aWriter->FatalError("unknown variant of union GamepadChangeEventBody");
            return;
        }
    }
}

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

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

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

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

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

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

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

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

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

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

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

} // namespace IPC

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

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

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

    }
    auto& _handle = *maybe___handle;
    // Sentinel = 'handle'
    if ((!((aReader)->ReadSentinel(142344813)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'handle' (GamepadHandle) member of 'GamepadChangeEvent'");
        return {};
    }
    auto maybe___body = IPC::ReadParam<::mozilla::dom::GamepadChangeEventBody>(aReader);
    if (!maybe___body) {
        aReader->FatalError("Error deserializing 'body' (GamepadChangeEventBody) member of 'GamepadChangeEvent'");
        return {};

    }
    auto& _body = *maybe___body;
    // Sentinel = 'body'
    if ((!((aReader)->ReadSentinel(68813231)))) {
        mozilla::ipc::SentinelReadError("Error deserializing 'body' (GamepadChangeEventBody) member of 'GamepadChangeEvent'");
        return {};
    }
    IPC::ReadResult<paramType> result__{
            std::in_place,
            std::move(_handle),
            std::move(_body)};
    return result__;
}

} // namespace IPC
