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

Unified Diff: base/timer.h

Issue 7812036: Update base/timer.h code to pass through Location from call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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/system_monitor/system_monitor.cc ('k') | base/timer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/timer.h
diff --git a/base/timer.h b/base/timer.h
index 2e21582a9a0ab8404bc981c6db2f120f6f31ed6b..a8011ee97e1a0cd0900124a31a728e4f27dd0bc6 100644
--- a/base/timer.h
+++ b/base/timer.h
@@ -87,11 +87,16 @@ class BASE_EXPORT BaseTimer_Helper {
// We have access to the timer_ member so we can orphan this task.
class TimerTask : public Task {
public:
- explicit TimerTask(TimeDelta delay) : timer_(NULL), delay_(delay) {
+ explicit TimerTask(TimeDelta delay,
+ const tracked_objects::Location& posted_from)
+ : timer_(NULL),
+ delay_(delay),
+ posted_from_(posted_from) {
}
virtual ~TimerTask() {}
BaseTimer_Helper* timer_;
TimeDelta delay_;
+ tracked_objects::Location posted_from_;
};
// Used to orphan delayed_task_ so that when it runs it does nothing.
@@ -116,9 +121,12 @@ class BaseTimer : public BaseTimer_Helper {
// Call this method to start the timer. It is an error to call this method
// while the timer is already running.
- void Start(TimeDelta delay, Receiver* receiver, ReceiverMethod method) {
+ void Start(TimeDelta delay,
darin (slow to review) 2011/08/31 21:27:38 consistency nit: it'd be nice to place the Locati
jbates 2011/08/31 23:01:59 Done.
+ Receiver* receiver,
+ ReceiverMethod method,
+ const tracked_objects::Location& posted_from) {
DCHECK(!IsRunning());
- InitiateDelayedTask(new TimerTask(delay, receiver, method));
+ InitiateDelayedTask(new TimerTask(delay, receiver, method, posted_from));
}
// Call this method to stop the timer. It is a no-op if the timer is not
@@ -138,8 +146,11 @@ class BaseTimer : public BaseTimer_Helper {
class TimerTask : public BaseTimer_Helper::TimerTask {
public:
- TimerTask(TimeDelta delay, Receiver* receiver, ReceiverMethod method)
- : BaseTimer_Helper::TimerTask(delay),
+ TimerTask(TimeDelta delay,
+ Receiver* receiver,
+ ReceiverMethod method,
+ const tracked_objects::Location& posted_from)
+ : BaseTimer_Helper::TimerTask(delay, posted_from),
receiver_(receiver),
method_(method) {
}
@@ -162,7 +173,7 @@ class BaseTimer : public BaseTimer_Helper {
}
TimerTask* Clone() const {
- return new TimerTask(delay_, receiver_, method_);
+ return new TimerTask(delay_, receiver_, method_, posted_from_);
}
private:
@@ -221,10 +232,14 @@ class DelayTimer {
public:
typedef void (Receiver::*ReceiverMethod)();
- DelayTimer(TimeDelta delay, Receiver* receiver, ReceiverMethod method)
+ DelayTimer(TimeDelta delay,
+ Receiver* receiver,
+ ReceiverMethod method,
+ const tracked_objects::Location& posted_from)
: receiver_(receiver),
method_(method),
- delay_(delay) {
+ delay_(delay),
+ posted_from_(posted_from) {
}
void Reset() {
@@ -242,7 +257,7 @@ class DelayTimer {
// The timer isn't running, or will expire too late, so restart it.
timer_.Stop();
- timer_.Start(delay, this, &DelayTimer<Receiver>::Check);
+ timer_.Start(delay, this, &DelayTimer<Receiver>::Check, posted_from_);
}
void Check() {
@@ -262,6 +277,7 @@ class DelayTimer {
Receiver *const receiver_;
const ReceiverMethod method_;
const TimeDelta delay_;
+ tracked_objects::Location posted_from_;
OneShotTimer<DelayTimer<Receiver> > timer_;
TimeTicks trigger_time_;
« no previous file with comments | « base/system_monitor/system_monitor.cc ('k') | base/timer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698