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

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: Disable FieldTrial if spdy is disabled by policy 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 std::string spdy_trial_group;
693
689 if (command_line.HasSwitch(switches::kEnableIPPooling)) 694 if (command_line.HasSwitch(switches::kEnableIPPooling))
690 globals_->enable_spdy_ip_pooling.set(true); 695 globals_->enable_spdy_ip_pooling.set(true);
691 696
692 if (command_line.HasSwitch(switches::kDisableIPPooling)) 697 if (command_line.HasSwitch(switches::kDisableIPPooling))
693 globals_->enable_spdy_ip_pooling.set(false); 698 globals_->enable_spdy_ip_pooling.set(false);
694 699
695 if (command_line.HasSwitch(switches::kEnableSpdyCredentialFrames)) 700 if (command_line.HasSwitch(switches::kEnableSpdyCredentialFrames))
696 globals_->enable_spdy_credential_frames.set(true); 701 globals_->enable_spdy_credential_frames.set(true);
697 702
698 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { 703 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) {
699 // Enable WebSocket over SPDY. 704 // Enable WebSocket over SPDY.
700 net::WebSocketJob::set_websocket_over_spdy_enabled(true); 705 net::WebSocketJob::set_websocket_over_spdy_enabled(true);
706 } else {
707 spdy_trial_group =
708 base::FieldTrialList::FindFullName(kSpdyFieldTrialName);
Alexei Svitkine (slow) 2013/10/01 13:55:31 Why is this here? In your pending config CL, you
ramant (doing other things) 2013/10/01 17:38:18 If the command line kEnableWebSocketOverSpdy is se
701 } 709 }
710
702 if (command_line.HasSwitch(switches::kMaxSpdyConcurrentStreams)) { 711 if (command_line.HasSwitch(switches::kMaxSpdyConcurrentStreams)) {
703 globals_->max_spdy_concurrent_streams_limit.set( 712 globals_->max_spdy_concurrent_streams_limit.set(
704 GetSwitchValueAsInt(command_line, 713 GetSwitchValueAsInt(command_line,
705 switches::kMaxSpdyConcurrentStreams)); 714 switches::kMaxSpdyConcurrentStreams));
706 } 715 }
707 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) { 716 if (command_line.HasSwitch(switches::kTrustedSpdyProxy)) {
708 globals_->trusted_spdy_proxy.set( 717 globals_->trusted_spdy_proxy.set(
709 command_line.GetSwitchValueASCII(switches::kTrustedSpdyProxy)); 718 command_line.GetSwitchValueASCII(switches::kTrustedSpdyProxy));
710 } 719 }
711 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests)) 720 if (command_line.HasSwitch(switches::kIgnoreUrlFetcherCertRequests))
712 net::URLFetcher::SetIgnoreCertificateRequests(true); 721 net::URLFetcher::SetIgnoreCertificateRequests(true);
713 722
714 if (command_line.HasSwitch(switches::kUseSpdy)) { 723 if (command_line.HasSwitch(switches::kUseSpdy)) {
715 std::string spdy_mode = 724 std::string spdy_mode =
716 command_line.GetSwitchValueASCII(switches::kUseSpdy); 725 command_line.GetSwitchValueASCII(switches::kUseSpdy);
717 EnableSpdy(spdy_mode); 726 EnableSpdy(spdy_mode);
718 } else if (command_line.HasSwitch(switches::kEnableHttp2Draft04)) { 727 } else if (command_line.HasSwitch(switches::kEnableHttp2Draft04)) {
719 net::HttpStreamFactory::EnableNpnHttp2Draft04(); 728 net::HttpStreamFactory::EnableNpnHttp2Draft04();
720 } else if (command_line.HasSwitch(switches::kEnableSpdy4a2)) { 729 } else if (command_line.HasSwitch(switches::kEnableSpdy4a2)) {
721 net::HttpStreamFactory::EnableNpnSpdy4a2(); 730 net::HttpStreamFactory::EnableNpnSpdy4a2();
722 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) { 731 } else if (command_line.HasSwitch(switches::kDisableSpdy31)) {
723 net::HttpStreamFactory::EnableNpnSpdy3(); 732 net::HttpStreamFactory::EnableNpnSpdy3();
724 } else if (command_line.HasSwitch(switches::kEnableNpn)) { 733 } else if (command_line.HasSwitch(switches::kEnableNpn)) {
725 net::HttpStreamFactory::EnableNpnSpdy(); 734 net::HttpStreamFactory::EnableNpnSpdy();
726 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { 735 } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) {
727 net::HttpStreamFactory::EnableNpnHttpOnly(); 736 net::HttpStreamFactory::EnableNpnHttpOnly();
728 } else { 737 } else {
729 // Use SPDY/3.1 by default. 738 if (spdy_trial_group == kSpdyFieldTrialDisabledGroupName) {
730 net::HttpStreamFactory::EnableNpnSpdy31(); 739 net::HttpStreamFactory::set_spdy_enabled(false);
740 } else {
741 // Use SPDY/3.1 by default.
742 net::HttpStreamFactory::EnableNpnSpdy31();
743 }
731 } 744 }
745 } else {
746 base::FieldTrial* trial = base::FieldTrialList::Find(kSpdyFieldTrialName);
Alexei Svitkine (slow) 2013/10/01 13:55:31 Nit: I'd negate the conditional and put this at th
ramant (doing other things) 2013/10/01 17:38:18 Negated the check. Done.
747 if (trial)
748 trial->Disable();
732 } 749 }
733 750
734 // TODO(rch): Make the client socket factory a per-network session 751 // TODO(rch): Make the client socket factory a per-network session
735 // instance, constructed from a NetworkSession::Params, to allow us 752 // instance, constructed from a NetworkSession::Params, to allow us
736 // to move this option to IOThread::Globals & 753 // to move this option to IOThread::Globals &
737 // HttpNetworkSession::Params. 754 // HttpNetworkSession::Params.
738 if (command_line.HasSwitch(switches::kEnableTcpFastOpen)) 755 if (command_line.HasSwitch(switches::kEnableTcpFastOpen))
739 net::SetTCPFastOpenEnabled(true); 756 net::SetTCPFastOpenEnabled(true);
740 } 757 }
741 758
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 if (command_line.HasSwitch(switches::kDisableQuicHttps)) 1032 if (command_line.HasSwitch(switches::kDisableQuicHttps))
1016 return false; 1033 return false;
1017 1034
1018 if (command_line.HasSwitch(switches::kEnableQuicHttps)) 1035 if (command_line.HasSwitch(switches::kEnableQuicHttps))
1019 return true; 1036 return true;
1020 1037
1021 // HTTPS over QUIC should only be enabled if we are in the https 1038 // HTTPS over QUIC should only be enabled if we are in the https
1022 // field trial group. 1039 // field trial group.
1023 return quic_trial_group == kQuicFieldTrialHttpsEnabledGroupName; 1040 return quic_trial_group == kQuicFieldTrialHttpsEnabledGroupName;
1024 } 1041 }
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