| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // OneShotTimer and RepeatingTimer provide a simple timer API. As the names | 5 // OneShotTimer and RepeatingTimer provide a simple timer API. As the names |
| 6 // suggest, OneShotTimer calls you back once after a time delay expires. | 6 // suggest, OneShotTimer calls you back once after a time delay expires. |
| 7 // RepeatingTimer on the other hand calls you back periodically with the | 7 // RepeatingTimer on the other hand calls you back periodically with the |
| 8 // prescribed time interval. | 8 // prescribed time interval. |
| 9 // | 9 // |
| 10 // OneShotTimer and RepeatingTimer both cancel the timer when they go out of | 10 // OneShotTimer and RepeatingTimer both cancel the timer when they go out of |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 #ifndef BASE_TIMER_TIMER_H_ | 44 #ifndef BASE_TIMER_TIMER_H_ |
| 45 #define BASE_TIMER_TIMER_H_ | 45 #define BASE_TIMER_TIMER_H_ |
| 46 | 46 |
| 47 // IMPORTANT: If you change timer code, make sure that all tests (including | 47 // IMPORTANT: If you change timer code, make sure that all tests (including |
| 48 // disabled ones) from timer_unittests.cc pass locally. Some are disabled | 48 // disabled ones) from timer_unittests.cc pass locally. Some are disabled |
| 49 // because they're flaky on the buildbot, but when you run them locally you | 49 // because they're flaky on the buildbot, but when you run them locally you |
| 50 // should be able to tell the difference. | 50 // should be able to tell the difference. |
| 51 | 51 |
| 52 #include "base/base_export.h" | 52 #include "base/base_export.h" |
| 53 #include "base/basictypes.h" | |
| 54 #include "base/bind.h" | 53 #include "base/bind.h" |
| 55 #include "base/bind_helpers.h" | 54 #include "base/bind_helpers.h" |
| 56 #include "base/callback.h" | 55 #include "base/callback.h" |
| 57 #include "base/location.h" | 56 #include "base/location.h" |
| 57 #include "base/macros.h" |
| 58 #include "base/time/time.h" | 58 #include "base/time/time.h" |
| 59 | 59 |
| 60 namespace base { | 60 namespace base { |
| 61 | 61 |
| 62 class BaseTimerTaskInternal; | 62 class BaseTimerTaskInternal; |
| 63 class SingleThreadTaskRunner; | 63 class SingleThreadTaskRunner; |
| 64 | 64 |
| 65 //----------------------------------------------------------------------------- | 65 //----------------------------------------------------------------------------- |
| 66 // This class wraps MessageLoop::PostDelayedTask to manage delayed and repeating | 66 // This class wraps MessageLoop::PostDelayedTask to manage delayed and repeating |
| 67 // tasks. It must be destructed on the same thread that starts tasks. There are | 67 // tasks. It must be destructed on the same thread that starts tasks. There are |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // to link in MSVC. But clang-plugin does not allow inline definitions of | 270 // to link in MSVC. But clang-plugin does not allow inline definitions of |
| 271 // virtual methods, so the inline definition lives in the header file here | 271 // virtual methods, so the inline definition lives in the header file here |
| 272 // to satisfy both. | 272 // to satisfy both. |
| 273 inline void DelayTimer::Reset() { | 273 inline void DelayTimer::Reset() { |
| 274 Timer::Reset(); | 274 Timer::Reset(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace base | 277 } // namespace base |
| 278 | 278 |
| 279 #endif // BASE_TIMER_TIMER_H_ | 279 #endif // BASE_TIMER_TIMER_H_ |
| OLD | NEW |