| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 5 #ifndef BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
| 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 6 #define BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/base_export.h" | 14 #include "base/base_export.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/synchronization/atomic_flag.h" | 19 #include "base/synchronization/atomic_flag.h" |
| 20 #include "base/task_runner.h" | 20 #include "base/task_runner.h" |
| 21 #include "base/task_scheduler/delayed_task_manager.h" | |
| 22 #include "base/task_scheduler/scheduler_worker_pool_impl.h" | 21 #include "base/task_scheduler/scheduler_worker_pool_impl.h" |
| 23 #include "base/task_scheduler/sequence.h" | 22 #include "base/task_scheduler/sequence.h" |
| 24 #include "base/task_scheduler/task_scheduler.h" | 23 #include "base/task_scheduler/task_scheduler.h" |
| 25 #include "base/task_scheduler/task_tracker.h" | 24 #include "base/task_scheduler/task_tracker.h" |
| 26 #include "base/task_scheduler/task_traits.h" | 25 #include "base/task_scheduler/task_traits.h" |
| 27 #include "base/threading/thread.h" | 26 #include "base/threading/thread.h" |
| 28 | 27 |
| 29 namespace base { | 28 namespace base { |
| 30 | 29 |
| 31 class SchedulerWorkerPoolParams; | 30 class SchedulerWorkerPoolParams; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void Initialize( | 71 void Initialize( |
| 73 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector); | 72 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector); |
| 74 | 73 |
| 75 // Returns the worker pool that runs Tasks with |traits|. | 74 // Returns the worker pool that runs Tasks with |traits|. |
| 76 SchedulerWorkerPool* GetWorkerPoolForTraits(const TaskTraits& traits); | 75 SchedulerWorkerPool* GetWorkerPoolForTraits(const TaskTraits& traits); |
| 77 | 76 |
| 78 // Callback invoked when a non-single-thread |sequence| isn't empty after a | 77 // Callback invoked when a non-single-thread |sequence| isn't empty after a |
| 79 // worker pops a Task from it. | 78 // worker pops a Task from it. |
| 80 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence); | 79 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence); |
| 81 | 80 |
| 82 // Callback invoked when the delayed run time is changed from the | |
| 83 // DelayedTaskManager. | |
| 84 void OnDelayedRunTimeUpdated(); | |
| 85 | |
| 86 TaskTracker task_tracker_; | 81 TaskTracker task_tracker_; |
| 87 DelayedTaskManager delayed_task_manager_; | 82 Thread service_thread_; |
| 88 const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_; | 83 const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_; |
| 89 std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_; | 84 std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_; |
| 90 std::unique_ptr<SchedulerServiceThread> service_thread_; | |
| 91 | 85 |
| 92 #if DCHECK_IS_ON() | 86 #if DCHECK_IS_ON() |
| 93 // Set once JoinForTesting() has returned. | 87 // Set once JoinForTesting() has returned. |
| 94 AtomicFlag join_for_testing_returned_; | 88 AtomicFlag join_for_testing_returned_; |
| 95 #endif | 89 #endif |
| 96 | 90 |
| 97 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); | 91 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); |
| 98 }; | 92 }; |
| 99 | 93 |
| 100 } // namespace internal | 94 } // namespace internal |
| 101 } // namespace base | 95 } // namespace base |
| 102 | 96 |
| 103 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 97 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
| OLD | NEW |