diff options
author | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 00:23:49 +0000 |
---|---|---|
committer | rohitrao@chromium.org <rohitrao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-23 00:23:49 +0000 |
commit | aa61db0f11bda38bb11600df6d9be71b7f7ff5e9 (patch) | |
tree | c7fd476524bc882d9894eac7be1e563bba07c92d /chrome/browser/chrome_browser_field_trials_mobile.cc | |
parent | 859062db0d72fde81468c3a3c77442754dd0212a (diff) | |
download | chromium_src-aa61db0f11bda38bb11600df6d9be71b7f7ff5e9.zip chromium_src-aa61db0f11bda38bb11600df6d9be71b7f7ff5e9.tar.gz chromium_src-aa61db0f11bda38bb11600df6d9be71b7f7ff5e9.tar.bz2 |
Split the field trial setup code into desktop and mobile files.
BUG=233551
TEST=No visible impact.
Review URL: https://chromiumcodereview.appspot.com/14247021
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195654 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_browser_field_trials_mobile.cc')
-rw-r--r-- | chrome/browser/chrome_browser_field_trials_mobile.cc | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/chrome/browser/chrome_browser_field_trials_mobile.cc b/chrome/browser/chrome_browser_field_trials_mobile.cc new file mode 100644 index 0000000..7fb1896 --- /dev/null +++ b/chrome/browser/chrome_browser_field_trials_mobile.cc @@ -0,0 +1,62 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/chrome_browser_field_trials_mobile.h" + +#include <string> + +#include "base/command_line.h" +#include "base/metrics/field_trial.h" +#include "base/prefs/pref_service.h" +#include "chrome/common/chrome_version_info.h" + +namespace chrome { + +namespace { + +// Governs the rollout of the compression proxy for Chrome on mobile platforms. +// Always enabled in DEV and BETA versions. +// Stable percentage will be controlled from server. +void DataCompressionProxyFieldTrial() { + const char kDataCompressionProxyFieldTrialName[] = + "DataCompressionProxyRollout"; + const base::FieldTrial::Probability kDataCompressionProxyDivisor = 1000; + + // 10/1000 = 1% for starters. + const base::FieldTrial::Probability kDataCompressionProxyStable = 10; + const char kEnabled[] = "Enabled"; + const char kDisabled[] = "Disabled"; + + // Find out if this is a stable channel. + const bool kIsStableChannel = + chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; + + // Experiment enabled until Jan 1, 2015. By default, disabled. + scoped_refptr<base::FieldTrial> trial( + base::FieldTrialList::FactoryGetFieldTrial( + kDataCompressionProxyFieldTrialName, kDataCompressionProxyDivisor, + kDisabled, 2015, 1, 1, NULL)); + + // We want our trial results to be persistent. + trial->UseOneTimeRandomization(); + // Non-stable channels will run with probability 1. + const int kEnabledGroup = trial->AppendGroup( + kEnabled, + kIsStableChannel ? + kDataCompressionProxyStable : kDataCompressionProxyDivisor); + + const int v = trial->group(); + VLOG(1) << "DataCompression proxy enabled group id: " << kEnabledGroup + << ". Selected group id: " << v; +} + +} // namespace + +void SetupMobileFieldTrials(const CommandLine& parsed_command_line, + const base::Time& install_time, + PrefService* local_state) { + DataCompressionProxyFieldTrial(); +} + +} // namespace chrome |