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_field_trials.h" | 5 #include "chrome/browser/chrome_browser_field_trials.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 15 matching lines...) Expand all Loading... | |
26 #include "chrome/common/chrome_version_info.h" | 26 #include "chrome/common/chrome_version_info.h" |
27 #include "chrome/common/metrics/variations/variations_util.h" | 27 #include "chrome/common/metrics/variations/variations_util.h" |
28 #include "net/http/http_stream_factory.h" | 28 #include "net/http/http_stream_factory.h" |
29 #include "net/socket/client_socket_pool_base.h" | 29 #include "net/socket/client_socket_pool_base.h" |
30 #include "net/socket/client_socket_pool_manager.h" | 30 #include "net/socket/client_socket_pool_manager.h" |
31 #include "net/spdy/spdy_session.h" | 31 #include "net/spdy/spdy_session.h" |
32 #include "net/spdy/spdy_session_pool.h" | 32 #include "net/spdy/spdy_session_pool.h" |
33 #include "ui/base/layout.h" | 33 #include "ui/base/layout.h" |
34 | 34 |
35 #if defined(OS_WIN) | 35 #if defined(OS_WIN) |
36 #include "net/socket/tcp_client_socket_win.h" | |
36 #include "ui/base/win/dpi.h" // For DisableNewTabFieldTrialIfNecesssary. | 37 #include "ui/base/win/dpi.h" // For DisableNewTabFieldTrialIfNecesssary. |
37 #endif // defined(OS_WIN) | 38 #endif // defined(OS_WIN) |
38 | 39 |
39 namespace { | 40 namespace { |
40 | 41 |
41 // Set up a uniformity field trial. |one_time_randomized| indicates if the | 42 // Set up a uniformity field trial. |one_time_randomized| indicates if the |
42 // field trial is one-time randomized or session-randomized. |trial_name_string| | 43 // field trial is one-time randomized or session-randomized. |trial_name_string| |
43 // must contain a "%d" since the percentage of the group will be inserted in | 44 // must contain a "%d" since the percentage of the group will be inserted in |
44 // the trial name. |num_trial_groups| must be a divisor of 100 (e.g. 5, 20) | 45 // the trial name. |num_trial_groups| must be a divisor of 100 (e.g. 5, 20) |
45 void SetupSingleUniformityFieldTrial( | 46 void SetupSingleUniformityFieldTrial( |
(...skipping 11 matching lines...) Expand all Loading... | |
57 const int group_percent = 100 / num_trial_groups; | 58 const int group_percent = 100 / num_trial_groups; |
58 const std::string trial_name = StringPrintf(trial_name_string.c_str(), | 59 const std::string trial_name = StringPrintf(trial_name_string.c_str(), |
59 group_percent); | 60 group_percent); |
60 | 61 |
61 DVLOG(1) << "Trial name = " << trial_name; | 62 DVLOG(1) << "Trial name = " << trial_name; |
62 | 63 |
63 scoped_refptr<base::FieldTrial> trial( | 64 scoped_refptr<base::FieldTrial> trial( |
64 base::FieldTrialList::FactoryGetFieldTrial( | 65 base::FieldTrialList::FactoryGetFieldTrial( |
65 trial_name, divisor, kDefaultGroupName, 2015, 1, 1, NULL)); | 66 trial_name, divisor, kDefaultGroupName, 2015, 1, 1, NULL)); |
66 if (one_time_randomized) | 67 if (one_time_randomized) |
67 trial->UseOneTimeRandomization(); | 68 trial->UseOneTimeRandomization(); |
rvargas (doing something else)
2012/10/23 00:19:40
nit: indent 2 spaces.
pmeenan
2012/10/23 14:29:54
Done.
| |
68 chrome_variations::AssociateGoogleVariationID(trial_name, kDefaultGroupName, | 69 chrome_variations::AssociateGoogleVariationID(trial_name, kDefaultGroupName, |
69 trial_base_id); | 70 trial_base_id); |
70 // Loop starts with group 1 because the field trial automatically creates a | 71 // Loop starts with group 1 because the field trial automatically creates a |
71 // default group, which would be group 0. | 72 // default group, which would be group 0. |
72 for (int group_number = 1; group_number < num_trial_groups; ++group_number) { | 73 for (int group_number = 1; group_number < num_trial_groups; ++group_number) { |
73 const std::string group_name = StringPrintf("group_%02d", group_number); | 74 const std::string group_name = StringPrintf("group_%02d", group_number); |
74 DVLOG(1) << " Group name = " << group_name; | 75 DVLOG(1) << " Group name = " << group_name; |
75 trial->AppendGroup(group_name, kProbabilityPerGroup); | 76 trial->AppendGroup(group_name, kProbabilityPerGroup); |
76 chrome_variations::AssociateGoogleVariationID(trial_name, group_name, | 77 chrome_variations::AssociateGoogleVariationID(trial_name, group_name, |
77 static_cast<chrome_variations::VariationID>(trial_base_id + | 78 static_cast<chrome_variations::VariationID>(trial_base_id + |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 DefaultAppsFieldTrial(); | 123 DefaultAppsFieldTrial(); |
123 AutoLaunchChromeFieldTrial(); | 124 AutoLaunchChromeFieldTrial(); |
124 gpu_util::InitializeCompositingFieldTrial(); | 125 gpu_util::InitializeCompositingFieldTrial(); |
125 gpu_util::InitializeStage3DFieldTrial(); | 126 gpu_util::InitializeStage3DFieldTrial(); |
126 SetupUniformityFieldTrials(); | 127 SetupUniformityFieldTrials(); |
127 AutocompleteFieldTrial::Activate(); | 128 AutocompleteFieldTrial::Activate(); |
128 DisableNewTabFieldTrialIfNecesssary(); | 129 DisableNewTabFieldTrialIfNecesssary(); |
129 SetUpSafeBrowsingInterstitialFieldTrial(); | 130 SetUpSafeBrowsingInterstitialFieldTrial(); |
130 SetUpInfiniteCacheFieldTrial(); | 131 SetUpInfiniteCacheFieldTrial(); |
131 SetUpCacheSensitivityAnalysisFieldTrial(); | 132 SetUpCacheSensitivityAnalysisFieldTrial(); |
133 WindowsOverlappedTCPReadsFieldTrial(); | |
132 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 134 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
133 OneClickSigninHelper::InitializeFieldTrial(); | 135 OneClickSigninHelper::InitializeFieldTrial(); |
134 #endif | 136 #endif |
135 } | 137 } |
136 | 138 |
137 // This is an A/B test for the maximum number of persistent connections per | 139 // This is an A/B test for the maximum number of persistent connections per |
138 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari | 140 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari |
139 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to | 141 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to |
140 // run faster) uses 8. We would like to see how much of an effect this value has | 142 // run faster) uses 8. We would like to see how much of an effect this value has |
141 // on browsing. Too large a value might cause us to run into SYN flood detection | 143 // on browsing. Too large a value might cause us to run into SYN flood detection |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
580 2012, 12, 31, NULL)); | 582 2012, 12, 31, NULL)); |
581 trial->AppendGroup("ControlA", sensitivity_analysis_probability); | 583 trial->AppendGroup("ControlA", sensitivity_analysis_probability); |
582 trial->AppendGroup("ControlB", sensitivity_analysis_probability); | 584 trial->AppendGroup("ControlB", sensitivity_analysis_probability); |
583 trial->AppendGroup("100A", sensitivity_analysis_probability); | 585 trial->AppendGroup("100A", sensitivity_analysis_probability); |
584 trial->AppendGroup("100B", sensitivity_analysis_probability); | 586 trial->AppendGroup("100B", sensitivity_analysis_probability); |
585 trial->AppendGroup("200A", sensitivity_analysis_probability); | 587 trial->AppendGroup("200A", sensitivity_analysis_probability); |
586 trial->AppendGroup("200B", sensitivity_analysis_probability); | 588 trial->AppendGroup("200B", sensitivity_analysis_probability); |
587 trial->AppendGroup("400A", sensitivity_analysis_probability); | 589 trial->AppendGroup("400A", sensitivity_analysis_probability); |
588 trial->AppendGroup("400B", sensitivity_analysis_probability); | 590 trial->AppendGroup("400B", sensitivity_analysis_probability); |
589 } | 591 } |
592 | |
593 void ChromeBrowserFieldTrials::WindowsOverlappedTCPReadsFieldTrial() { | |
594 #if defined(OS_WIN) | |
595 if (parsed_command_line_.HasSwitch(switches::kOverlappedRead)) { | |
596 std::string option = | |
597 parsed_command_line_.GetSwitchValueASCII(switches::kOverlappedRead); | |
598 if (LowerCaseEqualsASCII(option, "off")) | |
599 net::TCPClientSocketWin::DisableOverlappedReads(); | |
600 } else { | |
601 const base::FieldTrial::Probability kDivisor = 2; // 1 in 2 chance | |
602 const base::FieldTrial::Probability kOverlappedReadProbability = 1; | |
603 scoped_refptr<base::FieldTrial> nbread_trial( | |
rvargas (doing something else)
2012/10/23 00:19:40
nbread?
pmeenan
2012/10/23 14:29:54
thx, missed that one. Now overlapped_reads_trial.
| |
604 base::FieldTrialList::FactoryGetFieldTrial("OverlappedReadImpact", | |
605 kDivisor, "OverlappedReadEnabled", 2013, 6, 1, NULL)); | |
606 int overlapped_reads_disabled_group = | |
607 nbread_trial->AppendGroup("OverlappedReadDisabled", | |
608 kOverlappedReadProbability); | |
609 int assigned_group = nbread_trial->group(); | |
610 if (assigned_group == overlapped_reads_disabled_group) | |
611 net::TCPClientSocketWin::DisableOverlappedReads(); | |
612 } | |
613 #endif | |
614 } | |
615 | |
OLD | NEW |