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_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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 585 #endif // defined(OS_WIN) | 585 #endif // defined(OS_WIN) |
| 586 | 586 |
| 587 // Initialize FieldTrialList to support FieldTrials that use one-time | 587 // Initialize FieldTrialList to support FieldTrials that use one-time |
| 588 // randomization. The client ID will be empty if the user has not opted | 588 // randomization. The client ID will be empty if the user has not opted |
| 589 // to send metrics. | 589 // to send metrics. |
| 590 MetricsService* metrics = browser_process_->metrics_service(); | 590 MetricsService* metrics = browser_process_->metrics_service(); |
| 591 if (IsMetricsReportingEnabled()) | 591 if (IsMetricsReportingEnabled()) |
| 592 metrics->ForceClientIdCreation(); // Needed below. | 592 metrics->ForceClientIdCreation(); // Needed below. |
| 593 field_trial_list_.reset(new base::FieldTrialList(metrics->GetClientId())); | 593 field_trial_list_.reset(new base::FieldTrialList(metrics->GetClientId())); |
| 594 | 594 |
| 595 // Ensure any field trials specified on the command line are initialized. | |
| 596 // Also stop the metrics service so that we don't pollute UMA. | |
|
jar (doing other things)
2012/04/06 01:41:29
I'm not sure on the ordering, but disabling UMA is
MAD
2012/04/11 02:38:08
Done.
| |
| 597 #ifndef NDEBUG | |
| 598 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | |
| 599 if (command_line->HasSwitch(switches::kForceFieldTestNameAndValue)) { | |
| 600 std::string persistent = command_line->GetSwitchValueASCII( | |
| 601 switches::kForceFieldTestNameAndValue); | |
| 602 bool ret = base::FieldTrialList::CreateTrialsFromString(persistent); | |
| 603 CHECK(ret) << "Invalid --" << switches::kForceFieldTestNameAndValue << | |
| 604 " list specified."; | |
| 605 metrics->Stop(); | |
| 606 } | |
| 607 #endif // NDEBUG | |
| 608 | |
| 595 SetupFieldTrials(metrics->recording_active(), | 609 SetupFieldTrials(metrics->recording_active(), |
| 596 local_state_->IsManagedPreference( | 610 local_state_->IsManagedPreference( |
| 597 prefs::kMaxConnectionsPerProxy)); | 611 prefs::kMaxConnectionsPerProxy)); |
| 598 | 612 |
| 599 // Initialize FieldTrialSynchronizer system. This is a singleton and is used | 613 // Initialize FieldTrialSynchronizer system. This is a singleton and is used |
| 600 // for posting tasks via base::Bind. Its deleted when it goes out of scope. | 614 // for posting tasks via base::Bind. Its deleted when it goes out of scope. |
| 601 // Even though base::Bind does AddRef and Release, the object will not be | 615 // Even though base::Bind does AddRef and Release, the object will not be |
| 602 // deleted after the Task is executed. | 616 // deleted after the Task is executed. |
| 603 field_trial_synchronizer_ = new FieldTrialSynchronizer(); | 617 field_trial_synchronizer_ = new FieldTrialSynchronizer(); |
| 604 } | 618 } |
| 605 | 619 |
| 606 // This is an A/B test for the maximum number of persistent connections per | 620 // This is an A/B test for the maximum number of persistent connections per |
| 607 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari | 621 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari |
| 608 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to | 622 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to |
| 609 // run faster) uses 8. We would like to see how much of an effect this value has | 623 // run faster) uses 8. We would like to see how much of an effect this value has |
| 610 // on browsing. Too large a value might cause us to run into SYN flood detection | 624 // on browsing. Too large a value might cause us to run into SYN flood detection |
| 611 // mechanisms. | 625 // mechanisms. |
| 612 void ChromeBrowserMainParts::ConnectionFieldTrial() { | 626 void ChromeBrowserMainParts::ConnectionFieldTrial() { |
| 613 const base::FieldTrial::Probability kConnectDivisor = 100; | 627 const base::FieldTrial::Probability kConnectDivisor = 100; |
| 614 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. | 628 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. |
| 615 | 629 |
| 616 // After June 30, 2011 builds, it will always be in default group. | |
| 617 scoped_refptr<base::FieldTrial> connect_trial( | |
| 618 new base::FieldTrial( | |
| 619 "ConnCountImpact", kConnectDivisor, "conn_count_6", 2011, 6, 30)); | |
| 620 | |
| 621 // This (6) is the current default value. Having this group declared here | 630 // This (6) is the current default value. Having this group declared here |
| 622 // makes it straightforward to modify |kConnectProbability| such that the same | 631 // makes it straightforward to modify |kConnectProbability| such that the same |
| 623 // probability value will be assigned to all the other groups, while | 632 // probability value will be assigned to all the other groups, while |
| 624 // preserving the remainder of the of probability space to the default value. | 633 // preserving the remainder of the of probability space to the default value. |
| 625 const int connect_6 = connect_trial->kDefaultGroupNumber; | 634 int connect_6 = -1; |
| 635 | |
| 636 // After June 30, 2011 builds, it will always be in default group. | |
| 637 scoped_refptr<base::FieldTrial> connect_trial( | |
| 638 base::FieldTrialList::GetFieldTrialInstance( | |
| 639 "ConnCountImpact", kConnectDivisor, "conn_count_6", &connect_6, | |
| 640 2011, 6, 30)); | |
| 626 | 641 |
| 627 const int connect_5 = connect_trial->AppendGroup("conn_count_5", | 642 const int connect_5 = connect_trial->AppendGroup("conn_count_5", |
| 628 kConnectProbability); | 643 kConnectProbability); |
| 629 const int connect_7 = connect_trial->AppendGroup("conn_count_7", | 644 const int connect_7 = connect_trial->AppendGroup("conn_count_7", |
| 630 kConnectProbability); | 645 kConnectProbability); |
| 631 const int connect_8 = connect_trial->AppendGroup("conn_count_8", | 646 const int connect_8 = connect_trial->AppendGroup("conn_count_8", |
| 632 kConnectProbability); | 647 kConnectProbability); |
| 633 const int connect_9 = connect_trial->AppendGroup("conn_count_9", | 648 const int connect_9 = connect_trial->AppendGroup("conn_count_9", |
| 634 kConnectProbability); | 649 kConnectProbability); |
| 635 | 650 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 660 // before we time it out. Since these are "unused" sockets, we won't retry the | 675 // before we time it out. Since these are "unused" sockets, we won't retry the |
| 661 // connection and instead show an error to the user. So we need to be | 676 // connection and instead show an error to the user. So we need to be |
| 662 // conservative here. We've seen that some servers will close the socket after | 677 // conservative here. We've seen that some servers will close the socket after |
| 663 // as short as 10 seconds. See http://crbug.com/84313 for more details. | 678 // as short as 10 seconds. See http://crbug.com/84313 for more details. |
| 664 void ChromeBrowserMainParts::SocketTimeoutFieldTrial() { | 679 void ChromeBrowserMainParts::SocketTimeoutFieldTrial() { |
| 665 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; | 680 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; |
| 666 // 1% probability for all experimental settings. | 681 // 1% probability for all experimental settings. |
| 667 const base::FieldTrial::Probability kSocketTimeoutProbability = 1; | 682 const base::FieldTrial::Probability kSocketTimeoutProbability = 1; |
| 668 | 683 |
| 669 // After June 30, 2011 builds, it will always be in default group. | 684 // After June 30, 2011 builds, it will always be in default group. |
| 685 int socket_timeout_10 = -1; | |
| 670 scoped_refptr<base::FieldTrial> socket_timeout_trial( | 686 scoped_refptr<base::FieldTrial> socket_timeout_trial( |
| 671 new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor, | 687 base::FieldTrialList::GetFieldTrialInstance( |
| 672 "idle_timeout_10", 2011, 6, 30)); | 688 "IdleSktToImpact", kIdleSocketTimeoutDivisor, "idle_timeout_10", |
| 673 const int socket_timeout_10 = socket_timeout_trial->kDefaultGroupNumber; | 689 &socket_timeout_10, 2011, 6, 30)); |
| 674 | 690 |
| 675 const int socket_timeout_5 = | 691 const int socket_timeout_5 = |
| 676 socket_timeout_trial->AppendGroup("idle_timeout_5", | 692 socket_timeout_trial->AppendGroup("idle_timeout_5", |
| 677 kSocketTimeoutProbability); | 693 kSocketTimeoutProbability); |
| 678 const int socket_timeout_20 = | 694 const int socket_timeout_20 = |
| 679 socket_timeout_trial->AppendGroup("idle_timeout_20", | 695 socket_timeout_trial->AppendGroup("idle_timeout_20", |
| 680 kSocketTimeoutProbability); | 696 kSocketTimeoutProbability); |
| 681 | 697 |
| 682 const int idle_to_trial_group = socket_timeout_trial->group(); | 698 const int idle_to_trial_group = socket_timeout_trial->group(); |
| 683 | 699 |
| 684 if (idle_to_trial_group == socket_timeout_5) { | 700 if (idle_to_trial_group == socket_timeout_5) { |
| 685 net::ClientSocketPool::set_unused_idle_socket_timeout( | 701 net::ClientSocketPool::set_unused_idle_socket_timeout( |
| 686 base::TimeDelta::FromSeconds(5)); | 702 base::TimeDelta::FromSeconds(5)); |
| 687 } else if (idle_to_trial_group == socket_timeout_10) { | 703 } else if (idle_to_trial_group == socket_timeout_10) { |
| 688 net::ClientSocketPool::set_unused_idle_socket_timeout( | 704 net::ClientSocketPool::set_unused_idle_socket_timeout( |
| 689 base::TimeDelta::FromSeconds(10)); | 705 base::TimeDelta::FromSeconds(10)); |
| 690 } else if (idle_to_trial_group == socket_timeout_20) { | 706 } else if (idle_to_trial_group == socket_timeout_20) { |
| 691 net::ClientSocketPool::set_unused_idle_socket_timeout( | 707 net::ClientSocketPool::set_unused_idle_socket_timeout( |
| 692 base::TimeDelta::FromSeconds(20)); | 708 base::TimeDelta::FromSeconds(20)); |
| 693 } else { | 709 } else { |
| 694 NOTREACHED(); | 710 NOTREACHED(); |
| 695 } | 711 } |
| 696 } | 712 } |
| 697 | 713 |
| 698 void ChromeBrowserMainParts::ProxyConnectionsFieldTrial() { | 714 void ChromeBrowserMainParts::ProxyConnectionsFieldTrial() { |
| 699 const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; | 715 const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; |
| 700 // 25% probability | 716 // 25% probability |
| 701 const base::FieldTrial::Probability kProxyConnectionProbability = 1; | 717 const base::FieldTrial::Probability kProxyConnectionProbability = 1; |
| 702 | 718 |
| 703 // After June 30, 2011 builds, it will always be in default group. | |
| 704 scoped_refptr<base::FieldTrial> proxy_connection_trial( | |
| 705 new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor, | |
| 706 "proxy_connections_32", 2011, 6, 30)); | |
| 707 | |
| 708 // This (32 connections per proxy server) is the current default value. | 719 // This (32 connections per proxy server) is the current default value. |
| 709 // Declaring it here allows us to easily re-assign the probability space while | 720 // Declaring it here allows us to easily re-assign the probability space while |
| 710 // maintaining that the default group always has the remainder of the "share", | 721 // maintaining that the default group always has the remainder of the "share", |
| 711 // which allows for cleaner and quicker changes down the line if needed. | 722 // which allows for cleaner and quicker changes down the line if needed. |
| 712 const int proxy_connections_32 = proxy_connection_trial->kDefaultGroupNumber; | 723 int proxy_connections_32 = -1; |
| 724 | |
| 725 // After June 30, 2011 builds, it will always be in default group. | |
| 726 scoped_refptr<base::FieldTrial> proxy_connection_trial( | |
| 727 base::FieldTrialList::GetFieldTrialInstance( | |
| 728 "ProxyConnectionImpact", kProxyConnectionsDivisor, | |
| 729 "proxy_connections_32", &proxy_connections_32, 2011, 6, 30)); | |
| 713 | 730 |
| 714 // The number of max sockets per group cannot be greater than the max number | 731 // The number of max sockets per group cannot be greater than the max number |
| 715 // of sockets per proxy server. We tried using 8, and it can easily | 732 // of sockets per proxy server. We tried using 8, and it can easily |
| 716 // lead to total browser stalls. | 733 // lead to total browser stalls. |
| 717 const int proxy_connections_16 = | 734 const int proxy_connections_16 = |
| 718 proxy_connection_trial->AppendGroup("proxy_connections_16", | 735 proxy_connection_trial->AppendGroup("proxy_connections_16", |
| 719 kProxyConnectionProbability); | 736 kProxyConnectionProbability); |
| 720 const int proxy_connections_64 = | 737 const int proxy_connections_64 = |
| 721 proxy_connection_trial->AppendGroup("proxy_connections_64", | 738 proxy_connection_trial->AppendGroup("proxy_connections_64", |
| 722 kProxyConnectionProbability); | 739 kProxyConnectionProbability); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 760 } else if (parsed_command_line().HasSwitch(switches::kEnableNpnHttpOnly)) { | 777 } else if (parsed_command_line().HasSwitch(switches::kEnableNpnHttpOnly)) { |
| 761 net::HttpStreamFactory::EnableNpnHttpOnly(); | 778 net::HttpStreamFactory::EnableNpnHttpOnly(); |
| 762 } else { | 779 } else { |
| 763 #if !defined(OS_CHROMEOS) | 780 #if !defined(OS_CHROMEOS) |
| 764 bool is_spdy_trial = false; | 781 bool is_spdy_trial = false; |
| 765 const base::FieldTrial::Probability kSpdyDivisor = 100; | 782 const base::FieldTrial::Probability kSpdyDivisor = 100; |
| 766 base::FieldTrial::Probability npnhttp_probability = 5; | 783 base::FieldTrial::Probability npnhttp_probability = 5; |
| 767 base::FieldTrial::Probability flow_control_probability = 5; | 784 base::FieldTrial::Probability flow_control_probability = 5; |
| 768 base::FieldTrial::Probability spdy3_probability = 0; | 785 base::FieldTrial::Probability spdy3_probability = 0; |
| 769 | 786 |
| 787 // NPN with spdy support is the default. | |
| 788 int npn_spdy_grp = -1; | |
| 789 | |
| 770 // After June 30, 2013 builds, it will always be in default group. | 790 // After June 30, 2013 builds, it will always be in default group. |
| 771 scoped_refptr<base::FieldTrial> trial( | 791 scoped_refptr<base::FieldTrial> trial( |
| 772 new base::FieldTrial( | 792 base::FieldTrialList::GetFieldTrialInstance( |
| 773 "SpdyImpact", kSpdyDivisor, "npn_with_spdy", 2013, 6, 30)); | 793 "SpdyImpact", kSpdyDivisor, "npn_with_spdy", &npn_spdy_grp, |
| 774 | 794 2013, 6, 30)); |
| 775 // NPN with spdy support is the default. | |
| 776 int npn_spdy_grp = trial->kDefaultGroupNumber; | |
| 777 | 795 |
| 778 // NPN with only http support, no spdy. | 796 // NPN with only http support, no spdy. |
| 779 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); | 797 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); |
| 780 | 798 |
| 781 // NPN with http/1.1, spdy/2, spdy/2.1 and spdy/3 support. | 799 // NPN with http/1.1, spdy/2, spdy/2.1 and spdy/3 support. |
| 782 int spdy3_grp = trial->AppendGroup("spdy3", spdy3_probability); | 800 int spdy3_grp = trial->AppendGroup("spdy3", spdy3_probability); |
| 783 | 801 |
| 784 // NPN with http/1.1, spdy/2 and spdy/2.1 support. | 802 // NPN with http/1.1, spdy/2 and spdy/2.1 support. |
| 785 int flow_control_grp = trial->AppendGroup( | 803 int flow_control_grp = trial->AppendGroup( |
| 786 "flow_control", flow_control_probability); | 804 "flow_control", flow_control_probability); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 810 // Setup SPDY CWND Field trial. | 828 // Setup SPDY CWND Field trial. |
| 811 const base::FieldTrial::Probability kSpdyCwndDivisor = 100; | 829 const base::FieldTrial::Probability kSpdyCwndDivisor = 100; |
| 812 const base::FieldTrial::Probability kSpdyCwnd16 = 20; // fixed at 16 | 830 const base::FieldTrial::Probability kSpdyCwnd16 = 20; // fixed at 16 |
| 813 const base::FieldTrial::Probability kSpdyCwnd10 = 20; // fixed at 10 | 831 const base::FieldTrial::Probability kSpdyCwnd10 = 20; // fixed at 10 |
| 814 const base::FieldTrial::Probability kSpdyCwndMin16 = 20; // no less than 16 | 832 const base::FieldTrial::Probability kSpdyCwndMin16 = 20; // no less than 16 |
| 815 const base::FieldTrial::Probability kSpdyCwndMin10 = 20; // no less than 10 | 833 const base::FieldTrial::Probability kSpdyCwndMin10 = 20; // no less than 10 |
| 816 | 834 |
| 817 // After June 30, 2013 builds, it will always be in default group | 835 // After June 30, 2013 builds, it will always be in default group |
| 818 // (cwndDynamic). | 836 // (cwndDynamic). |
| 819 scoped_refptr<base::FieldTrial> trial( | 837 scoped_refptr<base::FieldTrial> trial( |
| 820 new base::FieldTrial( | 838 base::FieldTrialList::GetFieldTrialInstance( |
| 821 "SpdyCwnd", kSpdyCwndDivisor, "cwndDynamic", 2013, 6, 30)); | 839 "SpdyCwnd", kSpdyCwndDivisor, "cwndDynamic", NULL, 2013, 6, 30)); |
| 822 | 840 |
| 823 trial->AppendGroup("cwnd10", kSpdyCwnd10); | 841 trial->AppendGroup("cwnd10", kSpdyCwnd10); |
| 824 trial->AppendGroup("cwnd16", kSpdyCwnd16); | 842 trial->AppendGroup("cwnd16", kSpdyCwnd16); |
| 825 trial->AppendGroup("cwndMin16", kSpdyCwndMin16); | 843 trial->AppendGroup("cwndMin16", kSpdyCwndMin16); |
| 826 trial->AppendGroup("cwndMin10", kSpdyCwndMin10); | 844 trial->AppendGroup("cwndMin10", kSpdyCwndMin10); |
| 827 | 845 |
| 828 if (parsed_command_line().HasSwitch(switches::kMaxSpdyConcurrentStreams)) { | 846 if (parsed_command_line().HasSwitch(switches::kMaxSpdyConcurrentStreams)) { |
| 829 int value = 0; | 847 int value = 0; |
| 830 base::StringToInt(parsed_command_line().GetSwitchValueASCII( | 848 base::StringToInt(parsed_command_line().GetSwitchValueASCII( |
| 831 switches::kMaxSpdyConcurrentStreams), | 849 switches::kMaxSpdyConcurrentStreams), |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 847 | 865 |
| 848 const int policy_list[] = { 0, 1, 2 }; | 866 const int policy_list[] = { 0, 1, 2 }; |
| 849 VLOG(1) << "Setting socket_reuse_policy = " << policy; | 867 VLOG(1) << "Setting socket_reuse_policy = " << policy; |
| 850 SetSocketReusePolicy(policy, policy_list, arraysize(policy_list)); | 868 SetSocketReusePolicy(policy, policy_list, arraysize(policy_list)); |
| 851 return; | 869 return; |
| 852 } | 870 } |
| 853 | 871 |
| 854 const base::FieldTrial::Probability kWarmSocketDivisor = 100; | 872 const base::FieldTrial::Probability kWarmSocketDivisor = 100; |
| 855 const base::FieldTrial::Probability kWarmSocketProbability = 33; | 873 const base::FieldTrial::Probability kWarmSocketProbability = 33; |
| 856 | 874 |
| 875 // Default value is USE_LAST_ACCESSED_SOCKET. | |
| 876 int last_accessed_socket = -1; | |
| 877 | |
| 857 // After January 30, 2013 builds, it will always be in default group. | 878 // After January 30, 2013 builds, it will always be in default group. |
| 858 scoped_refptr<base::FieldTrial> warmest_socket_trial( | 879 scoped_refptr<base::FieldTrial> warmest_socket_trial( |
| 859 new base::FieldTrial( | 880 base::FieldTrialList::GetFieldTrialInstance( |
| 860 "WarmSocketImpact", kWarmSocketDivisor, "last_accessed_socket", | 881 "WarmSocketImpact", kWarmSocketDivisor, "last_accessed_socket", |
| 861 2013, 1, 30)); | 882 &last_accessed_socket, 2013, 1, 30)); |
| 862 | 883 |
| 863 // Default value is USE_LAST_ACCESSED_SOCKET. | |
| 864 const int last_accessed_socket = warmest_socket_trial->kDefaultGroupNumber; | |
| 865 const int warmest_socket = warmest_socket_trial->AppendGroup( | 884 const int warmest_socket = warmest_socket_trial->AppendGroup( |
| 866 "warmest_socket", kWarmSocketProbability); | 885 "warmest_socket", kWarmSocketProbability); |
| 867 const int warm_socket = warmest_socket_trial->AppendGroup( | 886 const int warm_socket = warmest_socket_trial->AppendGroup( |
| 868 "warm_socket", kWarmSocketProbability); | 887 "warm_socket", kWarmSocketProbability); |
| 869 | 888 |
| 870 const int warmest_socket_trial_group = warmest_socket_trial->group(); | 889 const int warmest_socket_trial_group = warmest_socket_trial->group(); |
| 871 | 890 |
| 872 const int policy_list[] = { warmest_socket, warm_socket, | 891 const int policy_list[] = { warmest_socket, warm_socket, |
| 873 last_accessed_socket }; | 892 last_accessed_socket }; |
| 874 SetSocketReusePolicy(warmest_socket_trial_group, policy_list, | 893 SetSocketReusePolicy(warmest_socket_trial_group, policy_list, |
| 875 arraysize(policy_list)); | 894 arraysize(policy_list)); |
| 876 } | 895 } |
| 877 | 896 |
| 878 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is | 897 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is |
| 879 // specified, run an A/B test for automatically establishing backup TCP | 898 // specified, run an A/B test for automatically establishing backup TCP |
| 880 // connections when a certain timeout value is exceeded. | 899 // connections when a certain timeout value is exceeded. |
| 881 void ChromeBrowserMainParts::ConnectBackupJobsFieldTrial() { | 900 void ChromeBrowserMainParts::ConnectBackupJobsFieldTrial() { |
| 882 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { | 901 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { |
| 883 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 902 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 884 true); | 903 true); |
| 885 } else if (parsed_command_line().HasSwitch( | 904 } else if (parsed_command_line().HasSwitch( |
| 886 switches::kDisableConnectBackupJobs)) { | 905 switches::kDisableConnectBackupJobs)) { |
| 887 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 906 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 888 false); | 907 false); |
| 889 } else { | 908 } else { |
| 890 const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; | 909 const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; |
| 891 // 1% probability. | 910 // 1% probability. |
| 892 const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; | 911 const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; |
| 893 // After June 30, 2011 builds, it will always be in default group. | 912 // After June 30, 2011 builds, it will always be in default group. |
| 913 int connect_backup_jobs_enabled = -1; | |
| 894 scoped_refptr<base::FieldTrial> trial( | 914 scoped_refptr<base::FieldTrial> trial( |
| 895 new base::FieldTrial("ConnnectBackupJobs", | 915 base::FieldTrialList::GetFieldTrialInstance("ConnnectBackupJobs", |
| 896 kConnectBackupJobsDivisor, "ConnectBackupJobsEnabled", 2011, 6, | 916 kConnectBackupJobsDivisor, "ConnectBackupJobsEnabled", |
| 897 30)); | 917 &connect_backup_jobs_enabled, 2011, 6, 30)); |
| 898 const int connect_backup_jobs_enabled = trial->kDefaultGroupNumber; | |
| 899 trial->AppendGroup("ConnectBackupJobsDisabled", | 918 trial->AppendGroup("ConnectBackupJobsDisabled", |
| 900 kConnectBackupJobsProbability); | 919 kConnectBackupJobsProbability); |
| 901 const int trial_group = trial->group(); | 920 const int trial_group = trial->group(); |
| 902 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 921 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
| 903 trial_group == connect_backup_jobs_enabled); | 922 trial_group == connect_backup_jobs_enabled); |
| 904 } | 923 } |
| 905 } | 924 } |
| 906 | 925 |
| 907 void ChromeBrowserMainParts::PredictorFieldTrial() { | 926 void ChromeBrowserMainParts::PredictorFieldTrial() { |
| 908 const base::FieldTrial::Probability kDivisor = 1000; | 927 const base::FieldTrial::Probability kDivisor = 1000; |
| 909 // For each option (i.e., non-default), we have a fixed probability. | 928 // For each option (i.e., non-default), we have a fixed probability. |
| 910 // 0.1% probability. | 929 // 0.1% probability. |
| 911 const base::FieldTrial::Probability kProbabilityPerGroup = 1; | 930 const base::FieldTrial::Probability kProbabilityPerGroup = 1; |
| 912 | 931 |
| 913 // After June 30, 2011 builds, it will always be in default group | 932 // After June 30, 2011 builds, it will always be in default group |
| 914 // (default_enabled_prefetch). | 933 // (default_enabled_prefetch). |
| 915 scoped_refptr<base::FieldTrial> trial( | 934 scoped_refptr<base::FieldTrial> trial( |
| 916 new base::FieldTrial("DnsImpact", kDivisor, | 935 base::FieldTrialList::GetFieldTrialInstance( |
| 917 "default_enabled_prefetch", 2011, 10, 30)); | 936 "DnsImpact", kDivisor, "default_enabled_prefetch", NULL, |
| 937 2011, 10, 30)); | |
| 918 | 938 |
| 919 // First option is to disable prefetching completely. | 939 // First option is to disable prefetching completely. |
| 920 int disabled_prefetch = trial->AppendGroup("disabled_prefetch", | 940 int disabled_prefetch = trial->AppendGroup("disabled_prefetch", |
| 921 kProbabilityPerGroup); | 941 kProbabilityPerGroup); |
| 922 | 942 |
| 923 // We're running two experiments at the same time. The first set of trials | 943 // We're running two experiments at the same time. The first set of trials |
| 924 // modulates the delay-time until we declare a congestion event (and purge | 944 // modulates the delay-time until we declare a congestion event (and purge |
| 925 // our queue). The second modulates the number of concurrent resolutions | 945 // our queue). The second modulates the number of concurrent resolutions |
| 926 // we do at any time. Users are in exactly one trial (or the default) during | 946 // we do at any time. Users are in exactly one trial (or the default) during |
| 927 // any one run, and hence only one experiment at a time. | 947 // any one run, and hence only one experiment at a time. |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1014 } | 1034 } |
| 1015 } | 1035 } |
| 1016 | 1036 |
| 1017 void ChromeBrowserMainParts::ComodoDNSExperimentFieldTrial() { | 1037 void ChromeBrowserMainParts::ComodoDNSExperimentFieldTrial() { |
| 1018 // 100% probability of being in the experiment group until the timeout. | 1038 // 100% probability of being in the experiment group until the timeout. |
| 1019 const base::FieldTrial::Probability kDivisor = 1; | 1039 const base::FieldTrial::Probability kDivisor = 1; |
| 1020 const base::FieldTrial::Probability kProbability = 1; | 1040 const base::FieldTrial::Probability kProbability = 1; |
| 1021 | 1041 |
| 1022 // After April 15, 2012 builds, it will always be in default group. | 1042 // After April 15, 2012 builds, it will always be in default group. |
| 1023 scoped_refptr<base::FieldTrial> trial( | 1043 scoped_refptr<base::FieldTrial> trial( |
| 1024 new base::FieldTrial("ComodoDNSExperiment", kDivisor, | 1044 base::FieldTrialList::GetFieldTrialInstance( |
| 1025 "inactive", 2012, 4, 15)); | 1045 "ComodoDNSExperiment", kDivisor, "inactive", NULL, 2012, 4, 15)); |
| 1026 | 1046 |
| 1027 const int active = trial->AppendGroup("active", kProbability); | 1047 const int active = trial->AppendGroup("active", kProbability); |
| 1028 | 1048 |
| 1029 if (trial->group() == active) | 1049 if (trial->group() == active) |
| 1030 ChromeNetworkDelegate::EnableComodoDNSExperiment(); | 1050 ChromeNetworkDelegate::EnableComodoDNSExperiment(); |
| 1031 } | 1051 } |
| 1032 | 1052 |
| 1033 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- | 1053 // ChromeBrowserMainParts: |SetupMetricsAndFieldTrials()| related -------------- |
| 1034 | 1054 |
| 1035 void ChromeBrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, | 1055 void ChromeBrowserMainParts::SetupFieldTrials(bool metrics_recording_enabled, |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 1065 return; | 1085 return; |
| 1066 } | 1086 } |
| 1067 | 1087 |
| 1068 if (IsMetricsReportingEnabled()) | 1088 if (IsMetricsReportingEnabled()) |
| 1069 metrics->Start(); | 1089 metrics->Start(); |
| 1070 } | 1090 } |
| 1071 | 1091 |
| 1072 bool ChromeBrowserMainParts::IsMetricsReportingEnabled() { | 1092 bool ChromeBrowserMainParts::IsMetricsReportingEnabled() { |
| 1073 // If the user permits metrics reporting with the checkbox in the | 1093 // If the user permits metrics reporting with the checkbox in the |
| 1074 // prefs, we turn on recording. We disable metrics completely for | 1094 // prefs, we turn on recording. We disable metrics completely for |
| 1075 // non-official builds. | 1095 // non-official builds. |
|
jar (doing other things)
2012/04/06 01:41:29
This is probably a better place to control (disabl
MAD
2012/04/11 02:38:08
Done.
| |
| 1076 bool enabled = false; | 1096 bool enabled = false; |
| 1077 #if defined(GOOGLE_CHROME_BUILD) | 1097 #if defined(GOOGLE_CHROME_BUILD) |
| 1078 #if defined(OS_CHROMEOS) | 1098 #if defined(OS_CHROMEOS) |
| 1079 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 1099 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
| 1080 &enabled); | 1100 &enabled); |
| 1081 #else | 1101 #else |
| 1082 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled); | 1102 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled); |
| 1083 #endif // #if defined(OS_CHROMEOS) | 1103 #endif // #if defined(OS_CHROMEOS) |
| 1084 #endif // defined(GOOGLE_CHROME_BUILD) | 1104 #endif // defined(GOOGLE_CHROME_BUILD) |
| 1085 return enabled; | 1105 return enabled; |
| (...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1661 if (!sdch_enabled) | 1681 if (!sdch_enabled) |
| 1662 net::SdchManager::EnableSdchSupport(false); | 1682 net::SdchManager::EnableSdchSupport(false); |
| 1663 } | 1683 } |
| 1664 if (sdch_enabled) { | 1684 if (sdch_enabled) { |
| 1665 // Perform A/B test to measure global impact of SDCH support. | 1685 // Perform A/B test to measure global impact of SDCH support. |
| 1666 // Set up a field trial to see what disabling SDCH does to latency of page | 1686 // Set up a field trial to see what disabling SDCH does to latency of page |
| 1667 // layout globally. | 1687 // layout globally. |
| 1668 base::FieldTrial::Probability kSDCH_DIVISOR = 1000; | 1688 base::FieldTrial::Probability kSDCH_DIVISOR = 1000; |
| 1669 base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. | 1689 base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. |
| 1670 // After March 31, 2012 builds, it will always be in default group. | 1690 // After March 31, 2012 builds, it will always be in default group. |
| 1691 int sdch_enabled_group = -1; | |
| 1671 scoped_refptr<base::FieldTrial> sdch_trial( | 1692 scoped_refptr<base::FieldTrial> sdch_trial( |
| 1672 new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR, "global_enable_sdch", | 1693 base::FieldTrialList::GetFieldTrialInstance( |
| 1673 2012, 3, 31)); | 1694 "GlobalSdch", kSDCH_DIVISOR, "global_enable_sdch", |
| 1674 int sdch_enabled_group = sdch_trial->kDefaultGroupNumber; | 1695 &sdch_enabled_group, 2012, 3, 31)); |
| 1675 | 1696 |
| 1676 sdch_trial->AppendGroup("global_disable_sdch", | 1697 sdch_trial->AppendGroup("global_disable_sdch", |
| 1677 kSDCH_DISABLE_PROBABILITY); | 1698 kSDCH_DISABLE_PROBABILITY); |
| 1678 if (sdch_enabled_group != sdch_trial->group()) | 1699 if (sdch_enabled_group != sdch_trial->group()) |
| 1679 net::SdchManager::EnableSdchSupport(false); | 1700 net::SdchManager::EnableSdchSupport(false); |
| 1680 } | 1701 } |
| 1681 | 1702 |
| 1682 if (parsed_command_line().HasSwitch(switches::kEnableWatchdog)) | 1703 if (parsed_command_line().HasSwitch(switches::kEnableWatchdog)) |
| 1683 InstallJankometer(parsed_command_line()); | 1704 InstallJankometer(parsed_command_line()); |
| 1684 | 1705 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1957 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1978 if (base::win::GetVersion() <= base::win::VERSION_XP) |
| 1958 uma_name += "_XP"; | 1979 uma_name += "_XP"; |
| 1959 | 1980 |
| 1960 uma_name += "_PreRead_"; | 1981 uma_name += "_PreRead_"; |
| 1961 uma_name += pre_read_percentage; | 1982 uma_name += pre_read_percentage; |
| 1962 AddPreReadHistogramTime(uma_name.c_str(), time); | 1983 AddPreReadHistogramTime(uma_name.c_str(), time); |
| 1963 } | 1984 } |
| 1964 #endif | 1985 #endif |
| 1965 #endif | 1986 #endif |
| 1966 } | 1987 } |
| OLD | NEW |