summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prerender/prerender_field_trial.cc
diff options
context:
space:
mode:
authortburkard@chromium.org <tburkard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 17:32:30 +0000
committertburkard@chromium.org <tburkard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 17:32:30 +0000
commitb9370fcd6785eda5cb6572b90bdfdc058d0e5911 (patch)
treef338247b7251e4589882a72f38c2e060e98e32f8 /chrome/browser/prerender/prerender_field_trial.cc
parent8755298521e5dc36c5a7f015b4e2161e679a6e59 (diff)
downloadchromium_src-b9370fcd6785eda5cb6572b90bdfdc058d0e5911.zip
chromium_src-b9370fcd6785eda5cb6572b90bdfdc058d0e5911.tar.gz
chromium_src-b9370fcd6785eda5cb6572b90bdfdc058d0e5911.tar.bz2
Adding a local predictor field trial, and a facility
to report local predictor stats based on a whitelist of URL hashes (only placeholder dummy file for now). R=shishir@chromium.org Review URL: https://codereview.chromium.org/11364034 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165696 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prerender/prerender_field_trial.cc')
-rw-r--r--chrome/browser/prerender/prerender_field_trial.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/chrome/browser/prerender/prerender_field_trial.cc b/chrome/browser/prerender/prerender_field_trial.cc
index 7938dca..15bd501 100644
--- a/chrome/browser/prerender/prerender_field_trial.cc
+++ b/chrome/browser/prerender/prerender_field_trial.cc
@@ -30,6 +30,9 @@ const char kSpeculativePrefetchingTrialName[] = "SpeculativePrefetching";
int g_speculative_prefetching_learning_group = kint32min;
int g_speculative_prefetching_prefetching_group = kint32min;
+const char kLocalPredictorTrialName[] = "PrerenderLocalPredictor";
+int g_local_predictor_default_group_number = kint32min;
+
void SetupPrefetchFieldTrial() {
chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
@@ -143,6 +146,7 @@ void SetupPrerenderFieldTrial() {
void ConfigureOmniboxPrerender();
void ConfigureSpeculativePrefetching();
+void ConfigureLocalPredictor();
void ConfigurePrefetchAndPrerender(const CommandLine& command_line) {
enum PrerenderOption {
@@ -204,6 +208,7 @@ void ConfigurePrefetchAndPrerender(const CommandLine& command_line) {
ConfigureOmniboxPrerender();
ConfigureSpeculativePrefetching();
+ ConfigureLocalPredictor();
}
void ConfigureOmniboxPrerender() {
@@ -333,4 +338,26 @@ bool IsSpeculativeResourcePrefetchingEnabled(Profile* profile) {
return group == g_speculative_prefetching_prefetching_group;
}
+void ConfigureLocalPredictor() {
+ const FieldTrial::Probability kDivisor = 100;
+
+ FieldTrial::Probability kEnableProbability = 90;
+ chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
+ if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
+ channel == chrome::VersionInfo::CHANNEL_BETA) {
+ kEnableProbability = 1;
+ }
+ scoped_refptr<FieldTrial> local_predictor_trial(
+ FieldTrialList::FactoryGetFieldTrial(
+ kLocalPredictorTrialName, kDivisor, "Disabled",
+ 2013, 12, 31, &g_local_predictor_default_group_number));
+ local_predictor_trial->AppendGroup("Enabled", kEnableProbability);
+}
+
+bool IsLocalPredictorEnabled() {
+ const int group = FieldTrialList::FindValue(kLocalPredictorTrialName);
+ return (group != FieldTrial::kNotFinalized &&
+ group != g_omnibox_trial_default_group_number);
+}
+
} // namespace prerender