#include "config.h"
#include "Breakpoint.h"
#include "Debugger.h"
namespace JSC {
Breakpoint::Action::Action(Breakpoint::Action::Type type)
: type(type)
{
}
Ref<Breakpoint> Breakpoint::create(BreakpointID id, const String& condition, ActionsVector&& actions, bool autoContinue, size_t ignoreCount)
{
return adoptRef(*new Breakpoint(id, condition, WTFMove(actions), autoContinue, ignoreCount));
}
Breakpoint::Breakpoint(BreakpointID id, String condition, ActionsVector&& actions, bool autoContinue, size_t ignoreCount)
: m_id(id)
, m_condition(condition)
, m_actions(WTFMove(actions))
, m_autoContinue(autoContinue)
, m_ignoreCount(ignoreCount)
{
}
bool Breakpoint::link(SourceID sourceID, unsigned lineNumber, unsigned columnNumber)
{
ASSERT(!isLinked());
ASSERT(!isResolved());
m_sourceID = sourceID;
m_lineNumber = lineNumber;
m_columnNumber = columnNumber;
return isLinked();
}
bool Breakpoint::resolve(unsigned lineNumber, unsigned columnNumber)
{
ASSERT(isLinked());
ASSERT(!isResolved());
ASSERT(lineNumber >= m_lineNumber);
ASSERT(columnNumber >= m_columnNumber);
m_lineNumber = lineNumber;
m_columnNumber = columnNumber;
m_resolved = true;
return isResolved();
}
bool Breakpoint::shouldPause(Debugger& debugger, JSGlobalObject* globalObject)
{
if (!debugger.evaluateBreakpointCondition(*this, globalObject))
return false;
return ++m_hitCount > m_ignoreCount;
}
}