| 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 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 // default group: no npn or spdy is involved. The "old" non-spdy | 783 // default group: no npn or spdy is involved. The "old" non-spdy |
| 784 // chrome behavior. | 784 // chrome behavior. |
| 785 void ChromeBrowserMainParts::SpdyFieldTrial() { | 785 void ChromeBrowserMainParts::SpdyFieldTrial() { |
| 786 if (parsed_command_line().HasSwitch(switches::kUseSpdy)) { | 786 if (parsed_command_line().HasSwitch(switches::kUseSpdy)) { |
| 787 std::string spdy_mode = | 787 std::string spdy_mode = |
| 788 parsed_command_line().GetSwitchValueASCII(switches::kUseSpdy); | 788 parsed_command_line().GetSwitchValueASCII(switches::kUseSpdy); |
| 789 net::HttpNetworkLayer::EnableSpdy(spdy_mode); | 789 net::HttpNetworkLayer::EnableSpdy(spdy_mode); |
| 790 } | 790 } |
| 791 if (parsed_command_line().HasSwitch(switches::kEnableSpdy3)) { | 791 if (parsed_command_line().HasSwitch(switches::kEnableSpdy3)) { |
| 792 net::HttpStreamFactory::EnableNpnSpdy3(); | 792 net::HttpStreamFactory::EnableNpnSpdy3(); |
| 793 } else if (parsed_command_line().HasSwitch( | |
| 794 switches::kEnableSpdyFlowControl)) { | |
| 795 net::HttpStreamFactory::EnableFlowControl(); | |
| 796 } else if (parsed_command_line().HasSwitch(switches::kEnableNpn)) { | 793 } else if (parsed_command_line().HasSwitch(switches::kEnableNpn)) { |
| 797 net::HttpStreamFactory::EnableNpnSpdy(); | 794 net::HttpStreamFactory::EnableNpnSpdy(); |
| 798 } else if (parsed_command_line().HasSwitch(switches::kEnableNpnHttpOnly)) { | 795 } else if (parsed_command_line().HasSwitch(switches::kEnableNpnHttpOnly)) { |
| 799 net::HttpStreamFactory::EnableNpnHttpOnly(); | 796 net::HttpStreamFactory::EnableNpnHttpOnly(); |
| 800 } else { | 797 } else { |
| 801 #if !defined(OS_CHROMEOS) | 798 #if !defined(OS_CHROMEOS) |
| 802 bool is_spdy_trial = false; | |
| 803 const base::FieldTrial::Probability kSpdyDivisor = 100; | 799 const base::FieldTrial::Probability kSpdyDivisor = 100; |
| 804 base::FieldTrial::Probability npnhttp_probability = 5; | 800 base::FieldTrial::Probability npnhttp_probability = 5; |
| 805 base::FieldTrial::Probability flow_control_probability = 5; | |
| 806 base::FieldTrial::Probability spdy3_probability = 0; | 801 base::FieldTrial::Probability spdy3_probability = 0; |
| 807 | 802 |
| 808 // After June 30, 2013 builds, it will always be in default group. | 803 // After June 30, 2013 builds, it will always be in default group. |
| 809 scoped_refptr<base::FieldTrial> trial( | 804 scoped_refptr<base::FieldTrial> trial( |
| 810 new base::FieldTrial( | 805 new base::FieldTrial( |
| 811 "SpdyImpact", kSpdyDivisor, "npn_with_spdy", 2013, 6, 30)); | 806 "SpdyImpact", kSpdyDivisor, "npn_with_spdy", 2013, 6, 30)); |
| 812 | 807 |
| 813 // NPN with spdy support is the default. | 808 // NPN with spdy support is the default. |
| 814 int npn_spdy_grp = trial->kDefaultGroupNumber; | 809 int npn_spdy_grp = trial->kDefaultGroupNumber; |
| 815 | 810 |
| 816 // NPN with only http support, no spdy. | 811 // NPN with only http support, no spdy. |
| 817 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); | 812 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); |
| 818 | 813 |
| 819 // NPN with http/1.1, spdy/2, spdy/2.1 and spdy/3 support. | 814 // NPN with http/1.1, spdy/2, and spdy/3 support. |
| 820 int spdy3_grp = trial->AppendGroup("spdy3", spdy3_probability); | 815 int spdy3_grp = trial->AppendGroup("spdy3", spdy3_probability); |
| 821 | 816 |
| 822 // NPN with http/1.1, spdy/2 and spdy/2.1 support. | |
| 823 int flow_control_grp = trial->AppendGroup( | |
| 824 "flow_control", flow_control_probability); | |
| 825 | |
| 826 int trial_grp = trial->group(); | 817 int trial_grp = trial->group(); |
| 827 if (trial_grp == npn_spdy_grp) { | 818 if (trial_grp == npn_spdy_grp) { |
| 828 is_spdy_trial = true; | |
| 829 net::HttpStreamFactory::EnableNpnSpdy(); | 819 net::HttpStreamFactory::EnableNpnSpdy(); |
| 830 } else if (trial_grp == npn_http_grp) { | 820 } else if (trial_grp == npn_http_grp) { |
| 831 is_spdy_trial = true; | |
| 832 net::HttpStreamFactory::EnableNpnHttpOnly(); | 821 net::HttpStreamFactory::EnableNpnHttpOnly(); |
| 833 } else if (trial_grp == spdy3_grp) { | 822 } else if (trial_grp == spdy3_grp) { |
| 834 is_spdy_trial = true; | |
| 835 net::HttpStreamFactory::EnableNpnSpdy3(); | 823 net::HttpStreamFactory::EnableNpnSpdy3(); |
| 836 } else if (trial_grp == flow_control_grp) { | |
| 837 is_spdy_trial = true; | |
| 838 net::HttpStreamFactory::EnableFlowControl(); | |
| 839 } else { | 824 } else { |
| 840 CHECK(!is_spdy_trial); | 825 NOTREACHED(); |
| 841 } | 826 } |
| 842 #else | 827 #else |
| 843 // Always enable SPDY on Chrome OS | 828 // Always enable SPDY on Chrome OS |
| 844 net::HttpStreamFactory::EnableNpnSpdy(); | 829 net::HttpStreamFactory::EnableNpnSpdy(); |
| 845 #endif // !defined(OS_CHROMEOS) | 830 #endif // !defined(OS_CHROMEOS) |
| 846 } | 831 } |
| 847 | 832 |
| 848 // Setup SPDY CWND Field trial. | 833 // Setup SPDY CWND Field trial. |
| 849 const base::FieldTrial::Probability kSpdyCwndDivisor = 100; | 834 const base::FieldTrial::Probability kSpdyCwndDivisor = 100; |
| 850 const base::FieldTrial::Probability kSpdyCwnd16 = 20; // fixed at 16 | 835 const base::FieldTrial::Probability kSpdyCwnd16 = 20; // fixed at 16 |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1990 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1975 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1991 uma_name += "_XP"; | 1976 uma_name += "_XP"; |
| 1992 | 1977 |
| 1993 uma_name += "_PreRead_"; | 1978 uma_name += "_PreRead_"; |
| 1994 uma_name += pre_read_percentage; | 1979 uma_name += pre_read_percentage; |
| 1995 AddPreReadHistogramTime(uma_name.c_str(), time); | 1980 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1996 } | 1981 } |
| 1997 #endif | 1982 #endif |
| 1998 #endif | 1983 #endif |
| 1999 } | 1984 } |
| OLD | NEW |