| 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_main.h" | 5 #include "chrome/browser/chrome_browser_main.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 trial_base_ids[i]); | 1074 trial_base_ids[i]); |
| 1075 // Loop starts with group 1 because the field trial automatically creates a | 1075 // Loop starts with group 1 because the field trial automatically creates a |
| 1076 // default group, which would be group 0. | 1076 // default group, which would be group 0. |
| 1077 for (int group_number = 1; group_number < trial_sizes[i]; ++group_number) { | 1077 for (int group_number = 1; group_number < trial_sizes[i]; ++group_number) { |
| 1078 const std::string group_name = StringPrintf("group_%02d", group_number); | 1078 const std::string group_name = StringPrintf("group_%02d", group_number); |
| 1079 DVLOG(1) << " Group name = " << group_name; | 1079 DVLOG(1) << " Group name = " << group_name; |
| 1080 trial->AppendGroup(group_name, kProbabilityPerGroup); | 1080 trial->AppendGroup(group_name, kProbabilityPerGroup); |
| 1081 experiments_helper::AssociateGoogleExperimentID(trial_name, group_name, | 1081 experiments_helper::AssociateGoogleExperimentID(trial_name, group_name, |
| 1082 static_cast<chrome_variations::ID>(trial_base_ids[i] + group_number)); | 1082 static_cast<chrome_variations::ID>(trial_base_ids[i] + group_number)); |
| 1083 } | 1083 } |
| 1084 |
| 1085 // Now that all groups have been appended, call group() on the trial to |
| 1086 // ensure that our trial is registered. This resolves an off-by-one issue |
| 1087 // where the default group never gets chosen if we don't "use" the trial. |
| 1088 int chosen_group = trial->group(); |
| 1089 DVLOG(1) << "Chosen Group: " << chosen_group; |
| 1084 } | 1090 } |
| 1085 } | 1091 } |
| 1086 | 1092 |
| 1087 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- | 1093 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- |
| 1088 | 1094 |
| 1089 void ChromeBrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, | 1095 void ChromeBrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, |
| 1090 bool proxy_policy_is_set) { | 1096 bool proxy_policy_is_set) { |
| 1091 // Note: make sure to call ConnectionFieldTrial() before | 1097 // Note: make sure to call ConnectionFieldTrial() before |
| 1092 // ProxyConnectionsFieldTrial(). | 1098 // ProxyConnectionsFieldTrial(). |
| 1093 ConnectionFieldTrial(); | 1099 ConnectionFieldTrial(); |
| (...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2003 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2009 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 2004 uma_name += "_XP"; | 2010 uma_name += "_XP"; |
| 2005 | 2011 |
| 2006 uma_name += "_PreRead_"; | 2012 uma_name += "_PreRead_"; |
| 2007 uma_name += pre_read_percentage; | 2013 uma_name += pre_read_percentage; |
| 2008 AddPreReadHistogramTime(uma_name.c_str(), time); | 2014 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 2009 } | 2015 } |
| 2010 #endif | 2016 #endif |
| 2011 #endif | 2017 #endif |
| 2012 } | 2018 } |
| OLD | NEW |