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