Index: base/timer/timer.h |
diff --git a/base/timer/timer.h b/base/timer/timer.h |
index 661829b513d8281f99bb63741b91f9c026e6ff39..20cce8c69df37d02eb8e901ecf06662b0d5dae6e 100644 |
--- a/base/timer/timer.h |
+++ b/base/timer/timer.h |
@@ -49,6 +49,8 @@ |
// because they're flaky on the buildbot, but when you run them locally you |
// should be able to tell the difference. |
+#include <memory> |
+ |
#include "base/base_export.h" |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
@@ -61,6 +63,7 @@ namespace base { |
class BaseTimerTaskInternal; |
class SingleThreadTaskRunner; |
+class TickClock; |
//----------------------------------------------------------------------------- |
// This class wraps MessageLoop::PostDelayedTask to manage delayed and repeating |
@@ -93,6 +96,9 @@ class BASE_EXPORT Timer { |
// run tasks on the same thread the timer is used on. |
virtual void SetTaskRunner(scoped_refptr<SingleThreadTaskRunner> task_runner); |
+ // Sets the tick clock used to calculate the run time for scheduled tasks. |
+ virtual void SetTickClock(std::unique_ptr<TickClock> tick_clock); |
danakj
2016/11/09 19:57:38
This class being virtual means subclasses need to
jameswest
2016/11/10 00:26:05
I'm fine with that idea, but it's currently possib
|
+ |
// 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|. |
virtual void Start(const tracked_objects::Location& posted_from, |
@@ -160,6 +166,9 @@ class BASE_EXPORT Timer { |
// task runner for the current thread should be used. |
scoped_refptr<SingleThreadTaskRunner> task_runner_; |
+ // The tick clock used to calculate the run time for scheduled tasks. |
+ std::unique_ptr<TickClock> tick_clock_; |
+ |
// Location in user code. |
tracked_objects::Location posted_from_; |
// Delay requested by user. |