Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 #include "chrome/browser/net/predictor.h" | 21 #include "chrome/browser/net/predictor.h" |
| 22 #include "chrome/browser/prerender/prerender_field_trial.h" | 22 #include "chrome/browser/prerender/prerender_field_trial.h" |
| 23 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" | 23 #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" |
| 24 #include "chrome/browser/ui/sync/one_click_signin_helper.h" | 24 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
| 25 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 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 #if defined(OS_WIN) | |
| 32 #include "net/socket/tcp_client_socket_win.h" | |
| 33 #endif // defined(OS_WIN) | |
|
Ryan Sleevi
2012/10/12 18:53:13
style nit: Platform defines like go after the 'sta
pmeenan
2012/10/17 15:12:31
Done.
| |
| 31 #include "net/spdy/spdy_session.h" | 34 #include "net/spdy/spdy_session.h" |
| 32 #include "net/spdy/spdy_session_pool.h" | 35 #include "net/spdy/spdy_session_pool.h" |
| 33 #include "ui/base/layout.h" | 36 #include "ui/base/layout.h" |
| 34 | 37 |
| 35 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 36 #include "ui/base/win/dpi.h" // For DisableNewTabFieldTrialIfNecesssary. | 39 #include "ui/base/win/dpi.h" // For DisableNewTabFieldTrialIfNecesssary. |
| 37 #endif // defined(OS_WIN) | 40 #endif // defined(OS_WIN) |
| 38 | 41 |
| 39 namespace { | 42 namespace { |
| 40 | 43 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 57 const int group_percent = 100 / num_trial_groups; | 60 const int group_percent = 100 / num_trial_groups; |
| 58 const std::string trial_name = StringPrintf(trial_name_string.c_str(), | 61 const std::string trial_name = StringPrintf(trial_name_string.c_str(), |
| 59 group_percent); | 62 group_percent); |
| 60 | 63 |
| 61 DVLOG(1) << "Trial name = " << trial_name; | 64 DVLOG(1) << "Trial name = " << trial_name; |
| 62 | 65 |
| 63 scoped_refptr<base::FieldTrial> trial( | 66 scoped_refptr<base::FieldTrial> trial( |
| 64 base::FieldTrialList::FactoryGetFieldTrial( | 67 base::FieldTrialList::FactoryGetFieldTrial( |
| 65 trial_name, divisor, kDefaultGroupName, 2015, 1, 1, NULL)); | 68 trial_name, divisor, kDefaultGroupName, 2015, 1, 1, NULL)); |
| 66 if (one_time_randomized) | 69 if (one_time_randomized) |
| 67 trial->UseOneTimeRandomization(); | 70 trial->UseOneTimeRandomization(); |
|
Ryan Sleevi
2012/10/12 18:53:13
random nit: would you mind deleting the two spaces
pmeenan
2012/10/17 15:12:31
Done.
| |
| 68 chrome_variations::AssociateGoogleVariationID(trial_name, kDefaultGroupName, | 71 chrome_variations::AssociateGoogleVariationID(trial_name, kDefaultGroupName, |
| 69 trial_base_id); | 72 trial_base_id); |
| 70 // Loop starts with group 1 because the field trial automatically creates a | 73 // Loop starts with group 1 because the field trial automatically creates a |
| 71 // default group, which would be group 0. | 74 // default group, which would be group 0. |
| 72 for (int group_number = 1; group_number < num_trial_groups; ++group_number) { | 75 for (int group_number = 1; group_number < num_trial_groups; ++group_number) { |
| 73 const std::string group_name = StringPrintf("group_%02d", group_number); | 76 const std::string group_name = StringPrintf("group_%02d", group_number); |
| 74 DVLOG(1) << " Group name = " << group_name; | 77 DVLOG(1) << " Group name = " << group_name; |
| 75 trial->AppendGroup(group_name, kProbabilityPerGroup); | 78 trial->AppendGroup(group_name, kProbabilityPerGroup); |
| 76 chrome_variations::AssociateGoogleVariationID(trial_name, group_name, | 79 chrome_variations::AssociateGoogleVariationID(trial_name, group_name, |
| 77 static_cast<chrome_variations::VariationID>(trial_base_id + | 80 static_cast<chrome_variations::VariationID>(trial_base_id + |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 DefaultAppsFieldTrial(); | 125 DefaultAppsFieldTrial(); |
| 123 AutoLaunchChromeFieldTrial(); | 126 AutoLaunchChromeFieldTrial(); |
| 124 gpu_util::InitializeCompositingFieldTrial(); | 127 gpu_util::InitializeCompositingFieldTrial(); |
| 125 gpu_util::InitializeStage3DFieldTrial(); | 128 gpu_util::InitializeStage3DFieldTrial(); |
| 126 SetupUniformityFieldTrials(); | 129 SetupUniformityFieldTrials(); |
| 127 AutocompleteFieldTrial::Activate(); | 130 AutocompleteFieldTrial::Activate(); |
| 128 DisableNewTabFieldTrialIfNecesssary(); | 131 DisableNewTabFieldTrialIfNecesssary(); |
| 129 SetUpSafeBrowsingInterstitialFieldTrial(); | 132 SetUpSafeBrowsingInterstitialFieldTrial(); |
| 130 SetUpInfiniteCacheFieldTrial(); | 133 SetUpInfiniteCacheFieldTrial(); |
| 131 SetUpCacheSensitivityAnalysisFieldTrial(); | 134 SetUpCacheSensitivityAnalysisFieldTrial(); |
| 135 WindowsOverlappedTCPReadsFieldTrial(); | |
| 132 #if defined(ENABLE_ONE_CLICK_SIGNIN) | 136 #if defined(ENABLE_ONE_CLICK_SIGNIN) |
| 133 OneClickSigninHelper::InitializeFieldTrial(); | 137 OneClickSigninHelper::InitializeFieldTrial(); |
| 134 #endif | 138 #endif |
| 135 } | 139 } |
| 136 | 140 |
| 137 // This is an A/B test for the maximum number of persistent connections per | 141 // 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 | 142 // 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 | 143 // 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 | 144 // 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 | 145 // 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)); | 584 2012, 12, 31, NULL)); |
| 581 trial->AppendGroup("ControlA", sensitivity_analysis_probability); | 585 trial->AppendGroup("ControlA", sensitivity_analysis_probability); |
| 582 trial->AppendGroup("ControlB", sensitivity_analysis_probability); | 586 trial->AppendGroup("ControlB", sensitivity_analysis_probability); |
| 583 trial->AppendGroup("100A", sensitivity_analysis_probability); | 587 trial->AppendGroup("100A", sensitivity_analysis_probability); |
| 584 trial->AppendGroup("100B", sensitivity_analysis_probability); | 588 trial->AppendGroup("100B", sensitivity_analysis_probability); |
| 585 trial->AppendGroup("200A", sensitivity_analysis_probability); | 589 trial->AppendGroup("200A", sensitivity_analysis_probability); |
| 586 trial->AppendGroup("200B", sensitivity_analysis_probability); | 590 trial->AppendGroup("200B", sensitivity_analysis_probability); |
| 587 trial->AppendGroup("400A", sensitivity_analysis_probability); | 591 trial->AppendGroup("400A", sensitivity_analysis_probability); |
| 588 trial->AppendGroup("400B", sensitivity_analysis_probability); | 592 trial->AppendGroup("400B", sensitivity_analysis_probability); |
| 589 } | 593 } |
| 594 | |
| 595 void ChromeBrowserFieldTrials::WindowsOverlappedTCPReadsFieldTrial() { | |
|
Ryan Sleevi
2012/10/12 18:53:13
style: Please review this function for whitespace
pmeenan
2012/10/17 15:12:31
Done.
| |
| 596 #if defined(OS_WIN) | |
| 597 if (parsed_command_line_.HasSwitch(switches::kOverlappedRead)) { | |
| 598 std::string option = parsed_command_line_.GetSwitchValueASCII( | |
| 599 switches::kOverlappedRead); | |
| 600 if (LowerCaseEqualsASCII(option, "off")) { | |
| 601 net::TCPClientSocketWin::DisableOverlappedReads(); | |
| 602 } | |
|
Ryan Sleevi
2012/10/12 18:53:13
style nit: the bracing style in this file is to om
pmeenan
2012/10/17 15:12:31
Done.
| |
| 603 } else { | |
| 604 const base::FieldTrial::Probability kDivisor = 2; // 1 in 2 chance | |
| 605 const base::FieldTrial::Probability kOverlappedReadProbability = 1; | |
| 606 scoped_refptr<base::FieldTrial> nbread_trial( | |
| 607 base::FieldTrialList::FactoryGetFieldTrial("OverlappedReadImpact", | |
| 608 kDivisor, "OverlappedReadEnabled", 2015, 1, 1, NULL)); | |
|
Ryan Sleevi
2012/10/12 18:53:13
That's a really long trial. Are you sure that's th
pmeenan
2012/10/17 15:12:31
Done.
| |
| 609 int overlapped_reads_disabled_group = | |
| 610 nbread_trial->AppendGroup("OverlappedReadDisabled", | |
| 611 kOverlappedReadProbability); | |
| 612 int assigned_group = nbread_trial->group(); | |
| 613 if (assigned_group == overlapped_reads_disabled_group) { | |
| 614 net::TCPClientSocketWin::DisableOverlappedReads(); | |
| 615 } | |
| 616 } | |
| 617 #endif | |
| 618 } | |
| 619 | |
| OLD | NEW |