| Index: base/task_scheduler/scheduler_thread_pool.cc
|
| diff --git a/base/task_scheduler/scheduler_thread_pool.cc b/base/task_scheduler/scheduler_thread_pool.cc
|
| index a1a22180df6428ae3e8dcebd4e50b677337e26cc..06841591b88fd3323cdf0381aa42edcfcd0cf28a 100644
|
| --- a/base/task_scheduler/scheduler_thread_pool.cc
|
| +++ b/base/task_scheduler/scheduler_thread_pool.cc
|
| @@ -140,9 +140,10 @@ std::unique_ptr<SchedulerThreadPool> SchedulerThreadPool::CreateThreadPool(
|
| const EnqueueSequenceCallback& enqueue_sequence_callback,
|
| TaskTracker* task_tracker,
|
| DelayedTaskManager* delayed_task_manager) {
|
| - std::unique_ptr<SchedulerThreadPool> thread_pool(new SchedulerThreadPool(
|
| - enqueue_sequence_callback, task_tracker, delayed_task_manager));
|
| - if (thread_pool->Initialize(thread_priority, max_threads))
|
| + std::unique_ptr<SchedulerThreadPool> thread_pool(
|
| + new SchedulerThreadPool(task_tracker, delayed_task_manager));
|
| + if (thread_pool->Initialize(thread_priority, max_threads,
|
| + enqueue_sequence_callback))
|
| return thread_pool;
|
| return nullptr;
|
| }
|
| @@ -296,32 +297,32 @@ void SchedulerThreadPool::SchedulerWorkerThreadDelegateImpl::EnqueueSequence(
|
| }
|
|
|
| SchedulerThreadPool::SchedulerThreadPool(
|
| - const EnqueueSequenceCallback& enqueue_sequence_callback,
|
| TaskTracker* task_tracker,
|
| DelayedTaskManager* delayed_task_manager)
|
| : idle_worker_threads_stack_lock_(shared_priority_queue_.container_lock()),
|
| idle_worker_threads_stack_cv_for_testing_(
|
| idle_worker_threads_stack_lock_.CreateConditionVariable()),
|
| join_for_testing_returned_(true, false),
|
| - worker_thread_delegate_(
|
| - new SchedulerWorkerThreadDelegateImpl(this,
|
| - enqueue_sequence_callback)),
|
| task_tracker_(task_tracker),
|
| delayed_task_manager_(delayed_task_manager) {
|
| DCHECK(task_tracker_);
|
| DCHECK(delayed_task_manager_);
|
| }
|
|
|
| -bool SchedulerThreadPool::Initialize(ThreadPriority thread_priority,
|
| - size_t max_threads) {
|
| +bool SchedulerThreadPool::Initialize(
|
| + ThreadPriority thread_priority,
|
| + size_t max_threads,
|
| + const EnqueueSequenceCallback& enqueue_sequence_callback) {
|
| AutoSchedulerLock auto_lock(idle_worker_threads_stack_lock_);
|
|
|
| DCHECK(worker_threads_.empty());
|
|
|
| for (size_t i = 0; i < max_threads; ++i) {
|
| std::unique_ptr<SchedulerWorkerThread> worker_thread =
|
| - SchedulerWorkerThread::CreateSchedulerWorkerThread(
|
| - thread_priority, worker_thread_delegate_.get(), task_tracker_);
|
| + SchedulerWorkerThread::CreateWorkerThread(
|
| + thread_priority, WrapUnique(new SchedulerWorkerThreadDelegateImpl(
|
| + this, enqueue_sequence_callback)),
|
| + task_tracker_);
|
| if (!worker_thread)
|
| break;
|
| idle_worker_threads_stack_.Push(worker_thread.get());
|
|
|