| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chrome_browser_field_trials_mobile.h" |
| 6 |
| 7 #include <string> |
| 8 |
| 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/prefs/pref_service.h" |
| 12 #include "chrome/common/chrome_version_info.h" |
| 13 |
| 14 namespace chrome { |
| 15 |
| 16 namespace { |
| 17 |
| 18 // Governs the rollout of the compression proxy for Chrome on mobile platforms. |
| 19 // Always enabled in DEV and BETA versions. |
| 20 // Stable percentage will be controlled from server. |
| 21 void DataCompressionProxyFieldTrial() { |
| 22 const char kDataCompressionProxyFieldTrialName[] = |
| 23 "DataCompressionProxyRollout"; |
| 24 const base::FieldTrial::Probability kDataCompressionProxyDivisor = 1000; |
| 25 |
| 26 // 10/1000 = 1% for starters. |
| 27 const base::FieldTrial::Probability kDataCompressionProxyStable = 10; |
| 28 const char kEnabled[] = "Enabled"; |
| 29 const char kDisabled[] = "Disabled"; |
| 30 |
| 31 // Find out if this is a stable channel. |
| 32 const bool kIsStableChannel = |
| 33 chrome::VersionInfo::GetChannel() == chrome::VersionInfo::CHANNEL_STABLE; |
| 34 |
| 35 // Experiment enabled until Jan 1, 2015. By default, disabled. |
| 36 scoped_refptr<base::FieldTrial> trial( |
| 37 base::FieldTrialList::FactoryGetFieldTrial( |
| 38 kDataCompressionProxyFieldTrialName, kDataCompressionProxyDivisor, |
| 39 kDisabled, 2015, 1, 1, NULL)); |
| 40 |
| 41 // We want our trial results to be persistent. |
| 42 trial->UseOneTimeRandomization(); |
| 43 // Non-stable channels will run with probability 1. |
| 44 const int kEnabledGroup = trial->AppendGroup( |
| 45 kEnabled, |
| 46 kIsStableChannel ? |
| 47 kDataCompressionProxyStable : kDataCompressionProxyDivisor); |
| 48 |
| 49 const int v = trial->group(); |
| 50 VLOG(1) << "DataCompression proxy enabled group id: " << kEnabledGroup |
| 51 << ". Selected group id: " << v; |
| 52 } |
| 53 |
| 54 } // end namespace |
| 55 |
| 56 |
| 57 void SetupMobileFieldTrials(const CommandLine& parsed_command_line, |
| 58 const base::Time& install_time, |
| 59 PrefService* local_state) { |
| 60 DataCompressionProxyFieldTrial(); |
| 61 } |
| 62 |
| 63 } // end namespace chrome |
| OLD | NEW |