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


#include "mozilla/PProcessHangMonitor.h"
#include "mozilla/dom/PContentParent.h"

namespace mozilla {
namespace PProcessHangMonitor {

bool
Open(mozilla::dom::PContentParent* opener)
{
    return mozilla::ipc::Open(mozilla::ipc::PrivateIPDLInterface(), (opener)->GetIPCChannel(), (opener)->OtherPid(), mozilla::ipc::Transport::MODE_SERVER, PProcessHangMonitorMsgStart, PProcessHangMonitorMsgStartChild);
}
nsresult
CreateEndpoints(
        base::ProcessId aParentDestPid,
        base::ProcessId aChildDestPid,
        mozilla::ipc::Endpoint<mozilla::PProcessHangMonitorParent>* aParent,
        mozilla::ipc::Endpoint<mozilla::PProcessHangMonitorChild>* aChild)
{
    return mozilla::ipc::CreateEndpoints(mozilla::ipc::PrivateIPDLInterface(), aParentDestPid, aChildDestPid, PProcessHangMonitorMsgStart, PProcessHangMonitorMsgStartChild, aParent, aChild);
}
bool
Transition(
        mozilla::ipc::Trigger trigger,
        State* next)
{
    State from = (*(next));
    switch (from) {
    case __Null:
    case __Error:
        return (__Null) == (from);
    case __Dead:
        mozilla::ipc::LogicError("__delete__()d actor");
        return false;
    case __Dying:
        mozilla::ipc::LogicError("__delete__()d (and unexpectedly dying) actor");
        return false;
    default:
        mozilla::ipc::LogicError("corrupted actor state");
        return false;
    }
}
IPC::Message*
Msg_HangEvidence(int32_t routingId)
{
    return new IPC::Message(routingId, Msg_HangEvidence__ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PProcessHangMonitor::Msg_HangEvidence");
}
IPC::Message*
Msg_ClearHang(int32_t routingId)
{
    return new IPC::Message(routingId, Msg_ClearHang__ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PProcessHangMonitor::Msg_ClearHang");
}
IPC::Message*
Msg_TerminateScript(int32_t routingId)
{
    return new IPC::Message(routingId, Msg_TerminateScript__ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PProcessHangMonitor::Msg_TerminateScript");
}
IPC::Message*
Msg_BeginStartingDebugger(int32_t routingId)
{
    return new IPC::Message(routingId, Msg_BeginStartingDebugger__ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PProcessHangMonitor::Msg_BeginStartingDebugger");
}
IPC::Message*
Msg_EndStartingDebugger(int32_t routingId)
{
    return new IPC::Message(routingId, Msg_EndStartingDebugger__ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PProcessHangMonitor::Msg_EndStartingDebugger");
}
IPC::Message*
Msg_ForcePaint(int32_t routingId)
{
    return new IPC::Message(routingId, Msg_ForcePaint__ID, IPC::Message::NOT_NESTED, IPC::Message::NORMAL_PRIORITY, IPC::Message::COMPRESSION_NONE, "PProcessHangMonitor::Msg_ForcePaint");
}

} // namespace PProcessHangMonitor
} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct SlowScriptData|
//
namespace mozilla {
MOZ_IMPLICIT SlowScriptData::SlowScriptData() :
    tabId_(),
    filename_(),
    lineno_()
{
    Init();
}

SlowScriptData::~SlowScriptData()
{
}

auto SlowScriptData::operator==(const SlowScriptData& _o) const -> bool
{
    if ((!((tabId()) == ((_o).tabId())))) {
        return false;
    }
    if ((!((filename()) == ((_o).filename())))) {
        return false;
    }
    if ((!((lineno()) == ((_o).lineno())))) {
        return false;
    }
    return true;
}

auto SlowScriptData::Init() -> void
{
}

auto SlowScriptData::Assign(
        const TabId& _tabId,
        const nsCString& _filename,
        const uint32_t& _lineno) -> void
{
    tabId_ = _tabId;
    filename_ = _filename;
    lineno_ = _lineno;
}

} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |struct PluginHangData|
//
namespace mozilla {
MOZ_IMPLICIT PluginHangData::PluginHangData() :
    pluginId_(),
    contentProcessId_()
{
    Init();
}

PluginHangData::~PluginHangData()
{
}

auto PluginHangData::operator==(const PluginHangData& _o) const -> bool
{
    if ((!((pluginId()) == ((_o).pluginId())))) {
        return false;
    }
    if ((!((contentProcessId()) == ((_o).contentProcessId())))) {
        return false;
    }
    return true;
}

auto PluginHangData::Init() -> void
{
}

auto PluginHangData::Assign(
        const uint32_t& _pluginId,
        const ProcessId& _contentProcessId) -> void
{
    pluginId_ = _pluginId;
    contentProcessId_ = _contentProcessId;
}

} // namespace mozilla

//-----------------------------------------------------------------------------
// Method definitions for the IPDL type |union HangData|
//
namespace mozilla {
auto HangData::MaybeDestroy(Type aNewType) -> bool
{
    if ((mType) == (T__None)) {
        return true;
    }
    if ((mType) == (aNewType)) {
        return false;
    }
    switch (mType) {
    case TSlowScriptData:
        {
            (ptr_SlowScriptData())->~SlowScriptData__tdef();
            break;
        }
    case TPluginHangData:
        {
            (ptr_PluginHangData())->~PluginHangData__tdef();
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("not reached");
            break;
        }
    }
    return true;
}

MOZ_IMPLICIT HangData::HangData(const SlowScriptData& aOther)
{
    new (mozilla::KnownNotNull, ptr_SlowScriptData()) SlowScriptData(aOther);
    mType = TSlowScriptData;
}

MOZ_IMPLICIT HangData::HangData(const PluginHangData& aOther)
{
    new (mozilla::KnownNotNull, ptr_PluginHangData()) PluginHangData(aOther);
    mType = TPluginHangData;
}

MOZ_IMPLICIT HangData::HangData(const HangData& aOther)
{
    (aOther).AssertSanity();
    switch ((aOther).type()) {
    case TSlowScriptData:
        {
            new (mozilla::KnownNotNull, ptr_SlowScriptData()) SlowScriptData((aOther).get_SlowScriptData());
            break;
        }
    case TPluginHangData:
        {
            new (mozilla::KnownNotNull, ptr_PluginHangData()) PluginHangData((aOther).get_PluginHangData());
            break;
        }
    case T__None:
        {
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return;
        }
    }
    mType = (aOther).type();
}

HangData::~HangData()
{
    static_cast<void>(MaybeDestroy(T__None));
}

auto HangData::operator=(const SlowScriptData& aRhs) -> HangData&
{
    if (MaybeDestroy(TSlowScriptData)) {
        new (mozilla::KnownNotNull, ptr_SlowScriptData()) SlowScriptData;
    }
    (*(ptr_SlowScriptData())) = aRhs;
    mType = TSlowScriptData;
    return (*(this));
}

auto HangData::operator=(const PluginHangData& aRhs) -> HangData&
{
    if (MaybeDestroy(TPluginHangData)) {
        new (mozilla::KnownNotNull, ptr_PluginHangData()) PluginHangData;
    }
    (*(ptr_PluginHangData())) = aRhs;
    mType = TPluginHangData;
    return (*(this));
}

auto HangData::operator=(const HangData& aRhs) -> HangData&
{
    (aRhs).AssertSanity();
    Type t = (aRhs).type();
    switch (t) {
    case TSlowScriptData:
        {
            if (MaybeDestroy(t)) {
                new (mozilla::KnownNotNull, ptr_SlowScriptData()) SlowScriptData;
            }
            (*(ptr_SlowScriptData())) = (aRhs).get_SlowScriptData();
            break;
        }
    case TPluginHangData:
        {
            if (MaybeDestroy(t)) {
                new (mozilla::KnownNotNull, ptr_PluginHangData()) PluginHangData;
            }
            (*(ptr_PluginHangData())) = (aRhs).get_PluginHangData();
            break;
        }
    case T__None:
        {
            static_cast<void>(MaybeDestroy(t));
            break;
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            break;
        }
    }
    mType = t;
    return (*(this));
}

auto HangData::operator==(const SlowScriptData& aRhs) const -> bool
{
    return (get_SlowScriptData()) == (aRhs);
}

auto HangData::operator==(const PluginHangData& aRhs) const -> bool
{
    return (get_PluginHangData()) == (aRhs);
}

auto HangData::operator==(const HangData& aRhs) const -> bool
{
    if ((type()) != ((aRhs).type())) {
        return false;
    }

    switch (type()) {
    case TSlowScriptData:
        {
            return (get_SlowScriptData()) == ((aRhs).get_SlowScriptData());
        }
    case TPluginHangData:
        {
            return (get_PluginHangData()) == ((aRhs).get_PluginHangData());
        }
    default:
        {
            mozilla::ipc::LogicError("unreached");
            return false;
        }
    }
}

auto HangData::get(SlowScriptData* aOutValue) const -> void
{
    (*(aOutValue)) = get_SlowScriptData();
}

auto HangData::get(PluginHangData* aOutValue) const -> void
{
    (*(aOutValue)) = get_PluginHangData();
}

} // namespace mozilla
