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

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

Issue 557373002: Plumbing for TCP FastOpen field trial and enables it for SSL sockets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tfo2
Patch Set: Added a field trial group name. Created 6 years, 3 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 | « chrome/browser/io_thread.h ('k') | net/http/http_network_session.h » ('j') | 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/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 108
109 using content::BrowserThread; 109 using content::BrowserThread;
110 110
111 class SafeBrowsingURLRequestContext; 111 class SafeBrowsingURLRequestContext;
112 112
113 // The IOThread object must outlive any tasks posted to the IO thread before the 113 // The IOThread object must outlive any tasks posted to the IO thread before the
114 // Quit task, so base::Bind() calls are not refcounted. 114 // Quit task, so base::Bind() calls are not refcounted.
115 115
116 namespace { 116 namespace {
117 117
118 const char kTCPFastOpenFieldTrialName[] = "TCPFastOpen";
119 const char kTCPFastOpenHttpsEnabledGroupName[] = "HttpsEnabled";
120
118 const char kQuicFieldTrialName[] = "QUIC"; 121 const char kQuicFieldTrialName[] = "QUIC";
119 const char kQuicFieldTrialEnabledGroupName[] = "Enabled"; 122 const char kQuicFieldTrialEnabledGroupName[] = "Enabled";
120 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled"; 123 const char kQuicFieldTrialHttpsEnabledGroupName[] = "HttpsEnabled";
121 const char kQuicFieldTrialPacketLengthSuffix[] = "BytePackets"; 124 const char kQuicFieldTrialPacketLengthSuffix[] = "BytePackets";
122 const char kQuicFieldTrialPacingSuffix[] = "WithPacing"; 125 const char kQuicFieldTrialPacingSuffix[] = "WithPacing";
123 const char kQuicFieldTrialTimeBasedLossDetectionSuffix[] = 126 const char kQuicFieldTrialTimeBasedLossDetectionSuffix[] =
124 "WithTimeBasedLossDetection"; 127 "WithTimeBasedLossDetection";
125 128
126 // The SPDY trial composes two different trial plus control groups: 129 // The SPDY trial composes two different trial plus control groups:
127 // * A "holdback" group with SPDY disabled, and corresponding control 130 // * A "holdback" group with SPDY disabled, and corresponding control
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 } else { 835 } else {
833 // No SPDY command-line flags have been specified. Examine trial groups. 836 // No SPDY command-line flags have been specified. Examine trial groups.
834 ConfigureSpdyFromTrial( 837 ConfigureSpdyFromTrial(
835 base::FieldTrialList::FindFullName(kSpdyFieldTrialName), globals_); 838 base::FieldTrialList::FindFullName(kSpdyFieldTrialName), globals_);
836 } 839 }
837 840
838 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) 841 if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy))
839 globals_->enable_websocket_over_spdy.set(true); 842 globals_->enable_websocket_over_spdy.set(true);
840 } 843 }
841 844
845 ConfigureTCPFastOpen(command_line);
846
842 // TODO(rch): Make the client socket factory a per-network session 847 // TODO(rch): Make the client socket factory a per-network session
843 // instance, constructed from a NetworkSession::Params, to allow us 848 // instance, constructed from a NetworkSession::Params, to allow us
844 // to move this option to IOThread::Globals & 849 // to move this option to IOThread::Globals &
845 // HttpNetworkSession::Params. 850 // HttpNetworkSession::Params.
851 }
846 852
853 void IOThread::ConfigureTCPFastOpen(const CommandLine& command_line) {
854 const std::string trial_group =
855 base::FieldTrialList::FindFullName(kTCPFastOpenFieldTrialName);
856 if (trial_group == kTCPFastOpenHttpsEnabledGroupName)
857 globals_->enable_tcp_fast_open_for_ssl.set(true);
847 bool always_enable_if_supported = 858 bool always_enable_if_supported =
848 command_line.HasSwitch(switches::kEnableTcpFastOpen); 859 command_line.HasSwitch(switches::kEnableTcpFastOpen);
849 // Check for OS support of TCP FastOpen, and turn it on for all connections 860 // Check for OS support of TCP FastOpen, and turn it on for all connections
850 // if indicated by user. 861 // if indicated by user.
851 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_if_supported); 862 net::CheckSupportAndMaybeEnableTCPFastOpen(always_enable_if_supported);
852 } 863 }
853 864
854 void IOThread::ConfigureSpdyFromTrial(const std::string& spdy_trial_group, 865 void IOThread::ConfigureSpdyFromTrial(const std::string& spdy_trial_group,
855 Globals* globals) { 866 Globals* globals) {
856 if (spdy_trial_group == kSpdyFieldTrialHoldbackGroupName) { 867 if (spdy_trial_group == kSpdyFieldTrialHoldbackGroupName) {
857 // TODO(jgraettinger): Use net::NextProtosHttpOnly() instead? 868 // TODO(jgraettinger): Use net::NextProtosHttpOnly() instead?
858 net::HttpStreamFactory::set_spdy_enabled(false); 869 net::HttpStreamFactory::set_spdy_enabled(false);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 params->http_auth_handler_factory = globals.http_auth_handler_factory.get(); 1018 params->http_auth_handler_factory = globals.http_auth_handler_factory.get();
1008 params->http_server_properties = 1019 params->http_server_properties =
1009 globals.http_server_properties->GetWeakPtr(); 1020 globals.http_server_properties->GetWeakPtr();
1010 params->network_delegate = globals.system_network_delegate.get(); 1021 params->network_delegate = globals.system_network_delegate.get();
1011 params->host_mapping_rules = globals.host_mapping_rules.get(); 1022 params->host_mapping_rules = globals.host_mapping_rules.get();
1012 params->enable_ssl_connect_job_waiting = 1023 params->enable_ssl_connect_job_waiting =
1013 globals.enable_ssl_connect_job_waiting; 1024 globals.enable_ssl_connect_job_waiting;
1014 params->ignore_certificate_errors = globals.ignore_certificate_errors; 1025 params->ignore_certificate_errors = globals.ignore_certificate_errors;
1015 params->testing_fixed_http_port = globals.testing_fixed_http_port; 1026 params->testing_fixed_http_port = globals.testing_fixed_http_port;
1016 params->testing_fixed_https_port = globals.testing_fixed_https_port; 1027 params->testing_fixed_https_port = globals.testing_fixed_https_port;
1028 globals.enable_tcp_fast_open_for_ssl.CopyToIfSet(
1029 &params->enable_tcp_fast_open_for_ssl);
1017 1030
1018 globals.initial_max_spdy_concurrent_streams.CopyToIfSet( 1031 globals.initial_max_spdy_concurrent_streams.CopyToIfSet(
1019 &params->spdy_initial_max_concurrent_streams); 1032 &params->spdy_initial_max_concurrent_streams);
1020 globals.force_spdy_single_domain.CopyToIfSet( 1033 globals.force_spdy_single_domain.CopyToIfSet(
1021 &params->force_spdy_single_domain); 1034 &params->force_spdy_single_domain);
1022 globals.enable_spdy_compression.CopyToIfSet( 1035 globals.enable_spdy_compression.CopyToIfSet(
1023 &params->enable_spdy_compression); 1036 &params->enable_spdy_compression);
1024 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet( 1037 globals.enable_spdy_ping_based_connection_checking.CopyToIfSet(
1025 &params->enable_spdy_ping_based_connection_checking); 1038 &params->enable_spdy_ping_based_connection_checking);
1026 globals.spdy_default_protocol.CopyToIfSet( 1039 globals.spdy_default_protocol.CopyToIfSet(
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1399 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1412 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1400 for (size_t i = 0; i < supported_versions.size(); ++i) { 1413 for (size_t i = 0; i < supported_versions.size(); ++i) {
1401 net::QuicVersion version = supported_versions[i]; 1414 net::QuicVersion version = supported_versions[i];
1402 if (net::QuicVersionToString(version) == quic_version) { 1415 if (net::QuicVersionToString(version) == quic_version) {
1403 return version; 1416 return version;
1404 } 1417 }
1405 } 1418 }
1406 1419
1407 return net::QUIC_VERSION_UNSUPPORTED; 1420 return net::QUIC_VERSION_UNSUPPORTED;
1408 } 1421 }
OLDNEW
« no previous file with comments | « chrome/browser/io_thread.h ('k') | net/http/http_network_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698