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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 } | 290 } |
291 TestTracker* tracker() { return tracker_.get(); } | 291 TestTracker* tracker() { return tracker_.get(); } |
292 | 292 |
293 // Waits until no tasks are running in the SequencedWorkerPool and no | 293 // Waits until no tasks are running in the SequencedWorkerPool and no |
294 // reference to it remain. Then, destroys the SequencedWorkerPool. | 294 // reference to it remain. Then, destroys the SequencedWorkerPool. |
295 void DeletePool() { pool_owner_.reset(); } | 295 void DeletePool() { pool_owner_.reset(); } |
296 | 296 |
297 // Destroys and unregisters the registered TaskScheduler, if any. | 297 // Destroys and unregisters the registered TaskScheduler, if any. |
298 void DeleteTaskScheduler() { | 298 void DeleteTaskScheduler() { |
299 if (TaskScheduler::GetInstance()) { | 299 if (TaskScheduler::GetInstance()) { |
300 static_cast<internal::TaskSchedulerImpl*>(TaskScheduler::GetInstance()) | 300 TaskScheduler::GetInstance()->JoinForTesting(); |
301 ->JoinForTesting(); | |
302 TaskScheduler::SetInstance(nullptr); | 301 TaskScheduler::SetInstance(nullptr); |
303 } | 302 } |
304 } | 303 } |
305 | 304 |
306 void SetWillWaitForShutdownCallback(const Closure& callback) { | 305 void SetWillWaitForShutdownCallback(const Closure& callback) { |
307 pool_owner_->SetWillWaitForShutdownCallback(callback); | 306 pool_owner_->SetWillWaitForShutdownCallback(callback); |
308 } | 307 } |
309 | 308 |
310 // Ensures that the given number of worker threads is created by adding | 309 // Ensures that the given number of worker threads is created by adding |
311 // tasks and waiting until they complete. Worker thread creation is | 310 // tasks and waiting until they complete. Worker thread creation is |
(...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 1240 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
1242 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1241 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
1243 INSTANTIATE_TYPED_TEST_CASE_P( | 1242 INSTANTIATE_TYPED_TEST_CASE_P( |
1244 SequencedWorkerPoolSequencedTaskRunner, | 1243 SequencedWorkerPoolSequencedTaskRunner, |
1245 SequencedTaskRunnerDelayedTest, | 1244 SequencedTaskRunnerDelayedTest, |
1246 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1245 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
1247 | 1246 |
1248 } // namespace | 1247 } // namespace |
1249 | 1248 |
1250 } // namespace base | 1249 } // namespace base |
OLD | NEW |