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

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 comments from chrisha and asvitkine. 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 env->GetVar(chrome::kPreReadEnvironmentVariable, &group);
Alexei Svitkine (slow) 2013/09/03 14:59:16 Can you exit early if this env var isn't set (and
Roger McFarlane (Chromium) 2013/09/03 18:38:43 The default isn't no-preread, it's full pre-read.
136
137 // Initialize the field trial. We declare all of the groups here (so that
138 // the dashboard creation tools can find them) but force the probability
139 // of being assigned to the group already chosen by the executable, if any,
140 // to 100%.
141 scoped_refptr<base::FieldTrial> trial(
142 base::FieldTrialList::FactoryGetFieldTrial(
143 "BrowserPreReadExperiment", 100, "100%-Default",
Alexei Svitkine (slow) 2013/09/03 14:59:16 We generally discourage special characters in the
Roger McFarlane (Chromium) 2013/09/03 18:38:43 Done.
144 2014, 7, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL));
145 trial->AppendGroup("100%-Control", group == "100%-Control" ? 100 : 0);
146 trial->AppendGroup("95%", group == "95%" ? 100 : 0);
147 trial->AppendGroup("90%", group == "90%" ? 100 : 0);
148 trial->AppendGroup("85%", group == "85%" ? 100 : 0);
149 trial->AppendGroup("80%", group == "80%" ? 100 : 0);
150 trial->AppendGroup("75%", group == "75%" ? 100 : 0);
151 trial->AppendGroup("70%", group == "70%" ? 100 : 0);
152 trial->AppendGroup("65%", group == "65%" ? 100 : 0);
153 trial->AppendGroup("60%", group == "60%" ? 100 : 0);
154 trial->AppendGroup("55%", group == "55%" ? 100 : 0);
155 trial->AppendGroup("50%", group == "50%" ? 100 : 0);
156 trial->AppendGroup("45%", group == "45%" ? 100 : 0);
157 trial->AppendGroup("40%", group == "40%" ? 100 : 0);
158 trial->AppendGroup("35%", group == "35%" ? 100 : 0);
159 trial->AppendGroup("30%", group == "30%" ? 100 : 0);
160 trial->AppendGroup("25%", group == "25%" ? 100 : 0);
161 trial->AppendGroup("20%", group == "20%" ? 100 : 0);
162 trial->AppendGroup("15%", group == "15%" ? 100 : 0);
163 trial->AppendGroup("10%", group == "10%" ? 100 : 0);
164 trial->AppendGroup("5%", group == "5%" ? 100 : 0);
165 trial->AppendGroup("0%", group == "0%" ? 100 : 0);
Alexei Svitkine (slow) 2013/09/03 14:59:16 You need to call trial->group() on the experiment
Roger McFarlane (Chromium) 2013/09/03 18:38:43 Done.
166 }
167
128 } // namespace 168 } // namespace
129 169
130 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line, 170 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line,
131 const base::Time& install_time, 171 const base::Time& install_time,
132 PrefService* local_state) { 172 PrefService* local_state) {
133 prerender::ConfigurePrefetchAndPrerender(parsed_command_line); 173 prerender::ConfigurePrefetchAndPrerender(parsed_command_line);
134 AutoLaunchChromeFieldTrial(); 174 AutoLaunchChromeFieldTrial();
135 gpu_util::InitializeCompositingFieldTrial(); 175 gpu_util::InitializeCompositingFieldTrial();
136 OmniboxFieldTrial::ActivateStaticTrials(); 176 OmniboxFieldTrial::ActivateStaticTrials();
137 SetupInfiniteCacheFieldTrial(); 177 SetupInfiniteCacheFieldTrial();
138 SetupCacheSensitivityAnalysisFieldTrial(); 178 SetupCacheSensitivityAnalysisFieldTrial();
139 DisableShowProfileSwitcherTrialIfNecessary(); 179 DisableShowProfileSwitcherTrialIfNecessary();
140 SetupAppLauncherFieldTrial(local_state); 180 SetupAppLauncherFieldTrial(local_state);
141 SetupLowLatencyFlashAudioFieldTrial(); 181 SetupLowLatencyFlashAudioFieldTrial();
182 SetupPreReadFieldTrial();
142 } 183 }
143 184
144 } // namespace chrome 185 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698