#include <replay/NondeterministicInput.h>
#include <wtf/CurrentTime.h>
+namespace JSC {
+class InputCursor;
+};
+
namespace WebCore {
class ReplayController;
-struct ReplayPosition {
+// This is an RAII helper used during capturing which sets a flag on the input cursor
+// to track the dynamic extent of a captured event loop input. This extent approximates
+// the interval in which EventLoopInputDispatcher::dispatching() is true.
+class EventLoopInputExtent {
+ WTF_MAKE_NONCOPYABLE(EventLoopInputExtent);
public:
- ReplayPosition()
- : m_index(0)
- , m_time(0.0) { }
-
- explicit ReplayPosition(unsigned index)
- : m_index(index)
- , m_time(monotonicallyIncreasingTime()) { }
-
- unsigned index() const { return m_index; }
- double time() const { return m_time; }
+ EventLoopInputExtent(JSC::InputCursor&);
+ EventLoopInputExtent(JSC::InputCursor*);
+ ~EventLoopInputExtent();
private:
- unsigned m_index;
- double m_time;
+ JSC::InputCursor* m_cursor;
};
class EventLoopInputBase : public NondeterministicInputBase {
public:
- EventLoopInputBase()
- : m_position(ReplayPosition()) { }
-
virtual ~EventLoopInputBase() { }
virtual InputQueue queue() const override final { return InputQueue::EventLoopInput; }
virtual void dispatch(ReplayController&) = 0;
-
- // During capture, the position is set when the following event loop input is captured.
- void setPosition(const ReplayPosition& position) { m_position = position; }
- ReplayPosition position() const { return m_position; }
-protected:
- ReplayPosition m_position;
};
template <typename InputType>