| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef BASE_TASK_SCHEDULER_SERVICE_THREAD_H_ | |
| 6 #define BASE_TASK_SCHEDULER_SERVICE_THREAD_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/base_export.h" | |
| 11 #include "base/macros.h" | |
| 12 | |
| 13 namespace base { | |
| 14 namespace internal { | |
| 15 | |
| 16 class DelayedTaskManager; | |
| 17 class SchedulerWorker; | |
| 18 class TaskTracker; | |
| 19 | |
| 20 // A thread dedicated to performing Task Scheduler related work. | |
| 21 class BASE_EXPORT SchedulerServiceThread { | |
| 22 public: | |
| 23 ~SchedulerServiceThread(); | |
| 24 | |
| 25 // Creates a SchedulerServiceThread. |task_tracker| and |delayed_task_manager| | |
| 26 // are passed through to the underlying SchedulerWorker. Returns a nullptr on | |
| 27 // failure. | |
| 28 static std::unique_ptr<SchedulerServiceThread> Create( | |
| 29 TaskTracker* task_tracker, DelayedTaskManager* delayed_task_manager); | |
| 30 | |
| 31 // Wakes the SchedulerServiceThread if it wasn't already awake. This also has | |
| 32 // the impact of updating the amount of time the thread sleeps for delayed | |
| 33 // tasks. | |
| 34 void WakeUp(); | |
| 35 | |
| 36 // Joins this SchedulerServiceThread. This can only be called once. | |
| 37 void JoinForTesting(); | |
| 38 | |
| 39 private: | |
| 40 SchedulerServiceThread(std::unique_ptr<SchedulerWorker> worker); | |
| 41 | |
| 42 const std::unique_ptr<SchedulerWorker> worker_; | |
| 43 | |
| 44 DISALLOW_COPY_AND_ASSIGN(SchedulerServiceThread); | |
| 45 }; | |
| 46 | |
| 47 } // namespace internal | |
| 48 } // namespace base | |
| 49 | |
| 50 #endif // BASE_TASK_SCHEDULER_SERVICE_THREAD_H_ | |
| OLD | NEW |