| Index: base/task_scheduler/scheduler_thread_pool.h
|
| diff --git a/base/task_scheduler/scheduler_thread_pool.h b/base/task_scheduler/scheduler_thread_pool.h
|
| index 75c8a3290cfbc2cb9c2a60a6a40ef8510a841b13..b7094e78ee9863bd302d1ee5ab0260a53a876269 100644
|
| --- a/base/task_scheduler/scheduler_thread_pool.h
|
| +++ b/base/task_scheduler/scheduler_thread_pool.h
|
| @@ -19,6 +19,7 @@
|
| #include "base/task_runner.h"
|
| #include "base/task_scheduler/priority_queue.h"
|
| #include "base/task_scheduler/scheduler_lock.h"
|
| +#include "base/task_scheduler/scheduler_stack.h"
|
| #include "base/task_scheduler/scheduler_task_executor.h"
|
| #include "base/task_scheduler/scheduler_worker_thread.h"
|
| #include "base/task_scheduler/sequence.h"
|
| @@ -97,9 +98,8 @@ class BASE_EXPORT SchedulerThreadPool : public SchedulerTaskExecutor {
|
| // Adds |worker_thread| to |idle_worker_threads_stack_|.
|
| void AddToIdleWorkerThreadsStack(SchedulerWorkerThread* worker_thread);
|
|
|
| - // Pops one idle worker thread from |idle_worker_thread_stack_| and returns
|
| - // it. Returns nullptr if |idle_worker_thread_stack_| is empty.
|
| - SchedulerWorkerThread* PopOneIdleWorkerThread();
|
| + // Removes |worker_thread| from |idle_worker_threads_stack_|.
|
| + void RemoveFromIdleWorkerThreadsStack(SchedulerWorkerThread* worker_thread);
|
|
|
| // PriorityQueue from which all threads of this thread pool get work.
|
| PriorityQueue shared_priority_queue_;
|
| @@ -108,6 +108,9 @@ class BASE_EXPORT SchedulerThreadPool : public SchedulerTaskExecutor {
|
| // initialization of the thread pool.
|
| std::vector<std::unique_ptr<SchedulerWorkerThread>> worker_threads_;
|
|
|
| + // Synchronizes the creation of SINGLE_THREADED TaskRunners.
|
| + SchedulerLock single_thread_task_runner_creation_lock_;
|
| +
|
| // Synchronizes access to |idle_worker_threads_stack_| and
|
| // |idle_worker_threads_stack_cv_for_testing_|. Has |shared_priority_queue_|'s
|
| // lock as its predecessor so that a thread can be pushed to
|
| @@ -115,8 +118,8 @@ class BASE_EXPORT SchedulerThreadPool : public SchedulerTaskExecutor {
|
| // details in GetWork()).
|
| SchedulerLock idle_worker_threads_stack_lock_;
|
|
|
| - // Stack of idle worker threads.
|
| - std::stack<SchedulerWorkerThread*> idle_worker_threads_stack_;
|
| + // Stack of idle worker threads. Values are indexes in |worker_threads_|.
|
| + SchedulerStack idle_worker_threads_stack_;
|
|
|
| // Signaled when all worker threads become idle.
|
| std::unique_ptr<ConditionVariable> idle_worker_threads_stack_cv_for_testing_;
|
|
|