| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 #include "chrome/common/child_process_logging.h" | 86 #include "chrome/common/child_process_logging.h" |
| 87 #include "chrome/common/chrome_constants.h" | 87 #include "chrome/common/chrome_constants.h" |
| 88 #include "chrome/common/chrome_paths.h" | 88 #include "chrome/common/chrome_paths.h" |
| 89 #include "chrome/common/chrome_result_codes.h" | 89 #include "chrome/common/chrome_result_codes.h" |
| 90 #include "chrome/common/chrome_switches.h" | 90 #include "chrome/common/chrome_switches.h" |
| 91 #include "chrome/common/chrome_version_info.h" | 91 #include "chrome/common/chrome_version_info.h" |
| 92 #include "chrome/common/env_vars.h" | 92 #include "chrome/common/env_vars.h" |
| 93 #include "chrome/common/json_pref_store.h" | 93 #include "chrome/common/json_pref_store.h" |
| 94 #include "chrome/common/jstemplate_builder.h" | 94 #include "chrome/common/jstemplate_builder.h" |
| 95 #include "chrome/common/logging_chrome.h" | 95 #include "chrome/common/logging_chrome.h" |
| 96 #include "chrome/common/metrics/experiments_helper.h" |
| 96 #include "chrome/common/net/net_resource_provider.h" | 97 #include "chrome/common/net/net_resource_provider.h" |
| 97 #include "chrome/common/pref_names.h" | 98 #include "chrome/common/pref_names.h" |
| 98 #include "chrome/common/profiling.h" | 99 #include "chrome/common/profiling.h" |
| 99 #include "chrome/installer/util/google_update_settings.h" | 100 #include "chrome/installer/util/google_update_settings.h" |
| 100 #include "content/public/browser/browser_thread.h" | 101 #include "content/public/browser/browser_thread.h" |
| 101 #include "content/public/browser/gpu_data_manager.h" | 102 #include "content/public/browser/gpu_data_manager.h" |
| 102 #include "content/public/browser/render_process_host.h" | 103 #include "content/public/browser/render_process_host.h" |
| 103 #include "content/public/common/content_client.h" | 104 #include "content/public/common/content_client.h" |
| 104 #include "content/public/common/main_function_params.h" | 105 #include "content/public/common/main_function_params.h" |
| 105 #include "grit/app_locale_settings.h" | 106 #include "grit/app_locale_settings.h" |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1037 net::SSLConfigService::EnableDomainBoundCertsTrial(); | 1038 net::SSLConfigService::EnableDomainBoundCertsTrial(); |
| 1038 } | 1039 } |
| 1039 } | 1040 } |
| 1040 | 1041 |
| 1041 void ChromeBrowserMainParts::SetupUniformityFieldTrials() { | 1042 void ChromeBrowserMainParts::SetupUniformityFieldTrials() { |
| 1042 // One field trial will be created for each entry in this array. The i'th | 1043 // One field trial will be created for each entry in this array. The i'th |
| 1043 // field trial will have |trial_sizes[i]| groups in it, including the default | 1044 // field trial will have |trial_sizes[i]| groups in it, including the default |
| 1044 // group. Each group will have a probability of 1/|trial_sizes[i]|. | 1045 // group. Each group will have a probability of 1/|trial_sizes[i]|. |
| 1045 const int trial_sizes[] = { 100, 20, 10, 5, 2 }; | 1046 const int trial_sizes[] = { 100, 20, 10, 5, 2 }; |
| 1046 | 1047 |
| 1048 // Declare our variation ID bases along side this array so we can loop over it |
| 1049 // and assign the IDs appropriately. So for example, the 1 percent experiments |
| 1050 // should have a size of 100 (100/100 = 1). |
| 1051 const chrome_variations::ID trial_base_ids[] = { |
| 1052 chrome_variations::kUniformity1PercentBase, |
| 1053 chrome_variations::kUniformity5PercentBase, |
| 1054 chrome_variations::kUniformity10PercentBase, |
| 1055 chrome_variations::kUniformity20PercentBase, |
| 1056 chrome_variations::kUniformity50PercentBase |
| 1057 }; |
| 1058 |
| 1047 // Probability per group remains constant for all uniformity trials, what | 1059 // Probability per group remains constant for all uniformity trials, what |
| 1048 // changes is the probability divisor. | 1060 // changes is the probability divisor. |
| 1049 static const base::FieldTrial::Probability kProbabilityPerGroup = 1; | 1061 static const base::FieldTrial::Probability kProbabilityPerGroup = 1; |
| 1050 for (size_t i = 0; i < arraysize(trial_sizes); ++i) { | 1062 for (size_t i = 0; i < arraysize(trial_sizes); ++i) { |
| 1051 const base::FieldTrial::Probability divisor = trial_sizes[i]; | 1063 const base::FieldTrial::Probability divisor = trial_sizes[i]; |
| 1052 | 1064 |
| 1053 const int group_percent = 100 / trial_sizes[i]; | 1065 const int group_percent = 100 / trial_sizes[i]; |
| 1054 const std::string trial_name = | 1066 const std::string trial_name = |
| 1055 StringPrintf("UMA-Uniformity-Trial-%d-Percent", group_percent); | 1067 StringPrintf("UMA-Uniformity-Trial-%d-Percent", group_percent); |
| 1056 | 1068 |
| 1057 DVLOG(1) << "Trial name = " << trial_name; | 1069 DVLOG(1) << "Trial name = " << trial_name; |
| 1058 | 1070 |
| 1059 scoped_refptr<base::FieldTrial> trial( | 1071 scoped_refptr<base::FieldTrial> trial( |
| 1060 base::FieldTrialList::FactoryGetFieldTrial( | 1072 base::FieldTrialList::FactoryGetFieldTrial( |
| 1061 trial_name, divisor, "default", 2015, 1, 1, NULL)); | 1073 trial_name, divisor, "default", 2015, 1, 1, NULL)); |
| 1074 experiments_helper::AssociateGoogleExperimentID(trial_name, "default", |
| 1075 trial_base_ids[i]); |
| 1062 // 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 |
| 1063 // default group, which would be group 0. | 1077 // default group, which would be group 0. |
| 1064 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) { |
| 1065 const std::string group_name = StringPrintf("group_%02d", group_number); | 1079 const std::string group_name = StringPrintf("group_%02d", group_number); |
| 1066 DVLOG(1) << " Group name = " << group_name; | 1080 DVLOG(1) << " Group name = " << group_name; |
| 1067 trial->AppendGroup(group_name, kProbabilityPerGroup); | 1081 trial->AppendGroup(group_name, kProbabilityPerGroup); |
| 1082 experiments_helper::AssociateGoogleExperimentID(trial_name, group_name, |
| 1083 static_cast<chrome_variations::ID>(trial_base_ids[i] + group_number)); |
| 1068 } | 1084 } |
| 1069 } | 1085 } |
| 1070 } | 1086 } |
| 1071 | 1087 |
| 1072 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- | 1088 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- |
| 1073 | 1089 |
| 1074 void ChromeBrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, | 1090 void ChromeBrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, |
| 1075 bool proxy_policy_is_set) { | 1091 bool proxy_policy_is_set) { |
| 1076 // Note: make sure to call ConnectionFieldTrial() before | 1092 // Note: make sure to call ConnectionFieldTrial() before |
| 1077 // ProxyConnectionsFieldTrial(). | 1093 // ProxyConnectionsFieldTrial(). |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1988 if (base::win::GetVersion() <= base::win::VERSION_XP) | 2004 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1989 uma_name += "_XP"; | 2005 uma_name += "_XP"; |
| 1990 | 2006 |
| 1991 uma_name += "_PreRead_"; | 2007 uma_name += "_PreRead_"; |
| 1992 uma_name += pre_read_percentage; | 2008 uma_name += pre_read_percentage; |
| 1993 AddPreReadHistogramTime(uma_name.c_str(), time); | 2009 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1994 } | 2010 } |
| 1995 #endif | 2011 #endif |
| 1996 #endif | 2012 #endif |
| 1997 } | 2013 } |
| OLD | NEW |