Index: base/task_scheduler/scheduler_worker_pool_impl.h |
diff --git a/base/task_scheduler/scheduler_worker_pool_impl.h b/base/task_scheduler/scheduler_worker_pool_impl.h |
index 0c1fdcd13a2e71506164efb7abc4dff420f295ea..4617df5496ee4318c819008331253721d634e3cf 100644 |
--- a/base/task_scheduler/scheduler_worker_pool_impl.h |
+++ b/base/task_scheduler/scheduler_worker_pool_impl.h |
@@ -25,6 +25,7 @@ |
#include "base/task_scheduler/scheduler_worker_stack.h" |
#include "base/task_scheduler/sequence.h" |
#include "base/task_scheduler/task.h" |
+#include "base/threading/platform_thread.h" |
#include "base/time/time.h" |
namespace base { |
@@ -50,13 +51,18 @@ class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool { |
// JoinForTesting() has returned. |
~SchedulerWorkerPoolImpl() override; |
- // Creates a SchedulerWorkerPoolImpl following the |worker_pool_params| |
- // specification. |re_enqueue_sequence_callback| will be invoked after a |
- // worker of this worker pool tries to run a Task. |task_tracker| is used to |
- // handle shutdown behavior of Tasks. |delayed_task_manager| handles Tasks |
- // posted with a delay. Returns nullptr on failure to create a worker pool |
- // with at least one thread. |
+ // Creates a SchedulerWorkerPoolImpl. |name| is used to label the pool's |
+ // threads ("TaskScheduler" + |name| + index) and histograms ("TaskScheduler." |
+ // + histogram name + "." + |name|). |priority_hint| is the preferred thread |
+ // priority; the actual thread priority depends on shutdown state and platform |
+ // capabilities. |params| contains additional thread creation params. |
+ // |re_enqueue_sequence_callback| is invoked after a worker tries to run a |
+ // Task. |task_tracker| is used to handle shutdown behavior of Tasks. |
+ // |delayed_task_manager| handles Tasks posted with a delay. Returns nullptr |
+ // on failure to create a worker pool with at least one thread. |
static std::unique_ptr<SchedulerWorkerPoolImpl> Create( |
+ const std::string& name, |
+ ThreadPriority priority_hint, |
const SchedulerWorkerPoolParams& params, |
const ReEnqueueSequenceCallback& re_enqueue_sequence_callback, |
TaskTracker* task_tracker, |
@@ -109,11 +115,13 @@ class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool { |
private: |
class SchedulerWorkerDelegateImpl; |
- SchedulerWorkerPoolImpl(const SchedulerWorkerPoolParams& params, |
+ SchedulerWorkerPoolImpl(const std::string& name, |
+ const SchedulerWorkerPoolParams& params, |
TaskTracker* task_tracker, |
DelayedTaskManager* delayed_task_manager); |
bool Initialize( |
+ ThreadPriority priority_hint, |
const SchedulerWorkerPoolParams& params, |
const ReEnqueueSequenceCallback& re_enqueue_sequence_callback); |
@@ -132,7 +140,7 @@ class BASE_EXPORT SchedulerWorkerPoolImpl : public SchedulerWorkerPool { |
// Returns true if worker thread detachment is permitted. |
bool CanWorkerDetachForTesting(); |
- // The name of this worker pool, used to label its worker threads. |
+ // The name of this worker pool, used to label threads and histograms. |
const std::string name_; |
// All worker owned by this worker pool. Only modified during initialization |