| Index: base/task_scheduler/task_scheduler.h
|
| diff --git a/base/task_scheduler/task_scheduler.h b/base/task_scheduler/task_scheduler.h
|
| index 4b07c88998ba922f46914f7f88055b939e1947cc..a869858ffb921365ae82246675fa4a38cfcdf535 100644
|
| --- a/base/task_scheduler/task_scheduler.h
|
| +++ b/base/task_scheduler/task_scheduler.h
|
| @@ -15,6 +15,7 @@
|
| #include "base/sequenced_task_runner.h"
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/task_runner.h"
|
| +#include "base/task_scheduler/scheduler_worker_pool_params.h"
|
| #include "base/task_scheduler/task_traits.h"
|
| #include "base/time/time.h"
|
|
|
| @@ -29,7 +30,6 @@ class Location;
|
| namespace base {
|
|
|
| class HistogramBase;
|
| -class SchedulerWorkerPoolParams;
|
|
|
| // Interface for a task scheduler and static methods to manage the instance used
|
| // by the post_task.h API. Note: all base/task_scheduler users should go through
|
| @@ -37,6 +37,22 @@ class SchedulerWorkerPoolParams;
|
| // which manages the process' instance.
|
| class BASE_EXPORT TaskScheduler {
|
| public:
|
| + struct BASE_EXPORT InitParams {
|
| + InitParams(
|
| + const SchedulerWorkerPoolParams& background_worker_pool_params_in,
|
| + const SchedulerWorkerPoolParams&
|
| + background_blocking_worker_pool_params_in,
|
| + const SchedulerWorkerPoolParams& foreground_worker_pool_params_in,
|
| + const SchedulerWorkerPoolParams&
|
| + foreground_blocking_worker_pool_params_in);
|
| + ~InitParams();
|
| +
|
| + const SchedulerWorkerPoolParams background_worker_pool_params;
|
| + const SchedulerWorkerPoolParams background_blocking_worker_pool_params;
|
| + const SchedulerWorkerPoolParams foreground_worker_pool_params;
|
| + const SchedulerWorkerPoolParams foreground_blocking_worker_pool_params;
|
| + };
|
| +
|
| // Returns the index of the worker pool in which a task with |traits| should
|
| // run. This should be coded in a future-proof way: new traits should
|
| // gracefully map to a default pool.
|
| @@ -121,11 +137,24 @@ class BASE_EXPORT TaskScheduler {
|
| // |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. For tests,
|
| // prefer base::test::ScopedTaskScheduler (ensures isolation).
|
| + //
|
| + // Deprecated. Use the overload below instead. https://crbug.com/690706
|
| static void CreateAndSetDefaultTaskScheduler(
|
| const std::vector<SchedulerWorkerPoolParams>& worker_pool_params_vector,
|
| const WorkerPoolIndexForTraitsCallback&
|
| worker_pool_index_for_traits_callback);
|
|
|
| + // Creates and sets a task scheduler using custom params. |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.
|
| + // CHECKs on failure. For tests, prefer base::test::ScopedTaskScheduler
|
| + // (ensures isolation).
|
| + //
|
| + // Note: The names and priority hints in |init_params| are ignored (ref. TODO
|
| + // to remove them).
|
| + static void CreateAndSetDefaultTaskScheduler(const std::string& name,
|
| + const InitParams& init_params);
|
| +
|
| // Registers |task_scheduler| to handle tasks posted through the post_task.h
|
| // API for this process. For tests, prefer base::test::ScopedTaskScheduler
|
| // (ensures isolation).
|
|
|