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 #include "base/task_scheduler/task_scheduler_impl.h" | 5 #include "base/task_scheduler/task_scheduler_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 MessageLoop::TYPE_DEFAULT; | 97 MessageLoop::TYPE_DEFAULT; |
98 #endif | 98 #endif |
99 service_thread_options.timer_slack = TIMER_SLACK_MAXIMUM; | 99 service_thread_options.timer_slack = TIMER_SLACK_MAXIMUM; |
100 CHECK(service_thread_.StartWithOptions(service_thread_options)); | 100 CHECK(service_thread_.StartWithOptions(service_thread_options)); |
101 | 101 |
102 #if defined(OS_POSIX) && !defined(OS_NACL_SFI) | 102 #if defined(OS_POSIX) && !defined(OS_NACL_SFI) |
103 // Needs to happen after starting the service thread to get its | 103 // Needs to happen after starting the service thread to get its |
104 // message_loop(). | 104 // message_loop(). |
105 task_tracker_.set_watch_file_descriptor_message_loop( | 105 task_tracker_.set_watch_file_descriptor_message_loop( |
106 static_cast<MessageLoopForIO*>(service_thread_.message_loop())); | 106 static_cast<MessageLoopForIO*>(service_thread_.message_loop())); |
107 #endif | 107 |
| 108 #if DCHECK_IS_ON() |
| 109 task_tracker_.set_service_thread_handle(service_thread_.GetThreadHandle()); |
| 110 #endif // DCHECK_IS_ON() |
| 111 #endif // defined(OS_POSIX) && !defined(OS_NACL_SFI) |
108 | 112 |
109 // Needs to happen after starting the service thread to get its task_runner(). | 113 // Needs to happen after starting the service thread to get its task_runner(). |
110 delayed_task_manager_.Start(service_thread_.task_runner()); | 114 delayed_task_manager_.Start(service_thread_.task_runner()); |
111 | 115 |
112 single_thread_task_runner_manager_.Start(); | 116 single_thread_task_runner_manager_.Start(); |
113 | 117 |
114 worker_pools_[BACKGROUND]->Start(init_params.background_worker_pool_params); | 118 worker_pools_[BACKGROUND]->Start(init_params.background_worker_pool_params); |
115 worker_pools_[BACKGROUND_BLOCKING]->Start( | 119 worker_pools_[BACKGROUND_BLOCKING]->Start( |
116 init_params.background_blocking_worker_pool_params); | 120 init_params.background_blocking_worker_pool_params); |
117 worker_pools_[FOREGROUND]->Start(init_params.foreground_worker_pool_params); | 121 worker_pools_[FOREGROUND]->Start(init_params.foreground_worker_pool_params); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // in |sequence|. | 220 // in |sequence|. |
217 const TaskTraits traits = | 221 const TaskTraits traits = |
218 sequence->PeekTaskTraits().WithPriority(sort_key.priority()); | 222 sequence->PeekTaskTraits().WithPriority(sort_key.priority()); |
219 | 223 |
220 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), | 224 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), |
221 sort_key); | 225 sort_key); |
222 } | 226 } |
223 | 227 |
224 } // namespace internal | 228 } // namespace internal |
225 } // namespace base | 229 } // namespace base |
OLD | NEW |