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

Side by Side Diff: base/timer/timer.h

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 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 unified diff | Download patch
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | base/timer/timer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 virtual ~Timer(); 83 virtual ~Timer();
84 84
85 // Returns true if the timer is running (i.e., not stopped). 85 // Returns true if the timer is running (i.e., not stopped).
86 virtual bool IsRunning() const; 86 virtual bool IsRunning() const;
87 87
88 // Returns the current delay for this timer. 88 // Returns the current delay for this timer.
89 virtual TimeDelta GetCurrentDelay() const; 89 virtual TimeDelta GetCurrentDelay() const;
90 90
91 // Set the task runner on which the task should be scheduled. This method can 91 // Set the task runner on which the task should be scheduled. This method can
92 // only be called before any tasks have been scheduled. 92 // only be called before any tasks have been scheduled. The task runner must
93 // run tasks on the same thread the timer is used on.
93 virtual void SetTaskRunner(scoped_refptr<SingleThreadTaskRunner> task_runner); 94 virtual void SetTaskRunner(scoped_refptr<SingleThreadTaskRunner> task_runner);
94 95
95 // Start the timer to run at the given |delay| from now. If the timer is 96 // Start the timer to run at the given |delay| from now. If the timer is
96 // already running, it will be replaced to call the given |user_task|. 97 // already running, it will be replaced to call the given |user_task|.
97 virtual void Start(const tracked_objects::Location& posted_from, 98 virtual void Start(const tracked_objects::Location& posted_from,
98 TimeDelta delay, 99 TimeDelta delay,
99 const base::Closure& user_task); 100 const base::Closure& user_task);
100 101
101 // Call this method to stop and cancel the timer. It is a no-op if the timer 102 // Call this method to stop and cancel the timer. It is a no-op if the timer
102 // is not running. 103 // is not running.
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 : Timer(posted_from, delay, 259 : Timer(posted_from, delay,
259 base::Bind(method, base::Unretained(receiver)), 260 base::Bind(method, base::Unretained(receiver)),
260 false) {} 261 false) {}
261 262
262 void Reset() override { Timer::Reset(); } 263 void Reset() override { Timer::Reset(); }
263 }; 264 };
264 265
265 } // namespace base 266 } // namespace base
266 267
267 #endif // BASE_TIMER_TIMER_H_ 268 #endif // BASE_TIMER_TIMER_H_
OLDNEW
« no previous file with comments | « base/threading/thread_restrictions.h ('k') | base/timer/timer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698