| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const Closure& task) override; | 55 const Closure& task) override; |
| 56 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( | 56 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
| 57 const TaskTraits& traits) override; | 57 const TaskTraits& traits) override; |
| 58 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( | 58 scoped_refptr<SequencedTaskRunner> CreateSequencedTaskRunnerWithTraits( |
| 59 const TaskTraits& traits) override; | 59 const TaskTraits& traits) override; |
| 60 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( | 60 scoped_refptr<SingleThreadTaskRunner> CreateSingleThreadTaskRunnerWithTraits( |
| 61 const TaskTraits& traits) override; | 61 const TaskTraits& traits) override; |
| 62 std::vector<const HistogramBase*> GetHistograms() const override; | 62 std::vector<const HistogramBase*> GetHistograms() const override; |
| 63 void Shutdown() override; | 63 void Shutdown() override; |
| 64 void FlushForTesting() override; | 64 void FlushForTesting() override; |
| 65 void JoinForTesting() override; | 65 |
| 66 // Joins all threads. Tasks that are already running are allowed to complete |
| 67 // their execution. This can only be called once. |
| 68 void JoinForTesting(); |
| 66 | 69 |
| 67 private: | 70 private: |
| 68 explicit TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback& | 71 explicit TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback& |
| 69 worker_pool_index_for_traits_callback); | 72 worker_pool_index_for_traits_callback); |
| 70 | 73 |
| 71 void Initialize( | 74 void Initialize( |
| 72 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector); | 75 const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector); |
| 73 | 76 |
| 74 // Returns the worker pool that runs Tasks with |traits|. | 77 // Returns the worker pool that runs Tasks with |traits|. |
| 75 SchedulerWorkerPool* GetWorkerPoolForTraits(const TaskTraits& traits); | 78 SchedulerWorkerPool* GetWorkerPoolForTraits(const TaskTraits& traits); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 AtomicFlag join_for_testing_returned_; | 92 AtomicFlag join_for_testing_returned_; |
| 90 #endif | 93 #endif |
| 91 | 94 |
| 92 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); | 95 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); |
| 93 }; | 96 }; |
| 94 | 97 |
| 95 } // namespace internal | 98 } // namespace internal |
| 96 } // namespace base | 99 } // namespace base |
| 97 | 100 |
| 98 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 101 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
| OLD | NEW |