OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1211 // GetVariationParams has the side-effect of assigning the client to | 1211 // GetVariationParams has the side-effect of assigning the client to |
1212 // a field trial group. | 1212 // a field trial group. |
1213 std::map<std::string, std::string> params; | 1213 std::map<std::string, std::string> params; |
1214 if (variations::GetVariationParams(field_trial_name, ¶ms)) { | 1214 if (variations::GetVariationParams(field_trial_name, ¶ms)) { |
1215 for (const auto& param : params) { | 1215 for (const auto& param : params) { |
1216 blink_settings.push_back(base::StringPrintf( | 1216 blink_settings.push_back(base::StringPrintf( |
1217 "%s=%s", param.first.c_str(), param.second.c_str())); | 1217 "%s=%s", param.first.c_str(), param.second.c_str())); |
1218 } | 1218 } |
1219 } | 1219 } |
1220 } | 1220 } |
1221 | |
1222 // Flags for the ResourcePriorities field trial. The settings are | |
1223 // encoded in the field trial group name instead of as variations | |
1224 // because the variations code is not accessible from the loader. | |
1225 // | |
1226 // The group name encoding looks like this: | |
1227 // <descriptiveName>_ABCDE_E2_F_G | |
1228 // A - fetchDeferLateScripts (1 for true, 0 for false) | |
1229 // B - fetchIncreaseFontPriority (1 for true, 0 for false) | |
1230 // C - fetchIncreaseAsyncScriptPriority (1 for true, 0 for false) | |
1231 // D - fetchIncreasePriorities (1 for true, 0 for false) | |
1232 // E - fetchEnableLayoutBlockingThreshold (1 for true, 0 for false) | |
1233 // E2 - fetchLayoutBlockingThreshold (Numeric) | |
1234 // F - fetchMaxNumDelayableWhileLayoutBlocking (Numeric) | |
1235 // G - fetchMaxNumDelayableRequests (Numeric) | |
1236 // | |
1237 // Only A-D are relevant to blink and exposed as settings | |
1238 std::string resource_priorities_trial_group = | |
1239 base::FieldTrialList::FindFullName("ResourcePriorities"); | |
1240 std::vector<std::string> split_group( | |
1241 base::SplitString(resource_priorities_trial_group, "_", | |
1242 base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL)); | |
1243 if (split_group.size() == 5 && split_group[1].length() == 5) { | |
Bryan McQuade
2015/08/07 18:02:26
you'll likely have Control,Default,and BlinkSettin
Pat Meenan
2015/08/07 20:48:09
Done.
| |
1244 if (split_group[1].at(0) == '1') | |
1245 blink_settings.push_back("fetchDeferLateScripts=true"); | |
1246 if (split_group[1].at(1) == '1') | |
1247 blink_settings.push_back("fetchIncreaseFontPriority=true"); | |
1248 if (split_group[1].at(2) == '1') | |
1249 blink_settings.push_back("fetchIncreaseAsyncScriptPriority=true"); | |
1250 if (split_group[1].at(3) == '1') | |
1251 blink_settings.push_back("fetchIncreasePriorities=true"); | |
1252 } | |
mmenke
2015/08/07 16:55:10
Also, do we have any tests of this method? I'm pa
mmenke
2015/08/07 16:55:10
I assume blink settings are generally tested at th
mmenke
2015/08/07 16:55:10
What about the others?
Bryan McQuade
2015/08/07 17:35:53
There are some basic tests at https://code.google.
Pat Meenan
2015/08/07 20:48:09
Done.
Pat Meenan
2015/08/07 20:48:09
Done.
| |
1253 | |
1221 if (blink_settings.empty()) { | 1254 if (blink_settings.empty()) { |
1222 return; | 1255 return; |
1223 } | 1256 } |
1224 | 1257 |
1225 if (browser_command_line.HasSwitch(switches::kBlinkSettings) || | 1258 if (browser_command_line.HasSwitch(switches::kBlinkSettings) || |
1226 command_line->HasSwitch(switches::kBlinkSettings)) { | 1259 command_line->HasSwitch(switches::kBlinkSettings)) { |
1227 // The field trial is configured to force users that specify the | 1260 // The field trial is configured to force users that specify the |
1228 // blink-settings flag into a group with no params, and we return | 1261 // blink-settings flag into a group with no params, and we return |
1229 // above if no params were specified, so it's an error if we reach | 1262 // above if no params were specified, so it's an error if we reach |
1230 // this point. | 1263 // this point. |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2564 switches::kDisableWebRtcEncryption, | 2597 switches::kDisableWebRtcEncryption, |
2565 }; | 2598 }; |
2566 to_command_line->CopySwitchesFrom(from_command_line, | 2599 to_command_line->CopySwitchesFrom(from_command_line, |
2567 kWebRtcDevSwitchNames, | 2600 kWebRtcDevSwitchNames, |
2568 arraysize(kWebRtcDevSwitchNames)); | 2601 arraysize(kWebRtcDevSwitchNames)); |
2569 } | 2602 } |
2570 } | 2603 } |
2571 #endif // defined(ENABLE_WEBRTC) | 2604 #endif // defined(ENABLE_WEBRTC) |
2572 | 2605 |
2573 } // namespace chrome | 2606 } // namespace chrome |
OLD | NEW |