Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: chrome/browser/chrome_browser_field_trials_desktop.cc

Issue 23534009: Re-enable pre-read experiment as a finch field trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Alexei's comments Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 // The chrome executable will have set (or not) an environment variable with
132 // the group name into which this client belongs.
133 std::string group;
134 scoped_ptr<base::Environment> env(base::Environment::Create());
135 if (!env->GetVar(chrome::kPreReadEnvironmentVariable, &group) ||
136 group.empty()) {
137 return;
138 }
139
140 // Initialize the field trial. We declare all of the groups here (so that
141 // the dashboard creation tools can find them) but force the probability
142 // of being assigned to the group already chosen by the executable, if any,
143 // to 100%.
144 scoped_refptr<base::FieldTrial> trial(
145 base::FieldTrialList::FactoryGetFieldTrial(
146 "BrowserPreReadExperiment", 100, "100-pct-default",
147 2014, 7, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL));
148 trial->AppendGroup("100-pct-control", group == "100-pct-control" ? 100 : 0);
149 trial->AppendGroup("95-pct", group == "95-pct" ? 100 : 0);
150 trial->AppendGroup("90-pct", group == "90-pct" ? 100 : 0);
151 trial->AppendGroup("85-pct", group == "85-pct" ? 100 : 0);
152 trial->AppendGroup("80-pct", group == "80-pct" ? 100 : 0);
153 trial->AppendGroup("75-pct", group == "75-pct" ? 100 : 0);
154 trial->AppendGroup("70-pct", group == "70-pct" ? 100 : 0);
155 trial->AppendGroup("65-pct", group == "65-pct" ? 100 : 0);
156 trial->AppendGroup("60-pct", group == "60-pct" ? 100 : 0);
157 trial->AppendGroup("55-pct", group == "55-pct" ? 100 : 0);
158 trial->AppendGroup("50-pct", group == "50-pct" ? 100 : 0);
159 trial->AppendGroup("45-pct", group == "45-pct" ? 100 : 0);
160 trial->AppendGroup("40-pct", group == "40-pct" ? 100 : 0);
161 trial->AppendGroup("35-pct", group == "35-pct" ? 100 : 0);
162 trial->AppendGroup("30-pct", group == "30-pct" ? 100 : 0);
163 trial->AppendGroup("25-pct", group == "25-pct" ? 100 : 0);
164 trial->AppendGroup("20-pct", group == "20-pct" ? 100 : 0);
165 trial->AppendGroup("15-pct", group == "15-pct" ? 100 : 0);
166 trial->AppendGroup("10-pct", group == "10-pct" ? 100 : 0);
167 trial->AppendGroup("5-pct", group == "5-pct" ? 100 : 0);
168 trial->AppendGroup("0-pct", group == "0-pct" ? 100 : 0);
169
170 // We have to call group in order to mark the experiment as active.
171 trial->group();
172 }
173
128 } // namespace 174 } // namespace
129 175
130 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line, 176 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line,
131 const base::Time& install_time, 177 const base::Time& install_time,
132 PrefService* local_state) { 178 PrefService* local_state) {
133 prerender::ConfigurePrefetchAndPrerender(parsed_command_line); 179 prerender::ConfigurePrefetchAndPrerender(parsed_command_line);
134 AutoLaunchChromeFieldTrial(); 180 AutoLaunchChromeFieldTrial();
135 gpu_util::InitializeCompositingFieldTrial(); 181 gpu_util::InitializeCompositingFieldTrial();
136 OmniboxFieldTrial::ActivateStaticTrials(); 182 OmniboxFieldTrial::ActivateStaticTrials();
137 SetupInfiniteCacheFieldTrial(); 183 SetupInfiniteCacheFieldTrial();
138 SetupCacheSensitivityAnalysisFieldTrial(); 184 SetupCacheSensitivityAnalysisFieldTrial();
139 DisableShowProfileSwitcherTrialIfNecessary(); 185 DisableShowProfileSwitcherTrialIfNecessary();
140 SetupAppLauncherFieldTrial(local_state); 186 SetupAppLauncherFieldTrial(local_state);
141 SetupLowLatencyFlashAudioFieldTrial(); 187 SetupLowLatencyFlashAudioFieldTrial();
188 SetupPreReadFieldTrial();
142 } 189 }
143 190
144 } // namespace chrome 191 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698