Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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.h" | 5 #include "chrome/browser/chrome_browser_field_trials.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( | 26 ChromeBrowserFieldTrials::ChromeBrowserFieldTrials( |
| 27 const CommandLine& parsed_command_line) | 27 const CommandLine& parsed_command_line) |
| 28 : parsed_command_line_(parsed_command_line) { | 28 : parsed_command_line_(parsed_command_line) { |
| 29 } | 29 } |
| 30 | 30 |
| 31 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { | 31 ChromeBrowserFieldTrials::~ChromeBrowserFieldTrials() { |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace { | |
| 35 | |
| 36 // Base function used by all data reduction proxy field trials. A trial is | |
|
bengr
2014/07/17 00:11:07
We might be able to remove all of this.
Not at Google. Contact bengr
2014/07/17 18:10:21
Discussed in person. Will figure out rollout proce
| |
| 37 // only conducted for installs that are in the "Enabled" group. They are always | |
| 38 // enabled on DEV and BETA channels, and for STABLE, a percentage will be | |
| 39 // controlled from the server. Until the percentage is learned from the server, | |
| 40 // a client-side configuration is used. | |
| 41 void DataCompressionProxyBaseFieldTrial( | |
| 42 const char* trial_name, | |
| 43 const base::FieldTrial::Probability enabled_group_probability, | |
| 44 const base::FieldTrial::Probability total_probability) { | |
| 45 const char kEnabled[] = "Enabled"; | |
| 46 const char kDisabled[] = "Disabled"; | |
| 47 | |
| 48 // Find out if this is a stable channel. | |
| 49 const bool kIsStableChannel = | |
| 50 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; | |
| 51 | |
| 52 // Experiment enabled until Jan 1, 2015. By default, disabled. | |
|
bengr
2014/07/17 00:11:07
We should change the expiration date to something
Not at Google. Contact bengr
2014/07/17 18:10:21
Changed to 2020.
| |
| 53 scoped_refptr<base::FieldTrial> trial( | |
| 54 base::FieldTrialList::FactoryGetFieldTrial( | |
| 55 trial_name, | |
| 56 total_probability, | |
| 57 kDisabled, 2015, 1, 1, base::FieldTrial::ONE_TIME_RANDOMIZED, NULL)); | |
| 58 | |
| 59 // Non-stable channels will run with probability 1. | |
| 60 const int kEnabledGroup = trial->AppendGroup( | |
| 61 kEnabled, | |
| 62 kIsStableChannel ? enabled_group_probability : total_probability); | |
| 63 | |
| 64 const int v = trial->group(); | |
| 65 VLOG(1) << trial_name << " enabled group id: " << kEnabledGroup | |
| 66 << ". Selected group id: " << v; | |
| 67 } | |
| 68 | |
| 69 void DataCompressionProxyFieldTrials() { | |
| 70 // Governs the rollout of the compression proxy for Chrome on mobile | |
|
bengr
2014/07/17 00:11:07
all platforms, right?
Not at Google. Contact bengr
2014/07/17 18:10:21
Done.
| |
| 71 // platforms. In all channels, the percentage will be controlled from the | |
| 72 // server, and is configured to be 100% = 1000 / 1000 until overridden by the | |
| 73 // server. | |
| 74 DataCompressionProxyBaseFieldTrial( | |
| 75 "DataCompressionProxyRollout", 1000, 1000); | |
| 76 | |
| 77 // Governs the rollout of the _promo_ for the compression proxy | |
| 78 // independently from the rollout of compression proxy. The enabled | |
| 79 // percentage is configured to be 10% = 100 / 1000 until overridden by the | |
| 80 // server. When this trial is "Enabled," users get a promo, whereas | |
| 81 // otherwise, compression is available without a promo. | |
| 82 DataCompressionProxyBaseFieldTrial( | |
| 83 "DataCompressionProxyPromoVisibility", 100, 1000); | |
| 84 } | |
| 85 | |
| 86 } // namespace | |
| 87 | |
| 34 void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) { | 88 void ChromeBrowserFieldTrials::SetupFieldTrials(PrefService* local_state) { |
| 35 const base::Time install_time = base::Time::FromTimeT( | 89 const base::Time install_time = base::Time::FromTimeT( |
| 36 local_state->GetInt64(metrics::prefs::kInstallDate)); | 90 local_state->GetInt64(metrics::prefs::kInstallDate)); |
| 37 DCHECK(!install_time.is_null()); | 91 DCHECK(!install_time.is_null()); |
| 38 | 92 |
| 39 // Field trials that are shared by all platforms. | 93 // Field trials that are shared by all platforms. |
| 40 chrome_variations::SetupUniformityFieldTrials(install_time); | 94 chrome_variations::SetupUniformityFieldTrials(install_time); |
| 41 InstantiateDynamicTrials(); | 95 InstantiateDynamicTrials(); |
| 96 DataCompressionProxyFieldTrials(); | |
| 42 | 97 |
| 43 #if defined(OS_ANDROID) || defined(OS_IOS) | 98 #if defined(OS_ANDROID) || defined(OS_IOS) |
| 44 chrome::SetupMobileFieldTrials( | 99 chrome::SetupMobileFieldTrials( |
| 45 parsed_command_line_, install_time, local_state); | 100 parsed_command_line_, install_time, local_state); |
| 46 #else | 101 #else |
| 47 chrome::SetupDesktopFieldTrials( | 102 chrome::SetupDesktopFieldTrials( |
| 48 parsed_command_line_, install_time, local_state); | 103 parsed_command_line_, install_time, local_state); |
| 49 #endif | 104 #endif |
| 50 } | 105 } |
| 51 | 106 |
| 52 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { | 107 void ChromeBrowserFieldTrials::InstantiateDynamicTrials() { |
| 53 // Call |FindValue()| on the trials below, which may come from the server, to | 108 // Call |FindValue()| on the trials below, which may come from the server, to |
| 54 // ensure they get marked as "used" for the purposes of data reporting. | 109 // ensure they get marked as "used" for the purposes of data reporting. |
| 55 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); | 110 base::FieldTrialList::FindValue("UMA-Dynamic-Binary-Uniformity-Trial"); |
| 56 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); | 111 base::FieldTrialList::FindValue("UMA-Dynamic-Uniformity-Trial"); |
| 57 base::FieldTrialList::FindValue("InstantDummy"); | 112 base::FieldTrialList::FindValue("InstantDummy"); |
| 58 base::FieldTrialList::FindValue("InstantChannel"); | 113 base::FieldTrialList::FindValue("InstantChannel"); |
| 59 base::FieldTrialList::FindValue("Test0PercentDefault"); | 114 base::FieldTrialList::FindValue("Test0PercentDefault"); |
| 60 // The following trials are used from renderer process. | 115 // The following trials are used from renderer process. |
| 61 // Mark here so they will be sync-ed. | 116 // Mark here so they will be sync-ed. |
| 62 base::FieldTrialList::FindValue("CLD1VsCLD2"); | 117 base::FieldTrialList::FindValue("CLD1VsCLD2"); |
| 63 base::FieldTrialList::FindValue("MouseEventPreconnect"); | 118 base::FieldTrialList::FindValue("MouseEventPreconnect"); |
| 64 base::FieldTrialList::FindValue("UnauthorizedPluginInfoBar"); | 119 base::FieldTrialList::FindValue("UnauthorizedPluginInfoBar"); |
| 65 // Activate the autocomplete dynamic field trials. | 120 // Activate the autocomplete dynamic field trials. |
| 66 OmniboxFieldTrial::ActivateDynamicTrials(); | 121 OmniboxFieldTrial::ActivateDynamicTrials(); |
| 67 } | 122 } |
| OLD | NEW |