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

Unified Diff: base/timer/timer.h

Issue 641943002: components: Introduce AlarmTimer class and use it for GCM heartbeat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gyp files Created 6 years, 2 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 | « no previous file | base/timer/timer.cc » ('j') | components/OWNERS » ('J')
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 6d282ee8e7ac84f3d6f5757650c08be70463f9e6..e6d998fe4f5cd10bb58c75c6e6155c4364b17754 100644
--- a/base/timer/timer.h
+++ b/base/timer/timer.h
@@ -114,6 +114,32 @@ class BASE_EXPORT Timer {
bool retain_user_task() const { return retain_user_task_; }
bool is_repeating() const { return is_repeating_; }
+ // Location in user code.
+ tracked_objects::Location posted_from_;
+ // Delay requested by user.
+ TimeDelta delay_;
+ // user_task_ is what the user wants to be run at desired_run_time_.
+ base::Closure user_task_;
+
+ // The desired run time of user_task_. The user may update this at any time,
+ // even if their previous request has not run yet. If desired_run_time_ is
+ // greater than scheduled_run_time_, a continuation task will be posted to
+ // wait for the remaining time. This allows us to reuse the pending task so as
+ // not to flood the MessageLoop with orphaned tasks when the user code
+ // excessively Stops and Starts the timer. This time can be a "zero" TimeTicks
+ // if the task must be run immediately.
+ TimeTicks desired_run_time_;
+
+ // Repeating timers automatically post the task again before calling the task
+ // callback.
+ const bool is_repeating_;
Lei Zhang 2014/10/21 22:34:11 You can leave it in private: and call is_repeating
Chirantan Ekbote 2014/10/21 22:52:21 Acknowledged.
+
+ // If true, hold on to |user_task_| for reuse.
+ const bool retain_user_task_;
+
+ // If true, |user_task_| is scheduled to run sometime in the future.
+ bool is_running_;
blundell 2014/10/22 13:46:24 To follow the pattern, I would make a getter for i
Chirantan Ekbote 2014/10/22 18:47:14 But we also need to set |is_running_|. So I guess
blundell 2014/10/23 05:54:20 Google style is actually definitive on this point:
Chirantan Ekbote 2014/10/23 23:53:30 Done.
+
private:
friend class BaseTimerTaskInternal;
@@ -139,40 +165,14 @@ class BASE_EXPORT Timer {
// RunScheduledTask() at scheduled_run_time_.
BaseTimerTaskInternal* scheduled_task_;
- // Location in user code.
- tracked_objects::Location posted_from_;
- // Delay requested by user.
- TimeDelta delay_;
- // user_task_ is what the user wants to be run at desired_run_time_.
- base::Closure user_task_;
-
// The estimated time that the MessageLoop will run the scheduled_task_ that
// will call RunScheduledTask(). This time can be a "zero" TimeTicks if the
// task must be run immediately.
TimeTicks scheduled_run_time_;
- // The desired run time of user_task_. The user may update this at any time,
- // even if their previous request has not run yet. If desired_run_time_ is
- // greater than scheduled_run_time_, a continuation task will be posted to
- // wait for the remaining time. This allows us to reuse the pending task so as
- // not to flood the MessageLoop with orphaned tasks when the user code
- // excessively Stops and Starts the timer. This time can be a "zero" TimeTicks
- // if the task must be run immediately.
- TimeTicks desired_run_time_;
-
// Thread ID of current MessageLoop for verifying single-threaded usage.
int thread_id_;
- // Repeating timers automatically post the task again before calling the task
- // callback.
- const bool is_repeating_;
-
- // If true, hold on to the user_task_ closure object for reuse.
- const bool retain_user_task_;
-
- // If true, user_task_ is scheduled to run sometime in the future.
- bool is_running_;
-
DISALLOW_COPY_AND_ASSIGN(Timer);
};
« no previous file with comments | « no previous file | base/timer/timer.cc » ('j') | components/OWNERS » ('J')

Powered by Google App Engine
This is Rietveld 408576698