| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 void TaskSchedulerImpl::FlushForTesting() { | 87 void TaskSchedulerImpl::FlushForTesting() { |
| 88 DCHECK(task_tracker_); | 88 DCHECK(task_tracker_); |
| 89 task_tracker_->Flush(); | 89 task_tracker_->Flush(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void TaskSchedulerImpl::JoinForTesting() { | 92 void TaskSchedulerImpl::JoinForTesting() { |
| 93 #if DCHECK_IS_ON() | 93 #if DCHECK_IS_ON() |
| 94 DCHECK(!join_for_testing_returned_.IsSet()); | 94 DCHECK(!join_for_testing_returned_.IsSet()); |
| 95 #endif | 95 #endif |
| 96 for (const auto& worker_pool : worker_pools_) | 96 for (const auto& worker_pool : worker_pools_) |
| 97 worker_pool->DisallowWorkerDetachmentForTesting(); |
| 98 for (const auto& worker_pool : worker_pools_) |
| 97 worker_pool->JoinForTesting(); | 99 worker_pool->JoinForTesting(); |
| 98 service_thread_.Stop(); | 100 service_thread_.Stop(); |
| 99 #if DCHECK_IS_ON() | 101 #if DCHECK_IS_ON() |
| 100 join_for_testing_returned_.Set(); | 102 join_for_testing_returned_.Set(); |
| 101 #endif | 103 #endif |
| 102 } | 104 } |
| 103 | 105 |
| 104 TaskSchedulerImpl::TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback& | 106 TaskSchedulerImpl::TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback& |
| 105 worker_pool_index_for_traits_callback) | 107 worker_pool_index_for_traits_callback) |
| 106 : service_thread_("TaskSchedulerServiceThread"), | 108 : service_thread_("TaskSchedulerServiceThread"), |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // in |sequence|. | 179 // in |sequence|. |
| 178 const TaskTraits traits = | 180 const TaskTraits traits = |
| 179 sequence->PeekTaskTraits().WithPriority(sort_key.priority()); | 181 sequence->PeekTaskTraits().WithPriority(sort_key.priority()); |
| 180 | 182 |
| 181 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), | 183 GetWorkerPoolForTraits(traits)->ReEnqueueSequence(std::move(sequence), |
| 182 sort_key); | 184 sort_key); |
| 183 } | 185 } |
| 184 | 186 |
| 185 } // namespace internal | 187 } // namespace internal |
| 186 } // namespace base | 188 } // namespace base |
| OLD | NEW |