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 #include "components/task_scheduler_util/variations/browser_variations_util.h" | 5 #include "components/task_scheduler_util/variations/browser_variations_util.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 std::map<std::string, std::string> variation_params; | 129 std::map<std::string, std::string> variation_params; |
130 ::variations::GetVariationParams(kFieldTrialName, &variation_params); | 130 ::variations::GetVariationParams(kFieldTrialName, &variation_params); |
131 | 131 |
132 // TODO(gab): Remove this when http://crbug.com/622400 concludes. | 132 // TODO(gab): Remove this when http://crbug.com/622400 concludes. |
133 const auto sequenced_worker_pool_param = | 133 const auto sequenced_worker_pool_param = |
134 variation_params.find("RedirectSequencedWorkerPools"); | 134 variation_params.find("RedirectSequencedWorkerPools"); |
135 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 135 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
136 switches::kDisableBrowserTaskScheduler) && | 136 switches::kDisableBrowserTaskScheduler) && |
137 sequenced_worker_pool_param != variation_params.end() && | 137 sequenced_worker_pool_param != variation_params.end() && |
138 sequenced_worker_pool_param->second == "true") { | 138 sequenced_worker_pool_param->second == "true") { |
139 base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess(); | 139 // Check a variation that allows capping all redirections at USER_VISIBLE |
| 140 // (no USER_BLOCKING) to observe the side-effects of multiple priority |
| 141 // levels in the foreground IO pool. |
| 142 const auto sequenced_worker_pool_cap_priority_param = |
| 143 variation_params.find("CapSequencedWorkerPoolsAtUserVisible"); |
| 144 |
| 145 const base::TaskPriority max_task_priority = |
| 146 sequenced_worker_pool_cap_priority_param != variation_params.end() && |
| 147 sequenced_worker_pool_cap_priority_param->second == "true" |
| 148 ? base::TaskPriority::USER_VISIBLE |
| 149 : base::TaskPriority::HIGHEST; |
| 150 |
| 151 base::SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess( |
| 152 max_task_priority); |
140 } else { | 153 } else { |
141 base::SequencedWorkerPool::EnableForProcess(); | 154 base::SequencedWorkerPool::EnableForProcess(); |
142 } | 155 } |
143 } | 156 } |
144 | 157 |
145 } // variations | 158 } // variations |
146 } // namespace task_scheduler_util | 159 } // namespace task_scheduler_util |
OLD | NEW |