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