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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 #endif // defined(OS_WIN) | 578 #endif // defined(OS_WIN) |
579 | 579 |
580 // Initialize FieldTrialList to support FieldTrials that use one-time | 580 // Initialize FieldTrialList to support FieldTrials that use one-time |
581 // randomization. The client ID will be empty if the user has not opted | 581 // randomization. The client ID will be empty if the user has not opted |
582 // to send metrics. | 582 // to send metrics. |
583 MetricsService* metrics = browser_process_->metrics_service(); | 583 MetricsService* metrics = browser_process_->metrics_service(); |
584 if (IsMetricsReportingEnabled()) | 584 if (IsMetricsReportingEnabled()) |
585 metrics->ForceClientIdCreation(); // Needed below. | 585 metrics->ForceClientIdCreation(); // Needed below. |
586 field_trial_list_.reset(new base::FieldTrialList(metrics->GetClientId())); | 586 field_trial_list_.reset(new base::FieldTrialList(metrics->GetClientId())); |
587 | 587 |
| 588 // Ensure any field trials specified on the command line are initialized. |
| 589 // Also stop the metrics service so that we don't pollute UMA. |
| 590 #ifndef NDEBUG |
| 591 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 592 if (command_line->HasSwitch(switches::kForceFieldTrials)) { |
| 593 std::string persistent = command_line->GetSwitchValueASCII( |
| 594 switches::kForceFieldTrials); |
| 595 bool ret = base::FieldTrialList::CreateTrialsFromString(persistent); |
| 596 CHECK(ret) << "Invalid --" << switches::kForceFieldTrials << |
| 597 " list specified."; |
| 598 } |
| 599 #endif // NDEBUG |
| 600 |
588 SetupFieldTrials(metrics->recording_active(), | 601 SetupFieldTrials(metrics->recording_active(), |
589 local_state_->IsManagedPreference( | 602 local_state_->IsManagedPreference( |
590 prefs::kMaxConnectionsPerProxy)); | 603 prefs::kMaxConnectionsPerProxy)); |
591 | 604 |
592 // Initialize FieldTrialSynchronizer system. This is a singleton and is used | 605 // Initialize FieldTrialSynchronizer system. This is a singleton and is used |
593 // for posting tasks via base::Bind. Its deleted when it goes out of scope. | 606 // for posting tasks via base::Bind. Its deleted when it goes out of scope. |
594 // Even though base::Bind does AddRef and Release, the object will not be | 607 // Even though base::Bind does AddRef and Release, the object will not be |
595 // deleted after the Task is executed. | 608 // deleted after the Task is executed. |
596 field_trial_synchronizer_ = new FieldTrialSynchronizer(); | 609 field_trial_synchronizer_ = new FieldTrialSynchronizer(); |
597 } | 610 } |
598 | 611 |
599 // This is an A/B test for the maximum number of persistent connections per | 612 // This is an A/B test for the maximum number of persistent connections per |
600 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari | 613 // host. Currently Chrome, Firefox, and IE8 have this value set at 6. Safari |
601 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to | 614 // uses 4, and Fasterfox (a plugin for Firefox that supposedly configures it to |
602 // run faster) uses 8. We would like to see how much of an effect this value has | 615 // run faster) uses 8. We would like to see how much of an effect this value has |
603 // on browsing. Too large a value might cause us to run into SYN flood detection | 616 // on browsing. Too large a value might cause us to run into SYN flood detection |
604 // mechanisms. | 617 // mechanisms. |
605 void ChromeBrowserMainParts::ConnectionFieldTrial() { | 618 void ChromeBrowserMainParts::ConnectionFieldTrial() { |
606 const base::FieldTrial::Probability kConnectDivisor = 100; | 619 const base::FieldTrial::Probability kConnectDivisor = 100; |
607 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. | 620 const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. |
608 | 621 |
609 // After June 30, 2011 builds, it will always be in default group. | |
610 scoped_refptr<base::FieldTrial> connect_trial( | |
611 new base::FieldTrial( | |
612 "ConnCountImpact", kConnectDivisor, "conn_count_6", 2011, 6, 30)); | |
613 | |
614 // This (6) is the current default value. Having this group declared here | 622 // This (6) is the current default value. Having this group declared here |
615 // makes it straightforward to modify |kConnectProbability| such that the same | 623 // makes it straightforward to modify |kConnectProbability| such that the same |
616 // probability value will be assigned to all the other groups, while | 624 // probability value will be assigned to all the other groups, while |
617 // preserving the remainder of the of probability space to the default value. | 625 // preserving the remainder of the of probability space to the default value. |
618 const int connect_6 = connect_trial->kDefaultGroupNumber; | 626 int connect_6 = -1; |
| 627 |
| 628 // After June 30, 2011 builds, it will always be in default group. |
| 629 scoped_refptr<base::FieldTrial> connect_trial( |
| 630 base::FieldTrialList::FactoryGetFieldTrial( |
| 631 "ConnCountImpact", kConnectDivisor, "conn_count_6", 2011, 6, 30, |
| 632 &connect_6)); |
619 | 633 |
620 const int connect_5 = connect_trial->AppendGroup("conn_count_5", | 634 const int connect_5 = connect_trial->AppendGroup("conn_count_5", |
621 kConnectProbability); | 635 kConnectProbability); |
622 const int connect_7 = connect_trial->AppendGroup("conn_count_7", | 636 const int connect_7 = connect_trial->AppendGroup("conn_count_7", |
623 kConnectProbability); | 637 kConnectProbability); |
624 const int connect_8 = connect_trial->AppendGroup("conn_count_8", | 638 const int connect_8 = connect_trial->AppendGroup("conn_count_8", |
625 kConnectProbability); | 639 kConnectProbability); |
626 const int connect_9 = connect_trial->AppendGroup("conn_count_9", | 640 const int connect_9 = connect_trial->AppendGroup("conn_count_9", |
627 kConnectProbability); | 641 kConnectProbability); |
628 | 642 |
(...skipping 24 matching lines...) Expand all Loading... |
653 // before we time it out. Since these are "unused" sockets, we won't retry the | 667 // before we time it out. Since these are "unused" sockets, we won't retry the |
654 // connection and instead show an error to the user. So we need to be | 668 // connection and instead show an error to the user. So we need to be |
655 // conservative here. We've seen that some servers will close the socket after | 669 // conservative here. We've seen that some servers will close the socket after |
656 // as short as 10 seconds. See http://crbug.com/84313 for more details. | 670 // as short as 10 seconds. See http://crbug.com/84313 for more details. |
657 void ChromeBrowserMainParts::SocketTimeoutFieldTrial() { | 671 void ChromeBrowserMainParts::SocketTimeoutFieldTrial() { |
658 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; | 672 const base::FieldTrial::Probability kIdleSocketTimeoutDivisor = 100; |
659 // 1% probability for all experimental settings. | 673 // 1% probability for all experimental settings. |
660 const base::FieldTrial::Probability kSocketTimeoutProbability = 1; | 674 const base::FieldTrial::Probability kSocketTimeoutProbability = 1; |
661 | 675 |
662 // After June 30, 2011 builds, it will always be in default group. | 676 // After June 30, 2011 builds, it will always be in default group. |
| 677 int socket_timeout_10 = -1; |
663 scoped_refptr<base::FieldTrial> socket_timeout_trial( | 678 scoped_refptr<base::FieldTrial> socket_timeout_trial( |
664 new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor, | 679 base::FieldTrialList::FactoryGetFieldTrial( |
665 "idle_timeout_10", 2011, 6, 30)); | 680 "IdleSktToImpact", kIdleSocketTimeoutDivisor, "idle_timeout_10", |
666 const int socket_timeout_10 = socket_timeout_trial->kDefaultGroupNumber; | 681 2011, 6, 30, &socket_timeout_10)); |
667 | 682 |
668 const int socket_timeout_5 = | 683 const int socket_timeout_5 = |
669 socket_timeout_trial->AppendGroup("idle_timeout_5", | 684 socket_timeout_trial->AppendGroup("idle_timeout_5", |
670 kSocketTimeoutProbability); | 685 kSocketTimeoutProbability); |
671 const int socket_timeout_20 = | 686 const int socket_timeout_20 = |
672 socket_timeout_trial->AppendGroup("idle_timeout_20", | 687 socket_timeout_trial->AppendGroup("idle_timeout_20", |
673 kSocketTimeoutProbability); | 688 kSocketTimeoutProbability); |
674 | 689 |
675 const int idle_to_trial_group = socket_timeout_trial->group(); | 690 const int idle_to_trial_group = socket_timeout_trial->group(); |
676 | 691 |
677 if (idle_to_trial_group == socket_timeout_5) { | 692 if (idle_to_trial_group == socket_timeout_5) { |
678 net::ClientSocketPool::set_unused_idle_socket_timeout( | 693 net::ClientSocketPool::set_unused_idle_socket_timeout( |
679 base::TimeDelta::FromSeconds(5)); | 694 base::TimeDelta::FromSeconds(5)); |
680 } else if (idle_to_trial_group == socket_timeout_10) { | 695 } else if (idle_to_trial_group == socket_timeout_10) { |
681 net::ClientSocketPool::set_unused_idle_socket_timeout( | 696 net::ClientSocketPool::set_unused_idle_socket_timeout( |
682 base::TimeDelta::FromSeconds(10)); | 697 base::TimeDelta::FromSeconds(10)); |
683 } else if (idle_to_trial_group == socket_timeout_20) { | 698 } else if (idle_to_trial_group == socket_timeout_20) { |
684 net::ClientSocketPool::set_unused_idle_socket_timeout( | 699 net::ClientSocketPool::set_unused_idle_socket_timeout( |
685 base::TimeDelta::FromSeconds(20)); | 700 base::TimeDelta::FromSeconds(20)); |
686 } else { | 701 } else { |
687 NOTREACHED(); | 702 NOTREACHED(); |
688 } | 703 } |
689 } | 704 } |
690 | 705 |
691 void ChromeBrowserMainParts::ProxyConnectionsFieldTrial() { | 706 void ChromeBrowserMainParts::ProxyConnectionsFieldTrial() { |
692 const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; | 707 const base::FieldTrial::Probability kProxyConnectionsDivisor = 100; |
693 // 25% probability | 708 // 25% probability |
694 const base::FieldTrial::Probability kProxyConnectionProbability = 1; | 709 const base::FieldTrial::Probability kProxyConnectionProbability = 1; |
695 | 710 |
696 // After June 30, 2011 builds, it will always be in default group. | |
697 scoped_refptr<base::FieldTrial> proxy_connection_trial( | |
698 new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor, | |
699 "proxy_connections_32", 2011, 6, 30)); | |
700 | |
701 // This (32 connections per proxy server) is the current default value. | 711 // This (32 connections per proxy server) is the current default value. |
702 // Declaring it here allows us to easily re-assign the probability space while | 712 // Declaring it here allows us to easily re-assign the probability space while |
703 // maintaining that the default group always has the remainder of the "share", | 713 // maintaining that the default group always has the remainder of the "share", |
704 // which allows for cleaner and quicker changes down the line if needed. | 714 // which allows for cleaner and quicker changes down the line if needed. |
705 const int proxy_connections_32 = proxy_connection_trial->kDefaultGroupNumber; | 715 int proxy_connections_32 = -1; |
| 716 |
| 717 // After June 30, 2011 builds, it will always be in default group. |
| 718 scoped_refptr<base::FieldTrial> proxy_connection_trial( |
| 719 base::FieldTrialList::FactoryGetFieldTrial( |
| 720 "ProxyConnectionImpact", kProxyConnectionsDivisor, |
| 721 "proxy_connections_32", 2011, 6, 30, &proxy_connections_32)); |
706 | 722 |
707 // The number of max sockets per group cannot be greater than the max number | 723 // The number of max sockets per group cannot be greater than the max number |
708 // of sockets per proxy server. We tried using 8, and it can easily | 724 // of sockets per proxy server. We tried using 8, and it can easily |
709 // lead to total browser stalls. | 725 // lead to total browser stalls. |
710 const int proxy_connections_16 = | 726 const int proxy_connections_16 = |
711 proxy_connection_trial->AppendGroup("proxy_connections_16", | 727 proxy_connection_trial->AppendGroup("proxy_connections_16", |
712 kProxyConnectionProbability); | 728 kProxyConnectionProbability); |
713 const int proxy_connections_64 = | 729 const int proxy_connections_64 = |
714 proxy_connection_trial->AppendGroup("proxy_connections_64", | 730 proxy_connection_trial->AppendGroup("proxy_connections_64", |
715 kProxyConnectionProbability); | 731 kProxyConnectionProbability); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
748 } else if (parsed_command_line().HasSwitch(switches::kEnableNpn)) { | 764 } else if (parsed_command_line().HasSwitch(switches::kEnableNpn)) { |
749 net::HttpStreamFactory::EnableNpnSpdy(); | 765 net::HttpStreamFactory::EnableNpnSpdy(); |
750 } else if (parsed_command_line().HasSwitch(switches::kEnableNpnHttpOnly)) { | 766 } else if (parsed_command_line().HasSwitch(switches::kEnableNpnHttpOnly)) { |
751 net::HttpStreamFactory::EnableNpnHttpOnly(); | 767 net::HttpStreamFactory::EnableNpnHttpOnly(); |
752 } else { | 768 } else { |
753 #if !defined(OS_CHROMEOS) | 769 #if !defined(OS_CHROMEOS) |
754 const base::FieldTrial::Probability kSpdyDivisor = 100; | 770 const base::FieldTrial::Probability kSpdyDivisor = 100; |
755 base::FieldTrial::Probability npnhttp_probability = 5; | 771 base::FieldTrial::Probability npnhttp_probability = 5; |
756 base::FieldTrial::Probability spdy3_probability = 0; | 772 base::FieldTrial::Probability spdy3_probability = 0; |
757 | 773 |
| 774 // NPN with spdy support is the default. |
| 775 int npn_spdy_grp = -1; |
| 776 |
758 // After June 30, 2013 builds, it will always be in default group. | 777 // After June 30, 2013 builds, it will always be in default group. |
759 scoped_refptr<base::FieldTrial> trial( | 778 scoped_refptr<base::FieldTrial> trial( |
760 new base::FieldTrial( | 779 base::FieldTrialList::FactoryGetFieldTrial( |
761 "SpdyImpact", kSpdyDivisor, "npn_with_spdy", 2013, 6, 30)); | 780 "SpdyImpact", kSpdyDivisor, "npn_with_spdy", 2013, 6, 30, |
762 | 781 &npn_spdy_grp)); |
763 // NPN with spdy support is the default. | |
764 int npn_spdy_grp = trial->kDefaultGroupNumber; | |
765 | 782 |
766 // NPN with only http support, no spdy. | 783 // NPN with only http support, no spdy. |
767 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); | 784 int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); |
768 | 785 |
769 // NPN with http/1.1, spdy/2, and spdy/3 support. | 786 // NPN with http/1.1, spdy/2, and spdy/3 support. |
770 int spdy3_grp = trial->AppendGroup("spdy3", spdy3_probability); | 787 int spdy3_grp = trial->AppendGroup("spdy3", spdy3_probability); |
771 | 788 |
772 int trial_grp = trial->group(); | 789 int trial_grp = trial->group(); |
773 if (trial_grp == npn_spdy_grp) { | 790 if (trial_grp == npn_spdy_grp) { |
774 net::HttpStreamFactory::EnableNpnSpdy(); | 791 net::HttpStreamFactory::EnableNpnSpdy(); |
(...skipping 13 matching lines...) Expand all Loading... |
788 // Setup SPDY CWND Field trial. | 805 // Setup SPDY CWND Field trial. |
789 const base::FieldTrial::Probability kSpdyCwndDivisor = 100; | 806 const base::FieldTrial::Probability kSpdyCwndDivisor = 100; |
790 const base::FieldTrial::Probability kSpdyCwnd16 = 20; // fixed at 16 | 807 const base::FieldTrial::Probability kSpdyCwnd16 = 20; // fixed at 16 |
791 const base::FieldTrial::Probability kSpdyCwnd10 = 20; // fixed at 10 | 808 const base::FieldTrial::Probability kSpdyCwnd10 = 20; // fixed at 10 |
792 const base::FieldTrial::Probability kSpdyCwndMin16 = 20; // no less than 16 | 809 const base::FieldTrial::Probability kSpdyCwndMin16 = 20; // no less than 16 |
793 const base::FieldTrial::Probability kSpdyCwndMin10 = 20; // no less than 10 | 810 const base::FieldTrial::Probability kSpdyCwndMin10 = 20; // no less than 10 |
794 | 811 |
795 // After June 30, 2013 builds, it will always be in default group | 812 // After June 30, 2013 builds, it will always be in default group |
796 // (cwndDynamic). | 813 // (cwndDynamic). |
797 scoped_refptr<base::FieldTrial> trial( | 814 scoped_refptr<base::FieldTrial> trial( |
798 new base::FieldTrial( | 815 base::FieldTrialList::FactoryGetFieldTrial( |
799 "SpdyCwnd", kSpdyCwndDivisor, "cwndDynamic", 2013, 6, 30)); | 816 "SpdyCwnd", kSpdyCwndDivisor, "cwndDynamic", 2013, 6, 30, NULL)); |
800 | 817 |
801 trial->AppendGroup("cwnd10", kSpdyCwnd10); | 818 trial->AppendGroup("cwnd10", kSpdyCwnd10); |
802 trial->AppendGroup("cwnd16", kSpdyCwnd16); | 819 trial->AppendGroup("cwnd16", kSpdyCwnd16); |
803 trial->AppendGroup("cwndMin16", kSpdyCwndMin16); | 820 trial->AppendGroup("cwndMin16", kSpdyCwndMin16); |
804 trial->AppendGroup("cwndMin10", kSpdyCwndMin10); | 821 trial->AppendGroup("cwndMin10", kSpdyCwndMin10); |
805 | 822 |
806 if (parsed_command_line().HasSwitch(switches::kMaxSpdyConcurrentStreams)) { | 823 if (parsed_command_line().HasSwitch(switches::kMaxSpdyConcurrentStreams)) { |
807 int value = 0; | 824 int value = 0; |
808 base::StringToInt(parsed_command_line().GetSwitchValueASCII( | 825 base::StringToInt(parsed_command_line().GetSwitchValueASCII( |
809 switches::kMaxSpdyConcurrentStreams), | 826 switches::kMaxSpdyConcurrentStreams), |
(...skipping 15 matching lines...) Expand all Loading... |
825 | 842 |
826 const int policy_list[] = { 0, 1, 2 }; | 843 const int policy_list[] = { 0, 1, 2 }; |
827 VLOG(1) << "Setting socket_reuse_policy = " << policy; | 844 VLOG(1) << "Setting socket_reuse_policy = " << policy; |
828 SetSocketReusePolicy(policy, policy_list, arraysize(policy_list)); | 845 SetSocketReusePolicy(policy, policy_list, arraysize(policy_list)); |
829 return; | 846 return; |
830 } | 847 } |
831 | 848 |
832 const base::FieldTrial::Probability kWarmSocketDivisor = 100; | 849 const base::FieldTrial::Probability kWarmSocketDivisor = 100; |
833 const base::FieldTrial::Probability kWarmSocketProbability = 33; | 850 const base::FieldTrial::Probability kWarmSocketProbability = 33; |
834 | 851 |
| 852 // Default value is USE_LAST_ACCESSED_SOCKET. |
| 853 int last_accessed_socket = -1; |
| 854 |
835 // After January 30, 2013 builds, it will always be in default group. | 855 // After January 30, 2013 builds, it will always be in default group. |
836 scoped_refptr<base::FieldTrial> warmest_socket_trial( | 856 scoped_refptr<base::FieldTrial> warmest_socket_trial( |
837 new base::FieldTrial( | 857 base::FieldTrialList::FactoryGetFieldTrial( |
838 "WarmSocketImpact", kWarmSocketDivisor, "last_accessed_socket", | 858 "WarmSocketImpact", kWarmSocketDivisor, "last_accessed_socket", |
839 2013, 1, 30)); | 859 2013, 1, 30, &last_accessed_socket)); |
840 | 860 |
841 // Default value is USE_LAST_ACCESSED_SOCKET. | |
842 const int last_accessed_socket = warmest_socket_trial->kDefaultGroupNumber; | |
843 const int warmest_socket = warmest_socket_trial->AppendGroup( | 861 const int warmest_socket = warmest_socket_trial->AppendGroup( |
844 "warmest_socket", kWarmSocketProbability); | 862 "warmest_socket", kWarmSocketProbability); |
845 const int warm_socket = warmest_socket_trial->AppendGroup( | 863 const int warm_socket = warmest_socket_trial->AppendGroup( |
846 "warm_socket", kWarmSocketProbability); | 864 "warm_socket", kWarmSocketProbability); |
847 | 865 |
848 const int warmest_socket_trial_group = warmest_socket_trial->group(); | 866 const int warmest_socket_trial_group = warmest_socket_trial->group(); |
849 | 867 |
850 const int policy_list[] = { warmest_socket, warm_socket, | 868 const int policy_list[] = { warmest_socket, warm_socket, |
851 last_accessed_socket }; | 869 last_accessed_socket }; |
852 SetSocketReusePolicy(warmest_socket_trial_group, policy_list, | 870 SetSocketReusePolicy(warmest_socket_trial_group, policy_list, |
853 arraysize(policy_list)); | 871 arraysize(policy_list)); |
854 } | 872 } |
855 | 873 |
856 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is | 874 // If neither --enable-connect-backup-jobs or --disable-connect-backup-jobs is |
857 // specified, run an A/B test for automatically establishing backup TCP | 875 // specified, run an A/B test for automatically establishing backup TCP |
858 // connections when a certain timeout value is exceeded. | 876 // connections when a certain timeout value is exceeded. |
859 void ChromeBrowserMainParts::ConnectBackupJobsFieldTrial() { | 877 void ChromeBrowserMainParts::ConnectBackupJobsFieldTrial() { |
860 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { | 878 if (parsed_command_line().HasSwitch(switches::kEnableConnectBackupJobs)) { |
861 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 879 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
862 true); | 880 true); |
863 } else if (parsed_command_line().HasSwitch( | 881 } else if (parsed_command_line().HasSwitch( |
864 switches::kDisableConnectBackupJobs)) { | 882 switches::kDisableConnectBackupJobs)) { |
865 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 883 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
866 false); | 884 false); |
867 } else { | 885 } else { |
868 const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; | 886 const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; |
869 // 1% probability. | 887 // 1% probability. |
870 const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; | 888 const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; |
871 // After June 30, 2011 builds, it will always be in default group. | 889 // After June 30, 2011 builds, it will always be in default group. |
| 890 int connect_backup_jobs_enabled = -1; |
872 scoped_refptr<base::FieldTrial> trial( | 891 scoped_refptr<base::FieldTrial> trial( |
873 new base::FieldTrial("ConnnectBackupJobs", | 892 base::FieldTrialList::FactoryGetFieldTrial("ConnnectBackupJobs", |
874 kConnectBackupJobsDivisor, "ConnectBackupJobsEnabled", 2011, 6, | 893 kConnectBackupJobsDivisor, "ConnectBackupJobsEnabled", |
875 30)); | 894 2011, 6, 30, &connect_backup_jobs_enabled)); |
876 const int connect_backup_jobs_enabled = trial->kDefaultGroupNumber; | |
877 trial->AppendGroup("ConnectBackupJobsDisabled", | 895 trial->AppendGroup("ConnectBackupJobsDisabled", |
878 kConnectBackupJobsProbability); | 896 kConnectBackupJobsProbability); |
879 const int trial_group = trial->group(); | 897 const int trial_group = trial->group(); |
880 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( | 898 net::internal::ClientSocketPoolBaseHelper::set_connect_backup_jobs_enabled( |
881 trial_group == connect_backup_jobs_enabled); | 899 trial_group == connect_backup_jobs_enabled); |
882 } | 900 } |
883 } | 901 } |
884 | 902 |
885 void ChromeBrowserMainParts::PredictorFieldTrial() { | 903 void ChromeBrowserMainParts::PredictorFieldTrial() { |
886 const base::FieldTrial::Probability kDivisor = 1000; | 904 const base::FieldTrial::Probability kDivisor = 1000; |
887 // For each option (i.e., non-default), we have a fixed probability. | 905 // For each option (i.e., non-default), we have a fixed probability. |
888 // 0.1% probability. | 906 // 0.1% probability. |
889 const base::FieldTrial::Probability kProbabilityPerGroup = 1; | 907 const base::FieldTrial::Probability kProbabilityPerGroup = 1; |
890 | 908 |
891 // After June 30, 2011 builds, it will always be in default group | 909 // After June 30, 2011 builds, it will always be in default group |
892 // (default_enabled_prefetch). | 910 // (default_enabled_prefetch). |
893 scoped_refptr<base::FieldTrial> trial( | 911 scoped_refptr<base::FieldTrial> trial( |
894 new base::FieldTrial("DnsImpact", kDivisor, | 912 base::FieldTrialList::FactoryGetFieldTrial( |
895 "default_enabled_prefetch", 2011, 10, 30)); | 913 "DnsImpact", kDivisor, "default_enabled_prefetch", 2011, 10, 30, |
| 914 NULL)); |
896 | 915 |
897 // First option is to disable prefetching completely. | 916 // First option is to disable prefetching completely. |
898 int disabled_prefetch = trial->AppendGroup("disabled_prefetch", | 917 int disabled_prefetch = trial->AppendGroup("disabled_prefetch", |
899 kProbabilityPerGroup); | 918 kProbabilityPerGroup); |
900 | 919 |
901 // We're running two experiments at the same time. The first set of trials | 920 // We're running two experiments at the same time. The first set of trials |
902 // modulates the delay-time until we declare a congestion event (and purge | 921 // modulates the delay-time until we declare a congestion event (and purge |
903 // our queue). The second modulates the number of concurrent resolutions | 922 // our queue). The second modulates the number of concurrent resolutions |
904 // we do at any time. Users are in exactly one trial (or the default) during | 923 // we do at any time. Users are in exactly one trial (or the default) during |
905 // any one run, and hence only one experiment at a time. | 924 // any one run, and hence only one experiment at a time. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 | 1047 |
1029 if (IsMetricsReportingEnabled()) | 1048 if (IsMetricsReportingEnabled()) |
1030 metrics->Start(); | 1049 metrics->Start(); |
1031 } | 1050 } |
1032 | 1051 |
1033 bool ChromeBrowserMainParts::IsMetricsReportingEnabled() { | 1052 bool ChromeBrowserMainParts::IsMetricsReportingEnabled() { |
1034 // If the user permits metrics reporting with the checkbox in the | 1053 // If the user permits metrics reporting with the checkbox in the |
1035 // prefs, we turn on recording. We disable metrics completely for | 1054 // prefs, we turn on recording. We disable metrics completely for |
1036 // non-official builds. | 1055 // non-official builds. |
1037 bool enabled = false; | 1056 bool enabled = false; |
| 1057 #ifndef NDEBUG |
| 1058 // The debug build doesn't sent UMA logs when FieldTrials are forced. |
| 1059 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1060 if (command_line->HasSwitch(switches::kForceFieldTrials)) |
| 1061 return false; |
| 1062 #endif // #ifndef NDEBUG |
| 1063 |
1038 #if defined(GOOGLE_CHROME_BUILD) | 1064 #if defined(GOOGLE_CHROME_BUILD) |
1039 #if defined(OS_CHROMEOS) | 1065 #if defined(OS_CHROMEOS) |
1040 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, | 1066 chromeos::CrosSettings::Get()->GetBoolean(chromeos::kStatsReportingPref, |
1041 &enabled); | 1067 &enabled); |
1042 #else | 1068 #else |
1043 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled); | 1069 enabled = local_state_->GetBoolean(prefs::kMetricsReportingEnabled); |
1044 #endif // #if defined(OS_CHROMEOS) | 1070 #endif // #if defined(OS_CHROMEOS) |
1045 #endif // defined(GOOGLE_CHROME_BUILD) | 1071 #endif // defined(GOOGLE_CHROME_BUILD) |
1046 return enabled; | 1072 return enabled; |
1047 } | 1073 } |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 if (!sdch_enabled) | 1624 if (!sdch_enabled) |
1599 net::SdchManager::EnableSdchSupport(false); | 1625 net::SdchManager::EnableSdchSupport(false); |
1600 } | 1626 } |
1601 if (sdch_enabled) { | 1627 if (sdch_enabled) { |
1602 // Perform A/B test to measure global impact of SDCH support. | 1628 // Perform A/B test to measure global impact of SDCH support. |
1603 // Set up a field trial to see what disabling SDCH does to latency of page | 1629 // Set up a field trial to see what disabling SDCH does to latency of page |
1604 // layout globally. | 1630 // layout globally. |
1605 base::FieldTrial::Probability kSDCH_DIVISOR = 1000; | 1631 base::FieldTrial::Probability kSDCH_DIVISOR = 1000; |
1606 base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. | 1632 base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. |
1607 // After March 31, 2012 builds, it will always be in default group. | 1633 // After March 31, 2012 builds, it will always be in default group. |
| 1634 int sdch_enabled_group = -1; |
1608 scoped_refptr<base::FieldTrial> sdch_trial( | 1635 scoped_refptr<base::FieldTrial> sdch_trial( |
1609 new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR, "global_enable_sdch", | 1636 base::FieldTrialList::FactoryGetFieldTrial( |
1610 2012, 3, 31)); | 1637 "GlobalSdch", kSDCH_DIVISOR, "global_enable_sdch", 2012, 3, 31, |
1611 int sdch_enabled_group = sdch_trial->kDefaultGroupNumber; | 1638 &sdch_enabled_group)); |
1612 | 1639 |
1613 sdch_trial->AppendGroup("global_disable_sdch", | 1640 sdch_trial->AppendGroup("global_disable_sdch", |
1614 kSDCH_DISABLE_PROBABILITY); | 1641 kSDCH_DISABLE_PROBABILITY); |
1615 if (sdch_enabled_group != sdch_trial->group()) | 1642 if (sdch_enabled_group != sdch_trial->group()) |
1616 net::SdchManager::EnableSdchSupport(false); | 1643 net::SdchManager::EnableSdchSupport(false); |
1617 } | 1644 } |
1618 | 1645 |
1619 if (parsed_command_line().HasSwitch(switches::kEnableWatchdog)) | 1646 if (parsed_command_line().HasSwitch(switches::kEnableWatchdog)) |
1620 InstallJankometer(parsed_command_line()); | 1647 InstallJankometer(parsed_command_line()); |
1621 | 1648 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 if (base::win::GetVersion() <= base::win::VERSION_XP) | 1921 if (base::win::GetVersion() <= base::win::VERSION_XP) |
1895 uma_name += "_XP"; | 1922 uma_name += "_XP"; |
1896 | 1923 |
1897 uma_name += "_PreRead_"; | 1924 uma_name += "_PreRead_"; |
1898 uma_name += pre_read_percentage; | 1925 uma_name += pre_read_percentage; |
1899 AddPreReadHistogramTime(uma_name.c_str(), time); | 1926 AddPreReadHistogramTime(uma_name.c_str(), time); |
1900 } | 1927 } |
1901 #endif | 1928 #endif |
1902 #endif | 1929 #endif |
1903 } | 1930 } |
OLD | NEW |