| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef COMPONENTS_DOMAIN_RELIABILITY_DISPATCHER_H_ | 5 #ifndef COMPONENTS_DOMAIN_RELIABILITY_DISPATCHER_H_ |
| 6 #define COMPONENTS_DOMAIN_RELIABILITY_DISPATCHER_H_ | 6 #define COMPONENTS_DOMAIN_RELIABILITY_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <set> | 9 #include <set> |
| 9 | 10 |
| 10 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/macros.h" |
| 11 #include "base/time/time.h" | 13 #include "base/time/time.h" |
| 12 #include "components/domain_reliability/domain_reliability_export.h" | 14 #include "components/domain_reliability/domain_reliability_export.h" |
| 13 | 15 |
| 14 namespace tracked_objects { | 16 namespace tracked_objects { |
| 15 class Location; | 17 class Location; |
| 16 } // namespace tracked_objects | 18 } // namespace tracked_objects |
| 17 | 19 |
| 18 namespace domain_reliability { | 20 namespace domain_reliability { |
| 19 | 21 |
| 20 class MockableTime; | 22 class MockableTime; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 47 void MakeTaskWaiting(Task* task); | 49 void MakeTaskWaiting(Task* task); |
| 48 | 50 |
| 49 // Adds |task| to the set of eligible tasks, and also the set of all tasks | 51 // Adds |task| to the set of eligible tasks, and also the set of all tasks |
| 50 // if not already there. | 52 // if not already there. |
| 51 void MakeTaskEligible(Task* task); | 53 void MakeTaskEligible(Task* task); |
| 52 | 54 |
| 53 // Runs |task|'s callback, removes it from both sets, and deletes it. | 55 // Runs |task|'s callback, removes it from both sets, and deletes it. |
| 54 void RunAndDeleteTask(Task* task); | 56 void RunAndDeleteTask(Task* task); |
| 55 | 57 |
| 56 MockableTime* time_; | 58 MockableTime* time_; |
| 57 std::set<Task*> tasks_; | 59 std::set<std::unique_ptr<Task>> tasks_; |
| 58 std::set<Task*> eligible_tasks_; | 60 std::set<Task*> eligible_tasks_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(DomainReliabilityDispatcher); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace domain_reliability | 65 } // namespace domain_reliability |
| 62 | 66 |
| 63 #endif | 67 #endif |
| OLD | NEW |