| 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/metrics/field_trial.h" | 12 #include "base/metrics/field_trial.h" |
| 13 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "chrome/browser/auto_launch_trial.h" | 15 #include "chrome/browser/auto_launch_trial.h" |
| 16 #include "chrome/browser/google/google_util.h" | 16 #include "chrome/browser/google/google_util.h" |
| 17 #include "chrome/browser/gpu/chrome_gpu_util.h" | 17 #include "chrome/browser/gpu/chrome_gpu_util.h" |
| 18 #include "chrome/browser/omnibox/omnibox_field_trial.h" | 18 #include "chrome/browser/omnibox/omnibox_field_trial.h" |
| 19 #include "chrome/browser/prerender/prerender_field_trial.h" | 19 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 20 #include "chrome/browser/profiles/profiles_state.h" | 20 #include "chrome/browser/profiles/profiles_state.h" |
| 21 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 21 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| 22 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 22 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/common/chrome_version_info.h" | 24 #include "chrome/common/chrome_version_info.h" |
| 25 #include "chrome/common/metrics/variations/variations_util.h" | 25 #include "chrome/common/metrics/variations/variations_util.h" |
| 26 #include "content/public/common/content_constants.h" | 26 #include "content/public/common/content_constants.h" |
| 27 #include "net/spdy/spdy_session.h" | 27 #include "net/spdy/spdy_session.h" |
| 28 #include "ui/base/layout.h" | 28 #include "ui/base/layout.h" |
| 29 | 29 |
| 30 #if defined(OS_WIN) | |
| 31 #include "net/socket/tcp_client_socket_win.h" | |
| 32 #endif // defined(OS_WIN) | |
| 33 | |
| 34 namespace chrome { | 30 namespace chrome { |
| 35 | 31 |
| 36 namespace { | 32 namespace { |
| 37 | 33 |
| 38 void SetupAppLauncherFieldTrial(PrefService* local_state) { | 34 void SetupAppLauncherFieldTrial(PrefService* local_state) { |
| 39 if (base::FieldTrialList::FindFullName(apps::kLauncherPromoTrialName) == | 35 if (base::FieldTrialList::FindFullName(apps::kLauncherPromoTrialName) == |
| 40 apps::kResetShowLauncherPromoPrefGroupName) { | 36 apps::kResetShowLauncherPromoPrefGroupName) { |
| 41 local_state->SetBoolean(apps::prefs::kShowAppLauncherPromo, true); | 37 local_state->SetBoolean(apps::prefs::kShowAppLauncherPromo, true); |
| 42 } | 38 } |
| 43 } | 39 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 base::FieldTrial::SESSION_RANDOMIZED, NULL)); | 107 base::FieldTrial::SESSION_RANDOMIZED, NULL)); |
| 112 trial->AppendGroup("ControlA", sensitivity_analysis_probability); | 108 trial->AppendGroup("ControlA", sensitivity_analysis_probability); |
| 113 trial->AppendGroup("ControlB", sensitivity_analysis_probability); | 109 trial->AppendGroup("ControlB", sensitivity_analysis_probability); |
| 114 trial->AppendGroup("100A", sensitivity_analysis_probability); | 110 trial->AppendGroup("100A", sensitivity_analysis_probability); |
| 115 trial->AppendGroup("100B", sensitivity_analysis_probability); | 111 trial->AppendGroup("100B", sensitivity_analysis_probability); |
| 116 trial->AppendGroup("200A", sensitivity_analysis_probability); | 112 trial->AppendGroup("200A", sensitivity_analysis_probability); |
| 117 trial->AppendGroup("200B", sensitivity_analysis_probability); | 113 trial->AppendGroup("200B", sensitivity_analysis_probability); |
| 118 // TODO(gavinp,rvargas): Re-add 400 group to field trial if results justify. | 114 // TODO(gavinp,rvargas): Re-add 400 group to field trial if results justify. |
| 119 } | 115 } |
| 120 | 116 |
| 121 void WindowsOverlappedTCPReadsFieldTrial( | |
| 122 const CommandLine& parsed_command_line) { | |
| 123 #if defined(OS_WIN) | |
| 124 if (parsed_command_line.HasSwitch(switches::kOverlappedRead)) { | |
| 125 std::string option = | |
| 126 parsed_command_line.GetSwitchValueASCII(switches::kOverlappedRead); | |
| 127 if (LowerCaseEqualsASCII(option, "off")) | |
| 128 net::TCPClientSocketWin::DisableOverlappedReads(); | |
| 129 } else { | |
| 130 const base::FieldTrial::Probability kDivisor = 2; // 1 in 2 chance | |
| 131 const base::FieldTrial::Probability kOverlappedReadProbability = 1; | |
| 132 scoped_refptr<base::FieldTrial> overlapped_reads_trial( | |
| 133 base::FieldTrialList::FactoryGetFieldTrial( | |
| 134 "OverlappedReadImpact", kDivisor, "OverlappedReadEnabled", | |
| 135 2013, 6, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL)); | |
| 136 int overlapped_reads_disabled_group = | |
| 137 overlapped_reads_trial->AppendGroup("OverlappedReadDisabled", | |
| 138 kOverlappedReadProbability); | |
| 139 int assigned_group = overlapped_reads_trial->group(); | |
| 140 if (assigned_group == overlapped_reads_disabled_group) | |
| 141 net::TCPClientSocketWin::DisableOverlappedReads(); | |
| 142 } | |
| 143 #endif | |
| 144 } | |
| 145 | |
| 146 void SetupLowLatencyFlashAudioFieldTrial() { | 117 void SetupLowLatencyFlashAudioFieldTrial() { |
| 147 scoped_refptr<base::FieldTrial> trial( | 118 scoped_refptr<base::FieldTrial> trial( |
| 148 base::FieldTrialList::FactoryGetFieldTrial( | 119 base::FieldTrialList::FactoryGetFieldTrial( |
| 149 content::kLowLatencyFlashAudioFieldTrialName, 100, "Standard", | 120 content::kLowLatencyFlashAudioFieldTrialName, 100, "Standard", |
| 150 2013, 9, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL)); | 121 2013, 9, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL)); |
| 151 | 122 |
| 152 // Trial is enabled for dev / beta / canary users only. | 123 // Trial is enabled for dev / beta / canary users only. |
| 153 if (chrome::VersionInfo::GetChannel() != chrome::VersionInfo::CHANNEL_STABLE) | 124 if (chrome::VersionInfo::GetChannel() != chrome::VersionInfo::CHANNEL_STABLE) |
| 154 trial->AppendGroup(content::kLowLatencyFlashAudioFieldTrialEnabledName, 25); | 125 trial->AppendGroup(content::kLowLatencyFlashAudioFieldTrialEnabledName, 25); |
| 155 } | 126 } |
| 156 | 127 |
| 157 } // namespace | 128 } // namespace |
| 158 | 129 |
| 159 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line, | 130 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line, |
| 160 const base::Time& install_time, | 131 const base::Time& install_time, |
| 161 PrefService* local_state) { | 132 PrefService* local_state) { |
| 162 prerender::ConfigurePrefetchAndPrerender(parsed_command_line); | 133 prerender::ConfigurePrefetchAndPrerender(parsed_command_line); |
| 163 AutoLaunchChromeFieldTrial(); | 134 AutoLaunchChromeFieldTrial(); |
| 164 gpu_util::InitializeCompositingFieldTrial(); | 135 gpu_util::InitializeCompositingFieldTrial(); |
| 165 OmniboxFieldTrial::ActivateStaticTrials(); | 136 OmniboxFieldTrial::ActivateStaticTrials(); |
| 166 SetupInfiniteCacheFieldTrial(); | 137 SetupInfiniteCacheFieldTrial(); |
| 167 SetupCacheSensitivityAnalysisFieldTrial(); | 138 SetupCacheSensitivityAnalysisFieldTrial(); |
| 168 DisableShowProfileSwitcherTrialIfNecessary(); | 139 DisableShowProfileSwitcherTrialIfNecessary(); |
| 169 WindowsOverlappedTCPReadsFieldTrial(parsed_command_line); | |
| 170 SetupAppLauncherFieldTrial(local_state); | 140 SetupAppLauncherFieldTrial(local_state); |
| 171 SetupLowLatencyFlashAudioFieldTrial(); | 141 SetupLowLatencyFlashAudioFieldTrial(); |
| 172 } | 142 } |
| 173 | 143 |
| 174 } // namespace chrome | 144 } // namespace chrome |
| OLD | NEW |