Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2726)

Unified Diff: base/timer/timer.h

Issue 197243003: base: add MockTimer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Reuse some base members. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/timer/mock_timer_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/timer/timer.h
diff --git a/base/timer/timer.h b/base/timer/timer.h
index 71a7ae8888a3afd82be5419b24e4d0df22da2955..678fff120810db37ac0955b301895cbb6a0db80b 100644
--- a/base/timer/timer.h
+++ b/base/timer/timer.h
@@ -82,31 +82,33 @@ class BASE_EXPORT Timer {
virtual ~Timer();
// Returns true if the timer is running (i.e., not stopped).
- bool IsRunning() const {
+ virtual bool IsRunning() const {
Mark Mentovai 2014/03/13 16:00:00 The (public, even) accessor already exists here.
Elly Fong-Jones 2014/03/13 16:07:17 Done.
return is_running_;
}
// Returns the current delay for this timer.
- TimeDelta GetCurrentDelay() const {
+ virtual TimeDelta GetCurrentDelay() const {
return delay_;
}
// Start the timer to run at the given |delay| from now. If the timer is
// already running, it will be replaced to call the given |user_task|.
- void Start(const tracked_objects::Location& posted_from,
+ virtual void Start(const tracked_objects::Location& posted_from,
TimeDelta delay,
const base::Closure& user_task);
// Call this method to stop and cancel the timer. It is a no-op if the timer
// is not running.
- void Stop();
+ virtual void Stop();
// Call this method to reset the timer delay. The user_task_ must be set. If
// the timer is not running, this will start it by posting a task.
- void Reset();
+ virtual void Reset();
const base::Closure& user_task() const { return user_task_; }
const TimeTicks& desired_run_time() const { return desired_run_time_; }
+ bool retain_user_task() const { return retain_user_task_; }
Mark Mentovai 2014/03/13 15:49:52 If nobody has needed these outside of a Timer subc
Elly Fong-Jones 2014/03/13 16:07:17 Done.
+ bool is_repeating() const { return is_repeating_; }
protected:
// Used to initiate a new delayed task. This has the side-effect of disabling
@@ -197,7 +199,7 @@ class BaseTimerMethodPointer : public Timer {
// Start the timer to run at the given |delay| from now. If the timer is
// already running, it will be replaced to call a task formed from
// |reviewer->*method|.
- void Start(const tracked_objects::Location& posted_from,
+ virtual void Start(const tracked_objects::Location& posted_from,
TimeDelta delay,
Receiver* receiver,
ReceiverMethod method) {
« no previous file with comments | « base/timer/mock_timer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698