OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_TASK_SCHEDULER_UTIL_COMMON_VARIATIONS_UTIL_H_ | 5 #ifndef COMPONENTS_TASK_SCHEDULER_UTIL_COMMON_VARIATIONS_UTIL_H_ |
6 #define COMPONENTS_TASK_SCHEDULER_UTIL_COMMON_VARIATIONS_UTIL_H_ | 6 #define COMPONENTS_TASK_SCHEDULER_UTIL_COMMON_VARIATIONS_UTIL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/strings/string_piece.h" | |
12 #include "base/task_scheduler/scheduler_worker_pool_params.h" | 13 #include "base/task_scheduler/scheduler_worker_pool_params.h" |
13 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
14 | 15 |
16 namespace base { | |
17 class CommandLine; | |
18 } | |
19 | |
15 namespace task_scheduler_util { | 20 namespace task_scheduler_util { |
16 | 21 |
17 struct SchedulerImmutableWorkerPoolParams { | 22 struct SchedulerImmutableWorkerPoolParams { |
18 SchedulerImmutableWorkerPoolParams(const char* name_in, | 23 SchedulerImmutableWorkerPoolParams(const char* name_in, |
19 base::ThreadPriority priority_hint_in); | 24 base::ThreadPriority priority_hint_in); |
20 | 25 |
21 const char* const name; | 26 const char* const name; |
22 const base::ThreadPriority priority_hint; | 27 const base::ThreadPriority priority_hint; |
23 }; | 28 }; |
24 | 29 |
25 // Returns a SchedulerWorkerPoolParams vector to initialize pools specified in | 30 // Returns a SchedulerWorkerPoolParams vector to initialize pools specified in |
26 // |constant_worker_pool_params_vector|. SchedulerWorkerPoolParams members | 31 // |constant_worker_pool_params_vector|. SchedulerWorkerPoolParams members |
27 // without a counterpart in SchedulerImmutableWorkerPoolParams are initialized | 32 // without a counterpart in SchedulerImmutableWorkerPoolParams are initialized |
28 // based of |variation_params|. Returns an empty vector on failure. | 33 // based of |variation_params|. Returns an empty vector on failure. |
29 std::vector<base::SchedulerWorkerPoolParams> GetWorkerPoolParams( | 34 std::vector<base::SchedulerWorkerPoolParams> GetWorkerPoolParams( |
30 const std::vector<SchedulerImmutableWorkerPoolParams> | 35 const std::vector<SchedulerImmutableWorkerPoolParams> |
31 constant_worker_pool_params_vector, | 36 constant_worker_pool_params_vector, |
32 const std::map<std::string, std::string>& variation_params); | 37 const std::map<std::string, std::string>& variation_params); |
33 | 38 |
39 // Adds key-value pairs from |variation_params| whose key start with | |
robliao
2017/01/03 08:00:01
Nit: Serializes key-value pairs from |variations_p
fdoray
2017/01/04 22:47:38
Done.
| |
40 // |key_prefix| to the --task-scheduler-variation-params switch of | |
41 // |command_line|. | |
42 void AddVariationParamsToCommandLine( | |
43 const std::map<std::string, std::string> variation_params, | |
44 base::StringPiece key_prefix, | |
45 base::CommandLine* command_line); | |
46 | |
47 // Returns a map with key-value pairs read from the | |
robliao
2017/01/03 08:00:01
Nit: Returns a map of key-value pairs deserialized
fdoray
2017/01/04 22:47:38
Done.
| |
48 // --task-scheduler-variation-params switch of |command_line|. | |
49 std::map<std::string, std::string> GetVariationParamsFromCommandLine( | |
50 const base::CommandLine& command_line); | |
51 | |
34 } // namespace task_scheduler_util | 52 } // namespace task_scheduler_util |
35 | 53 |
36 #endif // COMPONENTS_TASK_SCHEDULER_UTIL_COMMON_VARIATIONS_UTIL_H_ | 54 #endif // COMPONENTS_TASK_SCHEDULER_UTIL_COMMON_VARIATIONS_UTIL_H_ |
OLD | NEW |