RemoteInspectorDebuggable.cpp [plain text]
#include "config.h"
#include "RemoteInspectorDebuggable.h"
#if ENABLE(REMOTE_INSPECTOR)
#include "EventLoop.h"
#include "InspectorFrontendChannel.h"
#include "RemoteInspector.h"
namespace Inspector {
RemoteInspectorDebuggable::RemoteInspectorDebuggable()
: m_identifier(0)
, m_allowed(false)
{
}
RemoteInspectorDebuggable::~RemoteInspectorDebuggable()
{
RemoteInspector::singleton().unregisterDebuggable(this);
}
void RemoteInspectorDebuggable::init()
{
RemoteInspector::singleton().registerDebuggable(this);
}
void RemoteInspectorDebuggable::update()
{
RemoteInspector::singleton().updateDebuggable(this);
}
void RemoteInspectorDebuggable::setRemoteDebuggingAllowed(bool allowed)
{
if (m_allowed == allowed)
return;
m_allowed = allowed;
if (m_allowed && automaticInspectionAllowed())
RemoteInspector::singleton().updateDebuggableAutomaticInspectCandidate(this);
else
RemoteInspector::singleton().updateDebuggable(this);
}
RemoteInspectorDebuggableInfo RemoteInspectorDebuggable::info() const
{
RemoteInspectorDebuggableInfo info;
info.identifier = identifier();
info.type = type();
info.name = name();
info.url = url();
info.hasLocalDebugger = hasLocalDebugger();
info.remoteDebuggingAllowed = remoteDebuggingAllowed();
return info;
}
void RemoteInspectorDebuggable::pauseWaitingForAutomaticInspection()
{
ASSERT(m_identifier);
ASSERT(m_allowed);
ASSERT(automaticInspectionAllowed());
EventLoop loop;
while (RemoteInspector::singleton().waitingForAutomaticInspection(identifier()) && !loop.ended())
loop.cycle();
}
void RemoteInspectorDebuggable::unpauseForInitializedInspector()
{
RemoteInspector::singleton().setupCompleted(identifier());
}
}
#endif // ENABLE(REMOTE_INSPECTOR)