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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 worker_pool_index_for_traits_callback); | 47 worker_pool_index_for_traits_callback); |
48 | 48 |
49 // Destroying a TaskSchedulerImpl is not allowed in production; it is always | 49 // Destroying a TaskSchedulerImpl is not allowed in production; it is always |
50 // leaked. In tests, it can only be destroyed after JoinForTesting() has | 50 // leaked. In tests, it can only be destroyed after JoinForTesting() has |
51 // returned. | 51 // returned. |
52 ~TaskSchedulerImpl() override; | 52 ~TaskSchedulerImpl() override; |
53 | 53 |
54 // TaskScheduler: | 54 // TaskScheduler: |
55 void PostTaskWithTraits(const tracked_objects::Location& from_here, | 55 void PostTaskWithTraits(const tracked_objects::Location& from_here, |
56 const TaskTraits& traits, | 56 const TaskTraits& traits, |
57 const Closure& task) override; | 57 OnceClosure task) override; |
58 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( | 58 scoped_refptr<TaskRunner> CreateTaskRunnerWithTraits( |
59 const TaskTraits& traits, | 59 const TaskTraits& traits, |
60 ExecutionMode execution_mode) override; | 60 ExecutionMode execution_mode) override; |
61 void Shutdown() override; | 61 void Shutdown() override; |
62 | 62 |
63 // Joins all threads of this scheduler. Tasks that are already running are | 63 // Joins all threads of this scheduler. Tasks that are already running are |
64 // allowed to complete their execution. This can only be called once. | 64 // allowed to complete their execution. This can only be called once. |
65 void JoinForTesting(); | 65 void JoinForTesting(); |
66 | 66 |
67 private: | 67 private: |
(...skipping 25 matching lines...) Expand all Loading... |
93 AtomicFlag join_for_testing_returned_; | 93 AtomicFlag join_for_testing_returned_; |
94 #endif | 94 #endif |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); | 96 DISALLOW_COPY_AND_ASSIGN(TaskSchedulerImpl); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace internal | 99 } // namespace internal |
100 } // namespace base | 100 } // namespace base |
101 | 101 |
102 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ | 102 #endif // BASE_TASK_SCHEDULER_TASK_SCHEDULER_IMPL_H_ |
OLD | NEW |