OLD | NEW |
(Empty) | |
| 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 |
| 5 #ifndef COMPONENTS_TASK_SCHEDULER_UTIL_BROWSER_INITIALIZATION_H_ |
| 6 #define COMPONENTS_TASK_SCHEDULER_UTIL_BROWSER_INITIALIZATION_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 #include <map> |
| 11 #include <string> |
| 12 #include <vector> |
| 13 |
| 14 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
| 15 #include "build/build_config.h" |
| 16 |
| 17 namespace base { |
| 18 class TaskTraits; |
| 19 } |
| 20 |
| 21 namespace task_scheduler_util { |
| 22 |
| 23 // Gets a vector of SchedulerWorkerPoolParams to initialize TaskScheduler in the |
| 24 // browser based off variations. Returns an empty vector on failure. |
| 25 std::vector<base::SchedulerWorkerPoolParams> |
| 26 GetBrowserWorkerPoolParamsFromVariations(); |
| 27 |
| 28 #if defined(OS_IOS) |
| 29 // Returns a default vector of SchedulerWorkerPoolParams to initialize |
| 30 // TaskScheduler in the browser. |
| 31 std::vector<base::SchedulerWorkerPoolParams> |
| 32 GetDefaultBrowserWorkerPoolParams(); |
| 33 #endif |
| 34 |
| 35 // Maps |traits| to the index of a browser worker pool vector provided by |
| 36 // GetBrowserWorkerPoolParamsFromVariations() or |
| 37 // GetDefaultBrowserWorkerPoolParams(). |
| 38 size_t BrowserWorkerPoolIndexForTraits(const base::TaskTraits& traits); |
| 39 |
| 40 // Redirects zero-to-many PostTask APIs to the browser task scheduler based off |
| 41 // variations. |
| 42 void MaybePerformBrowserTaskSchedulerRedirection(); |
| 43 |
| 44 } // namespace task_scheduler_util |
| 45 |
| 46 #endif // COMPONENTS_TASK_SCHEDULER_UTIL_BROWSER_INITIALIZATION_H_ |
OLD | NEW |