Ejemplo n.º 1
0
NO_SANITIZE_ADDRESS
void TimerBase::runInternal() {
  if (!canFire())
    return;

  m_weakPtrFactory.revokeAll();

  TRACE_EVENT0("blink", "TimerBase::run");
#if DCHECK_IS_ON()
  DCHECK_EQ(m_thread, currentThread())
      << "Timer posted by " << m_location.function_name() << " "
      << m_location.file_name() << " was run on a different thread";
#endif

  if (m_repeatInterval) {
    double now = timerMonotonicallyIncreasingTime();
    // This computation should be drift free, and it will cope if we miss a
    // beat, which can easily happen if the thread is busy.  It will also cope
    // if we get called slightly before m_unalignedNextFireTime, which can
    // happen due to lack of timer precision.
    double intervalToNextFireTime =
        m_repeatInterval - fmod(now - m_nextFireTime, m_repeatInterval);
    setNextFireTime(timerMonotonicallyIncreasingTime(), intervalToNextFireTime);
  } else {
    m_nextFireTime = 0;
  }
  fired();
}
Ejemplo n.º 2
0
void TimerBase::start(double nextFireInterval, double repeatInterval)
{
    ASSERT(m_thread == currentThread());

    m_repeatInterval = repeatInterval;
    setNextFireTime(currentTime() + nextFireInterval);
}
Ejemplo n.º 3
0
void TimerBase::start(double nextFireInterval, double repeatInterval)
{
    ASSERT(m_thread == currentThread() || (isMainThread() || pthread_main_np()) && WebCoreWebThreadIsLockedOrDisabled());

    m_repeatInterval = repeatInterval;
    setNextFireTime(currentTime() + nextFireInterval);
}
Ejemplo n.º 4
0
void TimerBase::start(double nextFireInterval, double repeatInterval)
{
    ASSERT(canAccessThreadLocalDataForThread(m_thread));

    m_repeatInterval = repeatInterval;
    setNextFireTime(monotonicallyIncreasingTime() + nextFireInterval);
}
Ejemplo n.º 5
0
void TimerBase::start(double nextFireInterval, double repeatInterval, const WebTraceLocation& caller)
{
    ASSERT(m_thread == currentThread());

    m_location = caller;
    m_repeatInterval = repeatInterval;
    setNextFireTime(monotonicallyIncreasingTime(), nextFireInterval);
}
Ejemplo n.º 6
0
void TimerBase::stop()
{
    m_repeatInterval = 0;
    setNextFireTime(0);

    ASSERT(m_nextFireTime == 0);
    ASSERT(m_repeatInterval == 0);
    ASSERT(!inHeap());
}
Ejemplo n.º 7
0
void TimerBase::stop()
{
    ASSERT(m_thread == currentThread());

    m_repeatInterval = 0;
    setNextFireTime(0);

    ASSERT(m_nextFireTime == 0);
    ASSERT(m_repeatInterval == 0);
    ASSERT(!inHeap());
}
Ejemplo n.º 8
0
void TimerBase::stop()
{
    ASSERT(m_thread == currentThread() || (isMainThread() || pthread_main_np()) && WebCoreWebThreadIsLockedOrDisabled());

    m_repeatInterval = 0;
    setNextFireTime(0);

    ASSERT(m_nextFireTime == 0);
    ASSERT(m_repeatInterval == 0);
    ASSERT(!inHeap());
}
Ejemplo n.º 9
0
void TimerBase::start(double nextFireInterval,
                      double repeatInterval,
                      const WebTraceLocation& caller) {
#if DCHECK_IS_ON()
  DCHECK_EQ(m_thread, currentThread());
#endif

  m_location = caller;
  m_repeatInterval = repeatInterval;
  setNextFireTime(timerMonotonicallyIncreasingTime(), nextFireInterval);
}
Ejemplo n.º 10
0
void TimerBase::stop()
{
    ASSERT(canAccessThreadLocalDataForThread(m_thread));

    m_repeatInterval = 0;
    setNextFireTime(0);

    ASSERT(m_nextFireTime == 0);
    ASSERT(m_repeatInterval == 0);
    ASSERT(!inHeap());
}
Ejemplo n.º 11
0
void TimerBase::moveToNewTaskRunner(WebTaskRunner* taskRunner) {
#if DCHECK_IS_ON()
  DCHECK_EQ(m_thread, currentThread());
  DCHECK(taskRunner->runsTasksOnCurrentThread());
#endif
  // If the underlying task runner stays the same, ignore it.
  if (m_webTaskRunner->toSingleThreadTaskRunner() ==
      taskRunner->toSingleThreadTaskRunner()) {
    return;
  }

  m_weakPtrFactory.revokeAll();

  m_webTaskRunner = taskRunner->clone();

  double now = timerMonotonicallyIncreasingTime();
  double nextFireTime = m_nextFireTime;
  m_nextFireTime = 0;

  setNextFireTime(now, nextFireTime - now);
}
Ejemplo n.º 12
0
NO_LAZY_SWEEP_SANITIZE_ADDRESS
void TimerBase::runInternal()
{
    if (!canFire())
        return;

    TRACE_EVENT0("blink", "TimerBase::run");
    ASSERT_WITH_MESSAGE(m_thread == currentThread(), "Timer posted by %s %s was run on a different thread", m_location.functionName(), m_location.fileName());
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "BlinkInternal");

    if (m_repeatInterval) {
        double now = monotonicallyIncreasingTime();
        // This computation should be drift free, and it will cope if we miss a beat,
        // which can easily happen if the thread is busy.  It will also cope if we get
        // called slightly before m_unalignedNextFireTime, which can happen due to lack
        // of timer precision.
        double intervalToNextFireTime = m_repeatInterval - fmod(now - m_nextFireTime, m_repeatInterval);
        setNextFireTime(monotonicallyIncreasingTime(), intervalToNextFireTime);
    } else {
        m_nextFireTime = 0;
    }
    fired();
    TRACE_EVENT_SET_SAMPLING_STATE("blink", "Sleeping");
}
Ejemplo n.º 13
0
void TimerBase::start(double nextFireInterval, double repeatInterval)
{
    m_repeatInterval = repeatInterval;
    setNextFireTime(currentTime() + nextFireInterval);
}
Ejemplo n.º 14
0
void TimerBase::didChangeAlignmentInterval()
{
    setNextFireTime(m_unalignedNextFireTime);
}