OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/task_scheduler/scheduler_worker_pool_impl.h" | 5 #include "base/task_scheduler/scheduler_worker_pool_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <unordered_set> | 10 #include <unordered_set> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 "TestWorkerPool", ThreadPriority::NORMAL, | 84 "TestWorkerPool", ThreadPriority::NORMAL, |
85 Bind(&TaskSchedulerWorkerPoolImplTest::ReEnqueueSequenceCallback, | 85 Bind(&TaskSchedulerWorkerPoolImplTest::ReEnqueueSequenceCallback, |
86 Unretained(this)), | 86 Unretained(this)), |
87 &task_tracker_, &delayed_task_manager_); | 87 &task_tracker_, &delayed_task_manager_); |
88 ASSERT_TRUE(worker_pool_); | 88 ASSERT_TRUE(worker_pool_); |
89 } | 89 } |
90 | 90 |
91 void StartWorkerPool(TimeDelta suggested_reclaim_time, size_t num_workers) { | 91 void StartWorkerPool(TimeDelta suggested_reclaim_time, size_t num_workers) { |
92 ASSERT_TRUE(worker_pool_); | 92 ASSERT_TRUE(worker_pool_); |
93 worker_pool_->Start(SchedulerWorkerPoolParams( | 93 worker_pool_->Start(SchedulerWorkerPoolParams( |
94 "TestWorkerPool", ThreadPriority::NORMAL, StandbyThreadPolicy::LAZY, | 94 StandbyThreadPolicy::LAZY, num_workers, suggested_reclaim_time)); |
95 num_workers, suggested_reclaim_time)); | |
96 } | 95 } |
97 | 96 |
98 void CreateAndStartWorkerPool(TimeDelta suggested_reclaim_time, | 97 void CreateAndStartWorkerPool(TimeDelta suggested_reclaim_time, |
99 size_t num_workers) { | 98 size_t num_workers) { |
100 CreateWorkerPool(); | 99 CreateWorkerPool(); |
101 StartWorkerPool(suggested_reclaim_time, num_workers); | 100 StartWorkerPool(suggested_reclaim_time, num_workers); |
102 } | 101 } |
103 | 102 |
104 std::unique_ptr<SchedulerWorkerPoolImpl> worker_pool_; | 103 std::unique_ptr<SchedulerWorkerPoolImpl> worker_pool_; |
105 | 104 |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 &delayed_task_manager); | 814 &delayed_task_manager); |
816 worker_pool->Start(SchedulerWorkerPoolParams(StandbyThreadPolicy::ONE, 8U, | 815 worker_pool->Start(SchedulerWorkerPoolParams(StandbyThreadPolicy::ONE, 8U, |
817 TimeDelta::Max())); | 816 TimeDelta::Max())); |
818 ASSERT_TRUE(worker_pool); | 817 ASSERT_TRUE(worker_pool); |
819 EXPECT_EQ(1U, worker_pool->NumberOfAliveWorkersForTesting()); | 818 EXPECT_EQ(1U, worker_pool->NumberOfAliveWorkersForTesting()); |
820 worker_pool->JoinForTesting(); | 819 worker_pool->JoinForTesting(); |
821 } | 820 } |
822 | 821 |
823 } // namespace internal | 822 } // namespace internal |
824 } // namespace base | 823 } // namespace base |
OLD | NEW |