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

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

Issue 2557663002: GetTimeToCallback() returns estimated time to callback. (Closed)
Patch Set: Removed an old file that sneaked in the patchest. Created 4 years 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 | « no previous file | 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 TickClock* tick_clock); 93 TickClock* tick_clock);
94 94
95 virtual ~Timer(); 95 virtual ~Timer();
96 96
97 // Returns true if the timer is running (i.e., not stopped). 97 // Returns true if the timer is running (i.e., not stopped).
98 virtual bool IsRunning() const; 98 virtual bool IsRunning() const;
99 99
100 // Returns the current delay for this timer. 100 // Returns the current delay for this timer.
101 virtual TimeDelta GetCurrentDelay() const; 101 virtual TimeDelta GetCurrentDelay() const;
102 102
103 // Returns an estimated time to the timer calling the user_task_ back.
104 // Note that the time may be negative if the timer has not been started,
105 // is late to call back or has done its last call back.
106 virtual TimeDelta GetTimeToCallback() const;
107
103 // Set the task runner on which the task should be scheduled. This method can 108 // Set the task runner on which the task should be scheduled. This method can
104 // only be called before any tasks have been scheduled. The task runner must 109 // only be called before any tasks have been scheduled. The task runner must
105 // run tasks on the same thread the timer is used on. 110 // run tasks on the same thread the timer is used on.
106 virtual void SetTaskRunner(scoped_refptr<SingleThreadTaskRunner> task_runner); 111 virtual void SetTaskRunner(scoped_refptr<SingleThreadTaskRunner> task_runner);
107 112
108 // Start the timer to run at the given |delay| from now. If the timer is 113 // Start the timer to run at the given |delay| from now. If the timer is
109 // already running, it will be replaced to call the given |user_task|. 114 // already running, it will be replaced to call the given |user_task|.
110 virtual void Start(const tracked_objects::Location& posted_from, 115 virtual void Start(const tracked_objects::Location& posted_from,
111 TimeDelta delay, 116 TimeDelta delay,
112 const base::Closure& user_task); 117 const base::Closure& user_task);
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // to link in MSVC. But clang-plugin does not allow inline definitions of 306 // to link in MSVC. But clang-plugin does not allow inline definitions of
302 // virtual methods, so the inline definition lives in the header file here 307 // virtual methods, so the inline definition lives in the header file here
303 // to satisfy both. 308 // to satisfy both.
304 inline void DelayTimer::Reset() { 309 inline void DelayTimer::Reset() {
305 Timer::Reset(); 310 Timer::Reset();
306 } 311 }
307 312
308 } // namespace base 313 } // namespace base
309 314
310 #endif // BASE_TIMER_TIMER_H_ 315 #endif // BASE_TIMER_TIMER_H_
OLDNEW
« no previous file with comments | « no previous file | base/timer/timer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698