fdoray | 4b4ca652 | 2016-12-19 15:58:37 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Francois Doray | 02af3e8 | 2018-04-13 13:04:22 | [diff] [blame] | 5 | #ifndef COMPONENTS_TASK_SCHEDULER_UTIL_VARIATIONS_UTIL_H_ |
| 6 | #define COMPONENTS_TASK_SCHEDULER_UTIL_VARIATIONS_UTIL_H_ |
fdoray | 4b4ca652 | 2016-12-19 15:58:37 | [diff] [blame] | 7 | |
fdoray | fd083b7 | 2017-04-04 13:45:01 | [diff] [blame] | 8 | #include <memory> |
fdoray | 4b4ca652 | 2016-12-19 15:58:37 | [diff] [blame] | 9 | |
Etienne Pierre-Doray | 30c8761 | 2018-12-10 23:23:43 | [diff] [blame] | 10 | #include "base/feature_list.h" |
fdoray | 1e3963f | 2017-01-07 00:30:29 | [diff] [blame] | 11 | #include "base/strings/string_piece.h" |
Gabriel Charette | 44db142 | 2018-08-06 11:19:33 | [diff] [blame] | 12 | #include "base/task/task_scheduler/task_scheduler.h" |
fdoray | 1e3963f | 2017-01-07 00:30:29 | [diff] [blame] | 13 | |
fdoray | 4b4ca652 | 2016-12-19 15:58:37 | [diff] [blame] | 14 | namespace task_scheduler_util { |
| 15 | |
Etienne Pierre-Doray | 30c8761 | 2018-12-10 23:23:43 | [diff] [blame] | 16 | extern const base::Feature kBrowserSchedulerInitParams; |
| 17 | extern const base::Feature kRendererSchedulerInitParams; |
| 18 | |
Francois Doray | 9626f0d | 2018-02-08 19:06:29 | [diff] [blame] | 19 | // Builds a TaskScheduler::InitParams from variations params that are prefixed |
Etienne Pierre-Doray | 30c8761 | 2018-12-10 23:23:43 | [diff] [blame] | 20 | // for |feature|. Returns nullptr on failure. |
Francois Doray | 7f56fd8 | 2018-02-16 14:49:45 | [diff] [blame] | 21 | // |
| 22 | // TODO(fdoray): Move this to the anonymous namespace in the .cc file. |
| 23 | // https://crbug.com/810049 |
Francois Doray | 9626f0d | 2018-02-08 19:06:29 | [diff] [blame] | 24 | std::unique_ptr<base::TaskScheduler::InitParams> GetTaskSchedulerInitParams( |
Etienne Pierre-Doray | 30c8761 | 2018-12-10 23:23:43 | [diff] [blame] | 25 | const base::Feature& feature); |
Francois Doray | 9626f0d | 2018-02-08 19:06:29 | [diff] [blame] | 26 | |
Francois Doray | 7f56fd8 | 2018-02-16 14:49:45 | [diff] [blame] | 27 | // Builds a TaskScheduler::InitParams to use in the browser process from |
| 28 | // variation params in the BrowserScheduler field trial. |
| 29 | std::unique_ptr<base::TaskScheduler::InitParams> |
| 30 | GetTaskSchedulerInitParamsForBrowser(); |
| 31 | |
| 32 | // Builds a TaskScheduler::InitParams to use in renderer processes from |
| 33 | // variation params in the BrowserScheduler field trial. |
| 34 | std::unique_ptr<base::TaskScheduler::InitParams> |
| 35 | GetTaskSchedulerInitParamsForRenderer(); |
| 36 | |
fdoray | 4b4ca652 | 2016-12-19 15:58:37 | [diff] [blame] | 37 | } // namespace task_scheduler_util |
| 38 | |
Francois Doray | 02af3e8 | 2018-04-13 13:04:22 | [diff] [blame] | 39 | #endif // COMPONENTS_TASK_SCHEDULER_UTIL_VARIATIONS_UTIL_H_ |