Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Side by Side Diff: chrome/browser/io_thread.cc

Issue 25087007: Added a field trial (finch experiment) to disable SPDY for x% of users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small reorg of code Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 // The IOThread object must outlive any tasks posted to the IO thread before the 97 // The IOThread object must outlive any tasks posted to the IO thread before the
98 // Quit task, so base::Bind() calls are not refcounted. 98 // Quit task, so base::Bind() calls are not refcounted.
99 99
100 namespace { 100 namespace {
101 101
102 const char kQuicFieldTrialName[] = "QUIC"; 102 const char kQuicFieldTrialName[] = "QUIC";
103 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; 103 const char kQuicFieldTrialEnabledGroupName[] = "Enabled";
104 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; 104 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled";
105 105
106 const char kSpdyFieldTrialName[] = "SPDY";
107 const char kSpdyFieldTrialDisabledGroupName[] = "SpdyDisabled";
108
106 #if defined(OS_MACOSX) && !defined(OS_IOS) 109 #if defined(OS_MACOSX) && !defined(OS_IOS)
107 void ObserveKeychainEvents() { 110 void ObserveKeychainEvents() {
108 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 111 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
109 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents(); 112 net::CertDatabase::GetInstance()->SetMessageLoopForKeychainEvents();
110 } 113 }
111 #endif 114 #endif
112 115
113 // Used for the "system" URLRequestContext. 116 // Used for the "system" URLRequestContext.
114 class SystemURLRequestContext : public net::URLRequestContext { 117 class SystemURLRequestContext : public net::URLRequestContext {
115 public: 118 public:
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 681
679 void IOThread::InitializeNetworkOptions(const CommandLine& command_line) { 682 void IOThread::InitializeNetworkOptions(const CommandLine& command_line) {
680 if (command_line.HasSwitch(switches::kEnableFileCookies)) { 683 if (command_line.HasSwitch(switches::kEnableFileCookies)) {
681 // Enable cookie storage for file:// URLs. Must do this before the first 684 // Enable cookie storage for file:// URLs. Must do this before the first
682 // Profile (and therefore the first CookieMonster) is created. 685 // Profile (and therefore the first CookieMonster) is created.
683 net::CookieMonster::EnableFileScheme(); 686 net::CookieMonster::EnableFileScheme();
684 } 687 }
685 688
686 // Only handle use-spdy command line flags if "spdy.disabled" preference is 689 // Only handle use-spdy command line flags if "spdy.disabled" preference is
687 // not disabled via policy. 690 // not disabled via policy.
688 if (!is_spdy_disabled_by_policy_) { 691 if (is_spdy_disabled_by_policy_) {
692 base::FieldTrial* trial = base::FieldTrialList::Find(kSpdyFieldTrialName);
693 if (trial)
694 trial->Disable();
695 } else {
696 std::string spdy_trial_group =
697 base::FieldTrialList::FindFullName(kSpdyFieldTrialName);
698
689 if (command_line.HasSwitch(switches::kEnableIPPooling)) 699 if (command_line.HasSwitch(switches::kEnableIPPooling))
690 globals_->enable_spdy_ip_pooling.set(true); 700 globals_->enable_spdy_ip_pooling.set(true);
691 701
692 if (command_line.HasSwitch(switches::kDisableIPPooling)) 702 if (command_line.HasSwitch(switches::kDisableIPPooling))
693 globals_->enable_spdy_ip_pooling.set(false); 703 globals_->enable_spdy_ip_pooling.set(false);
694 704
695 if (command_line.HasSwitch(switches::kEnableSpdyCredentialFrames)) 705 if (command_line.HasSwitch(switches::kEnableSpdyCredentialFrames))
696 globals_->enable_spdy_credential_frames.set(true); 706 globals_->enable_spdy_credential_frames.set(true);
697 707
698 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { 708 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) {
699 // Enable WebSocket over SPDY. 709 // Enable WebSocket over SPDY.
700 net::WebSocketJob::set_websocket_over_spdy_enabled(true); 710 net::WebSocketJob::set_websocket_over_spdy_enabled(true);
701 } 711 }
712
702 if (command_line.HasSwitch(switches::kMaxSpdyConcurrentStreams)) { 713 if (command_line.HasSwitch(switches::kMaxSpdyConcurrentStreams)) {
703 globals_->max_spdy_concurrent_streams_limit.set( 714 globals_->max_spdy_concurrent_streams_limit.set(
704 GetSwitchValueAsInt(command_line, 715 GetSwitchValueAsInt(command_line,
705 switches::kMaxSpdyConcurrentStreams)); 716 switches::kMaxSpdyConcurrentStreams));
706 } 717 }
707 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { 718 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) {
708 globals_->trusted_spdy_proxy.set( 719 globals_->trusted_spdy_proxy.set(
709 command_line.GetSwitchValueASCII(switches::kTrustedSpdyProxy)); 720 command_line.GetSwitchValueASCII(switches::kTrustedSpdyProxy));
710 } 721 }
711 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) 722 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests))
712 net::URLFetcher::SetIgnoreCertificateRequests(true); 723 net::URLFetcher::SetIgnoreCertificateRequests(true);
713 724
714 if (command_line.HasSwitch(switches::kUseSpdy)) { 725 if (command_line.HasSwitch(switches::kUseSpdy)) {
715 std::string spdy_mode = 726 std::string spdy_mode =
716 command_line.GetSwitchValueASCII(switches::kUseSpdy); 727 command_line.GetSwitchValueASCII(switches::kUseSpdy);
717 EnableSpdy(spdy_mode); 728 EnableSpdy(spdy_mode);
718 } else if (command_line.HasSwitch(switches::kEnableHttp2Draft04)) { 729 } else if (command_line.HasSwitch(switches::kEnableHttp2Draft04)) {
719 net::HttpStreamFactory::EnableNpnHttp2Draft04(); 730 net::HttpStreamFactory::EnableNpnHttp2Draft04();
720 } else if (command_line.HasSwitch(switches::kEnableSpdy4a2)) { 731 } else if (command_line.HasSwitch(switches::kEnableSpdy4a2)) {
721 net::HttpStreamFactory::EnableNpnSpdy4a2(); 732 net::HttpStreamFactory::EnableNpnSpdy4a2();
722 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) { 733 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) {
723 net::HttpStreamFactory::EnableNpnSpdy3(); 734 net::HttpStreamFactory::EnableNpnSpdy3();
724 } else if (command_line.HasSwitch(switches::kEnableNpn)) { 735 } else if (command_line.HasSwitch(switches::kEnableNpn)) {
725 net::HttpStreamFactory::EnableNpnSpdy(); 736 net::HttpStreamFactory::EnableNpnSpdy();
726 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { 737 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) {
727 net::HttpStreamFactory::EnableNpnHttpOnly(); 738 net::HttpStreamFactory::EnableNpnHttpOnly();
728 } else { 739 } else {
729 // Use SPDY/3.1 by default. 740 if (spdy_trial_group == kSpdyFieldTrialDisabledGroupName &&
730 net::HttpStreamFactory::EnableNpnSpdy31(); 741 !command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) {
742 net::HttpStreamFactory::set_spdy_enabled(false);
743 } else {
744 // Use SPDY/3.1 by default.
745 net::HttpStreamFactory::EnableNpnSpdy31();
746 }
731 } 747 }
732 } 748 }
733 749
734 // TODO(rch): Make the client socket factory a per-network session 750 // TODO(rch): Make the client socket factory a per-network session
735 // instance, constructed from a NetworkSession::Params, to allow us 751 // instance, constructed from a NetworkSession::Params, to allow us
736 // to move this option to IOThread::Globals & 752 // to move this option to IOThread::Globals &
737 // HttpNetworkSession::Params. 753 // HttpNetworkSession::Params.
738 if (command_line.HasSwitch(switches::kEnableTcpFastOpen)) 754 if (command_line.HasSwitch(switches::kEnableTcpFastOpen))
739 net::SetTCPFastOpenEnabled(true); 755 net::SetTCPFastOpenEnabled(true);
740 } 756 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 if (command_line.HasSwitch(switches::kDisableQuicHttps)) 1031 if (command_line.HasSwitch(switches::kDisableQuicHttps))
1016 return false; 1032 return false;
1017 1033
1018 if (command_line.HasSwitch(switches::kEnableQuicHttps)) 1034 if (command_line.HasSwitch(switches::kEnableQuicHttps))
1019 return true; 1035 return true;
1020 1036
1021 // HTTPS over QUIC should only be enabled if we are in the https 1037 // HTTPS over QUIC should only be enabled if we are in the https
1022 // field trial group. 1038 // field trial group.
1023 return quic_trial_group == kQuicFieldTrialHttpsEnabledGroupName; 1039 return quic_trial_group == kQuicFieldTrialHttpsEnabledGroupName;
1024 } 1040 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698