| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 | 26 |
| 27 class HistogramBase; | 27 class HistogramBase; |
| 28 class SchedulerWorkerPoolParams; | 28 class SchedulerWorkerPoolParams; |
| 29 | 29 |
| 30 namespace internal { | 30 namespace internal { |
| 31 | 31 |
| 32 class DelayedTaskManager; | 32 class DelayedTaskManager; |
| 33 class SchedulerSingleThreadWorkerPoolManager; |
| 33 class TaskTracker; | 34 class TaskTracker; |
| 34 | 35 |
| 35 // Default TaskScheduler implementation. This class is thread-safe. | 36 // Default TaskScheduler implementation. This class is thread-safe. |
| 36 class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler { | 37 class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler { |
| 37 public: | 38 public: |
| 38 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure. | 39 // Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure. |
| 39 // |worker_pool_params_vector| describes the worker pools to create. | 40 // |worker_pool_params_vector| describes the worker pools to create. |
| 40 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools| | 41 // |worker_pool_index_for_traits_callback| returns the index in |worker_pools| |
| 41 // of the worker pool in which a task with given traits should run. | 42 // of the worker pool in which a task with given traits should run. |
| 42 static std::unique_ptr<TaskSchedulerImpl> Create( | 43 static std::unique_ptr<TaskSchedulerImpl> Create( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 // Callback invoked when a non-single-thread |sequence| isn't empty after a | 76 // Callback invoked when a non-single-thread |sequence| isn't empty after a |
| 76 // worker pops a Task from it. | 77 // worker pops a Task from it. |
| 77 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence); | 78 void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence); |
| 78 | 79 |
| 79 Thread service_thread_; | 80 Thread service_thread_; |
| 80 std::unique_ptr<TaskTracker> task_tracker_; | 81 std::unique_ptr<TaskTracker> task_tracker_; |
| 81 std::unique_ptr<DelayedTaskManager> delayed_task_manager_; | 82 std::unique_ptr<DelayedTaskManager> delayed_task_manager_; |
| 82 const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_; | 83 const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_; |
| 83 std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_; | 84 std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_; |
| 84 | 85 |
| 86 std::unique_ptr<SchedulerSingleThreadWorkerPoolManager> |
| 87 scheduler_single_thread_worker_pool_manager_; |
| 88 |
| 85 #if DCHECK_IS_ON() | 89 #if DCHECK_IS_ON() |
| 86 // Set once JoinForTesting() has returned. | 90 // Set once JoinForTesting() has returned. |
| 87 AtomicFlag join_for_testing_returned_; | 91 AtomicFlag join_for_testing_returned_; |
| 88 #endif | 92 #endif |
| 89 | 93 |
| 90 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); | 94 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); |
| 91 }; | 95 }; |
| 92 | 96 |
| 93 } // namespace internal | 97 } // namespace internal |
| 94 } // namespace base | 98 } // namespace base |
| 95 | 99 |
| 96 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 100 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
| OLD | NEW |