Chromium Code Reviews| Index: components/domain_reliability/dispatcher.h |
| diff --git a/components/domain_reliability/dispatcher.h b/components/domain_reliability/dispatcher.h |
| index 52309e7213e9de3fce1ceccb399371eaac2f2448..389d2625c572b16c278c44f7e6ab03f159384428 100644 |
| --- a/components/domain_reliability/dispatcher.h |
| +++ b/components/domain_reliability/dispatcher.h |
| @@ -8,7 +8,6 @@ |
| #include <set> |
| #include "base/callback.h" |
| -#include "base/memory/scoped_vector.h" |
| #include "base/time/time.h" |
| #include "components/domain_reliability/domain_reliability_export.h" |
| #include "components/domain_reliability/util.h" |
| @@ -26,33 +25,29 @@ namespace domain_reliability { |
| // (See scheduler.h for an explanation of how the intervals are chosen.) |
| class DOMAIN_RELIABILITY_EXPORT DomainReliabilityDispatcher { |
| public: |
| - DomainReliabilityDispatcher(MockableTime* time); |
| + explicit DomainReliabilityDispatcher(MockableTime* time); |
| ~DomainReliabilityDispatcher(); |
| - void ScheduleTask( |
| - const base::Closure& task, |
| - base::TimeDelta min_delay, |
| - base::TimeDelta max_delay); |
| + // Schedules |task| to be executed between |min_delay| and |max_delay| from |
| + // now. |
|
Ryan Sleevi
2014/05/06 22:50:41
Is it a random delay, or is it just a weak guarant
Deprecated (see juliatuttle)
2014/05/07 02:36:07
Weak guarantee. I've updated the comment.
|
| + void ScheduleTask(const base::Closure& task, |
| + base::TimeDelta min_delay, |
| + base::TimeDelta max_delay); |
| + // Runs all tasks whose minimum delay has already passed. |
| void RunEligibleTasks(); |
| private: |
| - struct Task { |
| - Task(const base::Closure& closure_p, |
| - scoped_ptr<MockableTime::Timer> timer_p, |
| - base::TimeDelta min_delay_p, |
| - base::TimeDelta max_delay_p); |
| - ~Task(); |
| - |
| - base::Closure closure; |
| - scoped_ptr<MockableTime::Timer> timer; |
| - base::TimeDelta min_delay; |
| - base::TimeDelta max_delay; |
| - bool eligible; |
| - }; |
| + struct Task; |
| + // Adds |task| to the set of all tasks, but not the set of eligible tasks. |
| void MakeTaskWaiting(Task* task); |
| + |
| + // Adds |task| to the set of eligible tasks, and also the set of all tasks |
| + // if not already there. |
| void MakeTaskEligible(Task* task); |
| + |
| + // Runs |task|'s callback, removes it from both sets, and deletes it. |
| void RunAndDeleteTask(Task* task); |
| MockableTime* time_; |