Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Unified Diff: base/task_scheduler/task_scheduler_impl.h

Issue 2749303002: [reference - do not submit] Always create four pools in TaskSchedulerImpl. (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/task_scheduler/task_scheduler.cc ('k') | base/task_scheduler/task_scheduler_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/task_scheduler/task_scheduler_impl.h
diff --git a/base/task_scheduler/task_scheduler_impl.h b/base/task_scheduler/task_scheduler_impl.h
index 5a83d0a6dbeacdc4271e8dbdefb7b59352522ad9..c510ac66e9239c21e111a7588148a1f3ccfa0ead 100644
--- a/base/task_scheduler/task_scheduler_impl.h
+++ b/base/task_scheduler/task_scheduler_impl.h
@@ -9,7 +9,6 @@
#include <vector>
#include "base/base_export.h"
-#include "base/callback.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
@@ -23,7 +22,6 @@
namespace base {
class HistogramBase;
-class SchedulerWorkerPoolParams;
namespace internal {
@@ -35,13 +33,12 @@ class TaskTracker;
class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler {
public:
// Creates and returns an initialized TaskSchedulerImpl. CHECKs on failure.
- // |worker_pool_params_vector| describes the worker pools to create.
- // |worker_pool_index_for_traits_callback| returns the index in |worker_pools|
- // of the worker pool in which a task with given traits should run.
+ // |name| is used to label threads and histograms. It should identify the
+ // component that creates the TaskScheduler. |init_params| is used to
+ // initialize the worker pools.
static std::unique_ptr<TaskSchedulerImpl> Create(
- const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector,
- const WorkerPoolIndexForTraitsCallback&
- worker_pool_index_for_traits_callback);
+ const std::string& name,
+ const TaskSchedulerInitParams& init_params);
~TaskSchedulerImpl() override;
@@ -64,11 +61,9 @@ class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler {
void JoinForTesting() override;
private:
- explicit TaskSchedulerImpl(const WorkerPoolIndexForTraitsCallback&
- worker_pool_index_for_traits_callback);
+ TaskSchedulerImpl(const std::string& name);
- void Initialize(
- const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector);
+ void Initialize(const TaskSchedulerInitParams& init_params);
// Returns the worker pool that runs Tasks with |traits|.
SchedulerWorkerPoolImpl* GetWorkerPoolForTraits(
@@ -78,13 +73,13 @@ class BASE_EXPORT TaskSchedulerImpl : public TaskScheduler {
// worker pops a Task from it.
void ReEnqueueSequenceCallback(scoped_refptr<Sequence> sequence);
+ const std::string name_;
Thread service_thread_;
std::unique_ptr<TaskTracker> task_tracker_;
std::unique_ptr<DelayedTaskManager> delayed_task_manager_;
std::unique_ptr<SchedulerSingleThreadTaskRunnerManager>
single_thread_task_runner_manager_;
- const WorkerPoolIndexForTraitsCallback worker_pool_index_for_traits_callback_;
- std::vector<std::unique_ptr<SchedulerWorkerPoolImpl>> worker_pools_;
+ std::unique_ptr<SchedulerWorkerPoolImpl> worker_pools_[4];
#if DCHECK_IS_ON()
// Set once JoinForTesting() has returned.
« no previous file with comments | « base/task_scheduler/task_scheduler.cc ('k') | base/task_scheduler/task_scheduler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698