diff options
author | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-06 12:29:16 +0000 |
---|---|---|
committer | deanm@google.com <deanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-06 12:29:16 +0000 |
commit | 40d358fb5d2083582f512977a4119a650eddf3b0 (patch) | |
tree | 5bf1759b3b3f6e5860c59b71324d3623f8d69964 /base/timer.cc | |
parent | d30e8e641cf9f1bbe880328089b229a3286ee05e (diff) | |
download | chromium_src-40d358fb5d2083582f512977a4119a650eddf3b0.zip chromium_src-40d358fb5d2083582f512977a4119a650eddf3b0.tar.gz chromium_src-40d358fb5d2083582f512977a4119a650eddf3b0.tar.bz2 |
Move base/timer from deprecated atomic interface to AtomicSequenceNumber.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@427 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/timer.cc')
-rw-r--r-- | base/timer.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/base/timer.cc b/base/timer.cc index 4db8b88..a1d401d 100644 --- a/base/timer.cc +++ b/base/timer.cc @@ -30,7 +30,7 @@ #include "base/timer.h" #include <mmsystem.h> -#include "base/atomic.h" +#include "base/atomic_sequence_num.h" #include "base/logging.h" #include "base/message_loop.h" #include "base/task.h" @@ -74,8 +74,9 @@ static LRESULT CALLBACK MessageWndProc(HWND hwnd, return DefWindowProc(hwnd, message, wparam, lparam); } -// static -int32 Timer::timer_id_counter_ = 0; +// A sequence number for all allocated times (used to break ties when +// comparing times in the TimerManager, and assure FIFO execution sequence). +static base::AtomicSequenceNumber timer_id_counter_; //----------------------------------------------------------------------------- // Timer @@ -84,7 +85,7 @@ Timer::Timer(int delay, Task* task, bool repeating) : delay_(delay), task_(task), repeating_(repeating) { - timer_id_ = base::AtomicIncrement(&timer_id_counter_); + timer_id_ = timer_id_counter_.GetNext(); DCHECK(delay >= 0); Reset(); } |