Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_browser_field_trials_desktop.h" | 5 #include "chrome/browser/chrome_browser_field_trials_desktop.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "apps/field_trial_names.h" | 9 #include "apps/field_trial_names.h" |
| 10 #include "apps/pref_names.h" | 10 #include "apps/pref_names.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/environment.h" | |
| 12 #include "base/metrics/field_trial.h" | 13 #include "base/metrics/field_trial.h" |
| 13 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
| 15 #include "chrome/browser/auto_launch_trial.h" | 16 #include "chrome/browser/auto_launch_trial.h" |
| 16 #include "chrome/browser/google/google_util.h" | 17 #include "chrome/browser/google/google_util.h" |
| 17 #include "chrome/browser/gpu/chrome_gpu_util.h" | 18 #include "chrome/browser/gpu/chrome_gpu_util.h" |
| 18 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 19 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
| 19 #include "chrome/browser/prerender/prerender_field_trial.h" | 20 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 20 #include "chrome/browser/profiles/profiles_state.h" | 21 #include "chrome/browser/profiles/profiles_state.h" |
| 21 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 22 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| 22 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 23 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 24 #include "chrome/common/chrome_constants.h" | |
| 23 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/chrome_version_info.h" | 26 #include "chrome/common/chrome_version_info.h" |
| 25 #include "chrome/common/metrics/variations/variations_util.h" | 27 #include "chrome/common/metrics/variations/variations_util.h" |
| 26 #include "content/public/common/content_constants.h" | 28 #include "content/public/common/content_constants.h" |
| 27 #include "net/spdy/spdy_session.h" | 29 #include "net/spdy/spdy_session.h" |
| 28 #include "ui/base/layout.h" | 30 #include "ui/base/layout.h" |
| 29 | 31 |
| 30 namespace chrome { | 32 namespace chrome { |
| 31 | 33 |
| 32 namespace { | 34 namespace { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 scoped_refptr<base::FieldTrial> trial( | 120 scoped_refptr<base::FieldTrial> trial( |
| 119 base::FieldTrialList::FactoryGetFieldTrial( | 121 base::FieldTrialList::FactoryGetFieldTrial( |
| 120 content::kLowLatencyFlashAudioFieldTrialName, 100, "Standard", | 122 content::kLowLatencyFlashAudioFieldTrialName, 100, "Standard", |
| 121 2013, 9, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL)); | 123 2013, 9, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL)); |
| 122 | 124 |
| 123 // Trial is enabled for dev / beta / canary users only. | 125 // Trial is enabled for dev / beta / canary users only. |
| 124 if (chrome::VersionInfo::GetChannel() != chrome::VersionInfo::CHANNEL_STABLE) | 126 if (chrome::VersionInfo::GetChannel() != chrome::VersionInfo::CHANNEL_STABLE) |
| 125 trial->AppendGroup(content::kLowLatencyFlashAudioFieldTrialEnabledName, 25); | 127 trial->AppendGroup(content::kLowLatencyFlashAudioFieldTrialEnabledName, 25); |
| 126 } | 128 } |
| 127 | 129 |
| 130 void SetupPreReadFieldTrial() { | |
| 131 #if defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | |
|
Alexei Svitkine (slow)
2013/08/29 17:44:05
Is there a reason this should only be activated in
Roger McFarlane (Chromium)
2013/08/30 21:27:37
Done.
| |
| 132 // The browser pre-read trial is Windows and Google Chrome specific. The | |
| 133 // chrome.exe process will have set an environment variable with the group | |
| 134 // name into which this client belongs. | |
| 135 std::string group; | |
| 136 scoped_ptr<base::Environment> env(base::Environment::Create()); | |
| 137 env->GetVar(chrome::kPreReadEnvironmentVariable, &group); | |
| 138 | |
| 139 // Initialize the field trial. We declare all of the groups here (so that | |
| 140 // the dashboard creation tools can find them) but force the probability | |
| 141 // of being assigned to the group already chosen by chrome.exe to 100%. | |
| 142 scoped_refptr<base::FieldTrial> trial( | |
| 143 base::FieldTrialList::FactoryGetFieldTrial( | |
| 144 "BrowserPreReadExperiment", 100, "100%-Default", | |
| 145 2014, 7, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL)); | |
| 146 trial->AppendGroup("100%-Control", group == "100%-Control" ? 100 : 0); | |
| 147 trial->AppendGroup("95%", group == "95%" ? 100 : 0); | |
| 148 trial->AppendGroup("90%", group == "90%" ? 100 : 0); | |
| 149 trial->AppendGroup("85%", group == "85%" ? 100 : 0); | |
| 150 trial->AppendGroup("80%", group == "80%" ? 100 : 0); | |
| 151 trial->AppendGroup("75%", group == "75%" ? 100 : 0); | |
| 152 trial->AppendGroup("70%", group == "70%" ? 100 : 0); | |
| 153 trial->AppendGroup("65%", group == "65%" ? 100 : 0); | |
| 154 trial->AppendGroup("60%", group == "60%" ? 100 : 0); | |
| 155 trial->AppendGroup("55%", group == "55%" ? 100 : 0); | |
| 156 trial->AppendGroup("50%", group == "50%" ? 100 : 0); | |
| 157 trial->AppendGroup("45%", group == "45%" ? 100 : 0); | |
| 158 trial->AppendGroup("40%", group == "40%" ? 100 : 0); | |
| 159 trial->AppendGroup("35%", group == "35%" ? 100 : 0); | |
| 160 trial->AppendGroup("30%", group == "30%" ? 100 : 0); | |
| 161 trial->AppendGroup("25%", group == "25%" ? 100 : 0); | |
| 162 trial->AppendGroup("20%", group == "20%" ? 100 : 0); | |
| 163 trial->AppendGroup("15%", group == "15%" ? 100 : 0); | |
| 164 trial->AppendGroup("10%", group == "10%" ? 100 : 0); | |
| 165 trial->AppendGroup("5%", group == "5%" ? 100 : 0); | |
| 166 trial->AppendGroup("0%", group == "0%" ? 100 : 0); | |
| 167 #endif // defined(OS_WIN) && defined(GOOGLE_CHROME_BUILD) | |
| 168 } | |
| 169 | |
| 128 } // namespace | 170 } // namespace |
| 129 | 171 |
| 130 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line, | 172 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line, |
| 131 const base::Time& install_time, | 173 const base::Time& install_time, |
| 132 PrefService* local_state) { | 174 PrefService* local_state) { |
| 133 prerender::ConfigurePrefetchAndPrerender(parsed_command_line); | 175 prerender::ConfigurePrefetchAndPrerender(parsed_command_line); |
| 134 AutoLaunchChromeFieldTrial(); | 176 AutoLaunchChromeFieldTrial(); |
| 135 gpu_util::InitializeCompositingFieldTrial(); | 177 gpu_util::InitializeCompositingFieldTrial(); |
| 136 OmniboxFieldTrial::ActivateStaticTrials(); | 178 OmniboxFieldTrial::ActivateStaticTrials(); |
| 137 SetupInfiniteCacheFieldTrial(); | 179 SetupInfiniteCacheFieldTrial(); |
| 138 SetupCacheSensitivityAnalysisFieldTrial(); | 180 SetupCacheSensitivityAnalysisFieldTrial(); |
| 139 DisableShowProfileSwitcherTrialIfNecessary(); | 181 DisableShowProfileSwitcherTrialIfNecessary(); |
| 140 SetupAppLauncherFieldTrial(local_state); | 182 SetupAppLauncherFieldTrial(local_state); |
| 141 SetupLowLatencyFlashAudioFieldTrial(); | 183 SetupLowLatencyFlashAudioFieldTrial(); |
| 184 SetupPreReadFieldTrial(); | |
| 142 } | 185 } |
| 143 | 186 |
| 144 } // namespace chrome | 187 } // namespace chrome |
| OLD | NEW |