| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 } | 273 } |
| 274 TestTracker* tracker() { return tracker_.get(); } | 274 TestTracker* tracker() { return tracker_.get(); } |
| 275 | 275 |
| 276 // Waits until no tasks are running in the SequencedWorkerPool and no | 276 // Waits until no tasks are running in the SequencedWorkerPool and no |
| 277 // reference to it remain. Then, destroys the SequencedWorkerPool. | 277 // reference to it remain. Then, destroys the SequencedWorkerPool. |
| 278 void DeletePool() { pool_owner_.reset(); } | 278 void DeletePool() { pool_owner_.reset(); } |
| 279 | 279 |
| 280 // Destroys and unregisters the registered TaskScheduler, if any. | 280 // Destroys and unregisters the registered TaskScheduler, if any. |
| 281 void DeleteTaskScheduler() { | 281 void DeleteTaskScheduler() { |
| 282 if (TaskScheduler::GetInstance()) { | 282 if (TaskScheduler::GetInstance()) { |
| 283 static_cast<internal::TaskSchedulerImpl*>(TaskScheduler::GetInstance()) | 283 TaskScheduler::GetInstance()->JoinForTesting(); |
| 284 ->JoinForTesting(); | |
| 285 TaskScheduler::SetInstance(nullptr); | 284 TaskScheduler::SetInstance(nullptr); |
| 286 } | 285 } |
| 287 } | 286 } |
| 288 | 287 |
| 289 void SetWillWaitForShutdownCallback(const Closure& callback) { | 288 void SetWillWaitForShutdownCallback(const Closure& callback) { |
| 290 pool_owner_->SetWillWaitForShutdownCallback(callback); | 289 pool_owner_->SetWillWaitForShutdownCallback(callback); |
| 291 } | 290 } |
| 292 | 291 |
| 293 // Ensures that the given number of worker threads is created by adding | 292 // Ensures that the given number of worker threads is created by adding |
| 294 // tasks and waiting until they complete. Worker thread creation is | 293 // tasks and waiting until they complete. Worker thread creation is |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1224 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 1223 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
| 1225 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1224 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
| 1226 INSTANTIATE_TYPED_TEST_CASE_P( | 1225 INSTANTIATE_TYPED_TEST_CASE_P( |
| 1227 SequencedWorkerPoolSequencedTaskRunner, | 1226 SequencedWorkerPoolSequencedTaskRunner, |
| 1228 SequencedTaskRunnerDelayedTest, | 1227 SequencedTaskRunnerDelayedTest, |
| 1229 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1228 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
| 1230 | 1229 |
| 1231 } // namespace | 1230 } // namespace |
| 1232 | 1231 |
| 1233 } // namespace base | 1232 } // namespace base |
| OLD | NEW |