| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 public: | 240 public: |
| 241 SequencedWorkerPoolTest() | 241 SequencedWorkerPoolTest() |
| 242 : pool_owner_(new SequencedWorkerPoolOwner(kNumWorkerThreads, "test")), | 242 : pool_owner_(new SequencedWorkerPoolOwner(kNumWorkerThreads, "test")), |
| 243 tracker_(new TestTracker) {} | 243 tracker_(new TestTracker) {} |
| 244 | 244 |
| 245 void SetUp() override { | 245 void SetUp() override { |
| 246 if (RedirectedToTaskScheduler()) { | 246 if (RedirectedToTaskScheduler()) { |
| 247 const SchedulerWorkerPoolParams worker_pool_params( | 247 const SchedulerWorkerPoolParams worker_pool_params( |
| 248 SchedulerWorkerPoolParams::StandbyThreadPolicy::LAZY, | 248 SchedulerWorkerPoolParams::StandbyThreadPolicy::LAZY, |
| 249 static_cast<int>(kNumWorkerThreads), TimeDelta::Max()); | 249 static_cast<int>(kNumWorkerThreads), TimeDelta::Max()); |
| 250 TaskScheduler::CreateAndSetDefaultTaskScheduler( | 250 TaskScheduler::Create("SequencedWorkerPoolTest"); |
| 251 "SequencedWorkerPoolTest", {worker_pool_params, worker_pool_params, | 251 TaskScheduler::GetInstance()->Start( |
| 252 worker_pool_params, worker_pool_params}); | 252 {worker_pool_params, worker_pool_params, worker_pool_params, |
| 253 worker_pool_params}); |
| 253 | 254 |
| 254 // Unit tests run in an environment where SequencedWorkerPool is enabled | 255 // Unit tests run in an environment where SequencedWorkerPool is enabled |
| 255 // without redirection to TaskScheduler. For the current unit test, | 256 // without redirection to TaskScheduler. For the current unit test, |
| 256 // disable it and re-enable it with redirection to TaskScheduler. | 257 // disable it and re-enable it with redirection to TaskScheduler. |
| 257 SequencedWorkerPool::DisableForProcessForTesting(); | 258 SequencedWorkerPool::DisableForProcessForTesting(); |
| 258 SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess(); | 259 SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess(); |
| 259 } | 260 } |
| 260 } | 261 } |
| 261 | 262 |
| 262 void TearDown() override { | 263 void TearDown() override { |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 1223 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
| 1223 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1224 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
| 1224 INSTANTIATE_TYPED_TEST_CASE_P( | 1225 INSTANTIATE_TYPED_TEST_CASE_P( |
| 1225 SequencedWorkerPoolSequencedTaskRunner, | 1226 SequencedWorkerPoolSequencedTaskRunner, |
| 1226 SequencedTaskRunnerDelayedTest, | 1227 SequencedTaskRunnerDelayedTest, |
| 1227 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1228 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
| 1228 | 1229 |
| 1229 } // namespace | 1230 } // namespace |
| 1230 | 1231 |
| 1231 } // namespace base | 1232 } // namespace base |
| OLD | NEW |