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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 public: | 241 public: |
242 SequencedWorkerPoolTest() | 242 SequencedWorkerPoolTest() |
243 : pool_owner_(new SequencedWorkerPoolOwner(kNumWorkerThreads, "test")), | 243 : pool_owner_(new SequencedWorkerPoolOwner(kNumWorkerThreads, "test")), |
244 tracker_(new TestTracker) {} | 244 tracker_(new TestTracker) {} |
245 | 245 |
246 void SetUp() override { | 246 void SetUp() override { |
247 if (RedirectedToTaskScheduler()) { | 247 if (RedirectedToTaskScheduler()) { |
248 std::vector<SchedulerWorkerPoolParams> worker_pool_params; | 248 std::vector<SchedulerWorkerPoolParams> worker_pool_params; |
249 worker_pool_params.emplace_back( | 249 worker_pool_params.emplace_back( |
250 "SchedulerWorkerPoolName", ThreadPriority::NORMAL, | 250 "SchedulerWorkerPoolName", ThreadPriority::NORMAL, |
251 SchedulerWorkerPoolParams::IORestriction::ALLOWED, kNumWorkerThreads, | 251 SchedulerWorkerPoolParams::IORestriction::ALLOWED, |
252 TimeDelta::Max()); | 252 SchedulerWorkerPoolParams::StandbyThreadPolicy::LAZY, |
| 253 kNumWorkerThreads, TimeDelta::Max()); |
253 TaskScheduler::CreateAndSetDefaultTaskScheduler( | 254 TaskScheduler::CreateAndSetDefaultTaskScheduler( |
254 std::move(worker_pool_params), | 255 std::move(worker_pool_params), |
255 base::Bind([](const TaskTraits&) -> size_t { return 0U; })); | 256 base::Bind([](const TaskTraits&) -> size_t { return 0U; })); |
256 SequencedWorkerPool::ResetRedirectToTaskSchedulerForProcessForTesting(); | 257 SequencedWorkerPool::ResetRedirectToTaskSchedulerForProcessForTesting(); |
257 SequencedWorkerPool::RedirectToTaskSchedulerForProcess(); | 258 SequencedWorkerPool::RedirectToTaskSchedulerForProcess(); |
258 } | 259 } |
259 } | 260 } |
260 | 261 |
261 void TearDown() override { | 262 void TearDown() override { |
262 // Wait until all references to the SequencedWorkerPool are gone and destroy | 263 // Wait until all references to the SequencedWorkerPool are gone and destroy |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, | 1232 SequencedWorkerPoolSequencedTaskRunner, SequencedTaskRunnerTest, |
1232 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1233 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
1233 INSTANTIATE_TYPED_TEST_CASE_P( | 1234 INSTANTIATE_TYPED_TEST_CASE_P( |
1234 SequencedWorkerPoolSequencedTaskRunner, | 1235 SequencedWorkerPoolSequencedTaskRunner, |
1235 SequencedTaskRunnerDelayedTest, | 1236 SequencedTaskRunnerDelayedTest, |
1236 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); | 1237 SequencedWorkerPoolSequencedTaskRunnerTestDelegate); |
1237 | 1238 |
1238 } // namespace | 1239 } // namespace |
1239 | 1240 |
1240 } // namespace base | 1241 } // namespace base |
OLD | NEW |