summaryrefslogtreecommitdiff
path: root/chromium/base/timer/timer.cc
diff options
context:
space:
mode:
authorAndras Becsi <andras.becsi@digia.com>2014-03-18 13:16:26 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-03-20 15:55:39 +0100
commit3f0f86b0caed75241fa71c95a5d73bc0164348c5 (patch)
tree92b9fb00f2e9e90b0be2262093876d4f43b6cd13 /chromium/base/timer/timer.cc
parente90d7c4b152c56919d963987e2503f9909a666d2 (diff)
downloadqtwebengine-chromium-3f0f86b0caed75241fa71c95a5d73bc0164348c5.tar.gz
Update to new stable branch 1750
This also includes an updated ninja and chromium dependencies needed on Windows. Change-Id: Icd597d80ed3fa4425933c9f1334c3c2e31291c42 Reviewed-by: Zoltan Arvai <zarvai@inf.u-szeged.hu> Reviewed-by: Zeno Albisser <zeno.albisser@digia.com>
Diffstat (limited to 'chromium/base/timer/timer.cc')
-rw-r--r--chromium/base/timer/timer.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/chromium/base/timer/timer.cc b/chromium/base/timer/timer.cc
index aafc01e1304..1c4b10c6de5 100644
--- a/chromium/base/timer/timer.cc
+++ b/chromium/base/timer/timer.cc
@@ -108,11 +108,14 @@ void Timer::Reset() {
}
// Set the new desired_run_time_.
- desired_run_time_ = TimeTicks::Now() + delay_;
+ if (delay_ > TimeDelta::FromMicroseconds(0))
+ desired_run_time_ = TimeTicks::Now() + delay_;
+ else
+ desired_run_time_ = TimeTicks();
// We can use the existing scheduled task if it arrives before the new
// desired_run_time_.
- if (desired_run_time_ > scheduled_run_time_) {
+ if (desired_run_time_ >= scheduled_run_time_) {
is_running_ = true;
return;
}
@@ -134,10 +137,16 @@ void Timer::PostNewScheduledTask(TimeDelta delay) {
DCHECK(scheduled_task_ == NULL);
is_running_ = true;
scheduled_task_ = new BaseTimerTaskInternal(this);
- ThreadTaskRunnerHandle::Get()->PostDelayedTask(posted_from_,
- base::Bind(&BaseTimerTaskInternal::Run, base::Owned(scheduled_task_)),
- delay);
- scheduled_run_time_ = desired_run_time_ = TimeTicks::Now() + delay;
+ if (delay > TimeDelta::FromMicroseconds(0)) {
+ ThreadTaskRunnerHandle::Get()->PostDelayedTask(posted_from_,
+ base::Bind(&BaseTimerTaskInternal::Run, base::Owned(scheduled_task_)),
+ delay);
+ scheduled_run_time_ = desired_run_time_ = TimeTicks::Now() + delay;
+ } else {
+ ThreadTaskRunnerHandle::Get()->PostTask(posted_from_,
+ base::Bind(&BaseTimerTaskInternal::Run, base::Owned(scheduled_task_)));
+ scheduled_run_time_ = desired_run_time_ = TimeTicks();
+ }
// Remember the thread ID that posts the first task -- this will be verified
// later when the task is abandoned to detect misuse from multiple threads.
if (!thread_id_)