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

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: fix comment and rebase 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
« no previous file with comments | « chrome/app/image_pre_reader_win.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 scoped_refptr<base::FieldTrial> trial( 86 scoped_refptr<base::FieldTrial> trial(
85 base::FieldTrialList::FactoryGetFieldTrial( 87 base::FieldTrialList::FactoryGetFieldTrial(
86 content::kLowLatencyFlashAudioFieldTrialName, 100, "Standard", 88 content::kLowLatencyFlashAudioFieldTrialName, 100, "Standard",
87 2013, 9, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL)); 89 2013, 9, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL));
88 90
89 // Trial is enabled for dev / beta / canary users only. 91 // Trial is enabled for dev / beta / canary users only.
90 if (chrome::VersionInfo::GetChannel() != chrome::VersionInfo::CHANNEL_STABLE) 92 if (chrome::VersionInfo::GetChannel() != chrome::VersionInfo::CHANNEL_STABLE)
91 trial->AppendGroup(content::kLowLatencyFlashAudioFieldTrialEnabledName, 25); 93 trial->AppendGroup(content::kLowLatencyFlashAudioFieldTrialEnabledName, 25);
92 } 94 }
93 95
96 void SetupPreReadFieldTrial() {
97 // The chrome executable will have set (or not) an environment variable with
98 // the group name into which this client belongs.
99 std::string group;
100 scoped_ptr<base::Environment> env(base::Environment::Create());
101 if (!env->GetVar(chrome::kPreReadEnvironmentVariable, &group) ||
102 group.empty()) {
103 return;
104 }
105
106 // Initialize the field trial. We declare all of the groups here (so that
107 // the dashboard creation tools can find them) but force the probability
108 // of being assigned to the group already chosen by the executable, if any,
109 // to 100%.
110 scoped_refptr<base::FieldTrial> trial(
111 base::FieldTrialList::FactoryGetFieldTrial(
112 "BrowserPreReadExperiment", 100, "100-pct-default",
113 2014, 7, 1, base::FieldTrial::SESSION_RANDOMIZED, NULL));
114 trial->AppendGroup("100-pct-control", group == "100-pct-control" ? 100 : 0);
115 trial->AppendGroup("95-pct", group == "95-pct" ? 100 : 0);
116 trial->AppendGroup("90-pct", group == "90-pct" ? 100 : 0);
117 trial->AppendGroup("85-pct", group == "85-pct" ? 100 : 0);
118 trial->AppendGroup("80-pct", group == "80-pct" ? 100 : 0);
119 trial->AppendGroup("75-pct", group == "75-pct" ? 100 : 0);
120 trial->AppendGroup("70-pct", group == "70-pct" ? 100 : 0);
121 trial->AppendGroup("65-pct", group == "65-pct" ? 100 : 0);
122 trial->AppendGroup("60-pct", group == "60-pct" ? 100 : 0);
123 trial->AppendGroup("55-pct", group == "55-pct" ? 100 : 0);
124 trial->AppendGroup("50-pct", group == "50-pct" ? 100 : 0);
125 trial->AppendGroup("45-pct", group == "45-pct" ? 100 : 0);
126 trial->AppendGroup("40-pct", group == "40-pct" ? 100 : 0);
127 trial->AppendGroup("35-pct", group == "35-pct" ? 100 : 0);
128 trial->AppendGroup("30-pct", group == "30-pct" ? 100 : 0);
129 trial->AppendGroup("25-pct", group == "25-pct" ? 100 : 0);
130 trial->AppendGroup("20-pct", group == "20-pct" ? 100 : 0);
131 trial->AppendGroup("15-pct", group == "15-pct" ? 100 : 0);
132 trial->AppendGroup("10-pct", group == "10-pct" ? 100 : 0);
133 trial->AppendGroup("5-pct", group == "5-pct" ? 100 : 0);
134 trial->AppendGroup("0-pct", group == "0-pct" ? 100 : 0);
135
136 // We have to call group in order to mark the experiment as active.
137 trial->group();
138 }
139
94 } // namespace 140 } // namespace
95 141
96 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line, 142 void SetupDesktopFieldTrials(const CommandLine& parsed_command_line,
97 const base::Time& install_time, 143 const base::Time& install_time,
98 PrefService* local_state) { 144 PrefService* local_state) {
99 prerender::ConfigurePrefetchAndPrerender(parsed_command_line); 145 prerender::ConfigurePrefetchAndPrerender(parsed_command_line);
100 AutoLaunchChromeFieldTrial(); 146 AutoLaunchChromeFieldTrial();
101 gpu_util::InitializeCompositingFieldTrial(); 147 gpu_util::InitializeCompositingFieldTrial();
102 OmniboxFieldTrial::ActivateStaticTrials(); 148 OmniboxFieldTrial::ActivateStaticTrials();
103 SetupInfiniteCacheFieldTrial(); 149 SetupInfiniteCacheFieldTrial();
104 DisableShowProfileSwitcherTrialIfNecessary(); 150 DisableShowProfileSwitcherTrialIfNecessary();
105 SetupAppLauncherFieldTrial(local_state); 151 SetupAppLauncherFieldTrial(local_state);
106 SetupLowLatencyFlashAudioFieldTrial(); 152 SetupLowLatencyFlashAudioFieldTrial();
153 SetupPreReadFieldTrial();
107 } 154 }
108 155
109 } // namespace chrome 156 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/app/image_pre_reader_win.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698