| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/threading/sequenced_worker_pool.h" | 5 #include "base/threading/sequenced_worker_pool.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 } | 280 } |
| 281 TestTracker* tracker() { return tracker_.get(); } | 281 TestTracker* tracker() { return tracker_.get(); } |
| 282 | 282 |
| 283 // Waits until no tasks are running in the SequencedWorkerPool and no | 283 // Waits until no tasks are running in the SequencedWorkerPool and no |
| 284 // reference to it remain. Then, destroys the SequencedWorkerPool. | 284 // reference to it remain. Then, destroys the SequencedWorkerPool. |
| 285 void DeletePool() { pool_owner_.reset(); } | 285 void DeletePool() { pool_owner_.reset(); } |
| 286 | 286 |
| 287 // Destroys and unregisters the registered TaskScheduler, if any. | 287 // Destroys and unregisters the registered TaskScheduler, if any. |
| 288 void DeleteTaskScheduler() { | 288 void DeleteTaskScheduler() { |
| 289 if (TaskScheduler::GetInstance()) { | 289 if (TaskScheduler::GetInstance()) { |
| 290 static_cast<internal::TaskSchedulerImpl*>(TaskScheduler::GetInstance()) | 290 TaskScheduler::GetInstance()->JoinForTesting(); |
| 291 ->JoinForTesting(); | |
| 292 TaskScheduler::SetInstance(nullptr); | 291 TaskScheduler::SetInstance(nullptr); |
| 293 } | 292 } |
| 294 } | 293 } |
| 295 | 294 |
| 296 void SetWillWaitForShutdownCallback(const Closure& callback) { | 295 void SetWillWaitForShutdownCallback(const Closure& callback) { |
| 297 pool_owner_->SetWillWaitForShutdownCallback(callback); | 296 pool_owner_->SetWillWaitForShutdownCallback(callback); |
| 298 } | 297 } |
| 299 | 298 |
| 300 // Ensures that the given number of worker threads is created by adding | 299 // Ensures that the given number of worker threads is created by adding |
| 301 // tasks and waiting until they complete. Worker thread creation is | 300 // tasks and waiting until they complete. Worker thread creation is |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 1230 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
| 1232 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1231 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
| 1233 INSTANTIATE_TYPED_TEST_CASE_P( | 1232 INSTANTIATE_TYPED_TEST_CASE_P( |
| 1234 SequencedWorkerPoolSequencedTaskRunner, | 1233 SequencedWorkerPoolSequencedTaskRunner, |
| 1235 SequencedTaskRunnerDelayedTest, | 1234 SequencedTaskRunnerDelayedTest, |
| 1236 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1235 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
| 1237 | 1236 |
| 1238 } // namespace | 1237 } // namespace |
| 1239 | 1238 |
| 1240 } // namespace base | 1239 } // namespace base |
| OLD | NEW |