Exemplo n.º 1
0
void TimerBase::setNextFireTime(double now, double delay)
{
    ASSERT(m_thread == currentThread());

    double newTime = now + delay;

    if (m_nextFireTime != newTime) {
        m_nextFireTime = newTime;
        if (m_cancellableTimerTask)
            m_cancellableTimerTask->cancel();
        m_cancellableTimerTask = new CancellableTimerTask(this);

        double delayMs = 1000.0 * (newTime - now);
        timerTaskRunner()->postDelayedTask(m_location, m_cancellableTimerTask, delayMs);
    }
}
Exemplo n.º 2
0
void TimerBase::setNextFireTime(double now, double delay) {
#if DCHECK_IS_ON()
  DCHECK_EQ(m_thread, currentThread());
#endif

  double newTime = now + delay;

  if (m_nextFireTime != newTime) {
    m_nextFireTime = newTime;

    // Cancel any previously posted task.
    m_weakPtrFactory.revokeAll();

    double delayMs = 1000.0 * (newTime - now);
    timerTaskRunner()->postDelayedTask(
        m_location,
        base::Bind(&TimerBase::runInternal, m_weakPtrFactory.createWeakPtr()),
        delayMs);
  }
}
Exemplo n.º 3
0
// static
double TimerBase::timerMonotonicallyIncreasingTime() const {
  return timerTaskRunner()->monotonicallyIncreasingVirtualTimeSeconds();
}