Index: chrome/browser/io_thread.cc |
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc |
index 4e176a0a20b8ea2cfed40891716d204e63fe7196..9dbd883d83c9c0aa96e2151f6e561bf7332c151e 100644 |
--- a/chrome/browser/io_thread.cc |
+++ b/chrome/browser/io_thread.cc |
@@ -53,7 +53,6 @@ |
#include "net/http/http_auth_filter.h" |
#include "net/http/http_auth_handler_factory.h" |
#include "net/http/http_network_layer.h" |
-#include "net/http/http_network_session.h" |
willchan no longer on Chromium
2012/12/01 20:49:13
?
Ryan Hamilton
2012/12/01 23:02:25
Add back. (Odd)
|
#include "net/http/http_server_properties_impl.h" |
#include "net/proxy/proxy_config_service.h" |
#include "net/proxy/proxy_script_fetcher_impl.h" |
@@ -239,6 +238,38 @@ void InitializeNetworkSessionParams( |
params->http_pipelining_enabled = globals.http_pipelining_enabled; |
params->testing_fixed_http_port = globals.testing_fixed_http_port; |
params->testing_fixed_https_port = globals.testing_fixed_https_port; |
+ params->max_spdy_sessions_per_domain = globals.max_spdy_sessions_per_domain; |
+ params->spdy_initial_max_concurrent_streams = |
+ globals.initial_max_spdy_concurrent_streams; |
+ params->spdy_max_concurrent_streams_limit = |
+ globals.max_spdy_concurrent_streams_limit; |
+ |
+ if (globals.force_spdy_single_domain != IOThread::DEFAULT) |
+ params->force_spdy_single_domain = globals.force_spdy_single_domain; |
+ if (globals.enable_spdy_ip_pooling != IOThread::DEFAULT) |
+ params->enable_spdy_ip_pooling = globals.enable_spdy_ip_pooling; |
+ if (globals.enable_spdy_credential_frames != IOThread::DEFAULT) { |
+ params->enable_spdy_credential_frames = |
+ globals.enable_spdy_credential_frames; |
+ } |
+ if (globals.enable_spdy_compression != IOThread::DEFAULT) |
+ params->enable_spdy_compression = globals.enable_spdy_compression; |
+ if (globals.enable_spdy_ping_based_connection_checking != IOThread::DEFAULT) { |
+ params->enable_spdy_ping_based_connection_checking = |
+ globals.enable_spdy_ping_based_connection_checking; |
+ } |
+ if (globals.spdy_default_protocol != net::kProtoUnknown) |
+ params->spdy_default_protocol = globals.spdy_default_protocol; |
+} |
+ |
+int GetSwitchValueAsInt(const CommandLine& command_line, |
+ const std::string& switch_name) { |
+ int value; |
+ if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), |
+ &value)) { |
+ return 0; |
+ } |
+ return value; |
} |
} // namespace |
@@ -342,7 +373,15 @@ IOThread::Globals::Globals() |
ignore_certificate_errors(false), |
http_pipelining_enabled(false), |
testing_fixed_http_port(0), |
- testing_fixed_https_port(0) {} |
+ testing_fixed_https_port(0), |
+ max_spdy_sessions_per_domain(0), |
+ initial_max_spdy_concurrent_streams(0), |
+ max_spdy_concurrent_streams_limit(0), |
+ enable_spdy_ip_pooling(DEFAULT), |
+ enable_spdy_credential_frames(DEFAULT), |
+ enable_spdy_compression(DEFAULT), |
+ enable_spdy_ping_based_connection_checking(DEFAULT), |
+ spdy_default_protocol(net::kProtoUnknown) {} |
IOThread::Globals::~Globals() {} |
@@ -498,20 +537,12 @@ void IOThread::Init() { |
if (command_line.HasSwitch(switches::kEnableHttpPipelining)) |
globals_->http_pipelining_enabled = true; |
if (command_line.HasSwitch(switches::kTestingFixedHttpPort)) { |
- int value; |
- base::StringToInt( |
- command_line.GetSwitchValueASCII( |
- switches::kTestingFixedHttpPort), |
- &value); |
- globals_->testing_fixed_http_port = value; |
+ globals_->testing_fixed_http_port = |
+ GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpPort); |
} |
if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { |
- int value; |
- base::StringToInt( |
- command_line.GetSwitchValueASCII( |
- switches::kTestingFixedHttpsPort), |
- &value); |
- globals_->testing_fixed_https_port = value; |
+ globals_->testing_fixed_https_port = |
+ GetSwitchValueAsInt(command_line, switches::kTestingFixedHttpsPort); |
} |
net::HttpNetworkSession::Params session_params; |
@@ -594,9 +625,8 @@ void IOThread::CleanUp() { |
base::debug::LeakTracker<SystemURLRequestContextGetter>::CheckForLeaks(); |
} |
-void IOThread::InitializeNetworkOptions( |
- const CommandLine& parsed_command_line) { |
- if (parsed_command_line.HasSwitch(switches::kEnableFileCookies)) { |
+void IOThread::InitializeNetworkOptions(const CommandLine& command_line) { |
+ if (command_line.HasSwitch(switches::kEnableFileCookies)) { |
// Enable cookie storage for file:// URLs. Must do this before the first |
// Profile (and therefore the first CookieMonster) is created. |
net::CookieMonster::EnableFileScheme(); |
@@ -607,48 +637,49 @@ void IOThread::InitializeNetworkOptions( |
if (is_spdy_disabled_by_policy_) |
return; |
- if (parsed_command_line.HasSwitch(switches::kEnableIPPooling)) |
- net::SpdySessionPool::enable_ip_pooling(true); |
- |
- if (parsed_command_line.HasSwitch(switches::kDisableIPPooling)) |
- net::SpdySessionPool::enable_ip_pooling(false); |
- |
- if (parsed_command_line.HasSwitch(switches::kEnableSpdyCredentialFrames)) |
- net::SpdySession::set_enable_credential_frames(true); |
- if (parsed_command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { |
- int value; |
- base::StringToInt( |
- parsed_command_line.GetSwitchValueASCII( |
- switches::kMaxSpdySessionsPerDomain), |
- &value); |
- net::SpdySessionPool::set_max_sessions_per_domain(value); |
+ if (command_line.HasSwitch(switches::kMaxSpdySessionsPerDomain)) { |
+ globals_->max_spdy_sessions_per_domain = |
+ GetSwitchValueAsInt(command_line, switches::kMaxSpdySessionsPerDomain); |
} |
- if (parsed_command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { |
+ if (command_line.HasSwitch(switches::kEnableIPPooling)) |
+ globals_->enable_spdy_ip_pooling = TRUE; |
+ |
+ if (command_line.HasSwitch(switches::kDisableIPPooling)) |
+ globals_->enable_spdy_ip_pooling = FALSE; |
+ |
+ if (command_line.HasSwitch(switches::kEnableSpdyCredentialFrames)) |
+ globals_->enable_spdy_credential_frames = TRUE; |
+ |
+ if (command_line.HasSwitch(switches::kEnableWebSocketOverSpdy)) { |
// Enable WebSocket over SPDY. |
net::WebSocketJob::set_websocket_over_spdy_enabled(true); |
} |
bool used_spdy_switch = false; |
- if (parsed_command_line.HasSwitch(switches::kUseSpdy)) { |
+ if (command_line.HasSwitch(switches::kUseSpdy)) { |
std::string spdy_mode = |
- parsed_command_line.GetSwitchValueASCII(switches::kUseSpdy); |
+ command_line.GetSwitchValueASCII(switches::kUseSpdy); |
EnableSpdy(spdy_mode); |
used_spdy_switch = true; |
} |
- if (parsed_command_line.HasSwitch(switches::kEnableSpdy3)) { |
+ if (command_line.HasSwitch(switches::kEnableSpdy3)) { |
net::HttpStreamFactory::EnableNpnSpdy3(); |
used_spdy_switch = true; |
- } else if (parsed_command_line.HasSwitch(switches::kEnableNpn)) { |
+ } else if (command_line.HasSwitch(switches::kEnableNpn)) { |
net::HttpStreamFactory::EnableNpnSpdy(); |
used_spdy_switch = true; |
- } else if (parsed_command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { |
+ } else if (command_line.HasSwitch(switches::kEnableNpnHttpOnly)) { |
net::HttpStreamFactory::EnableNpnHttpOnly(); |
used_spdy_switch = true; |
} |
if (!used_spdy_switch) { |
net::HttpStreamFactory::EnableNpnSpdy3(); |
} |
+ if (command_line.HasSwitch(switches::kMaxSpdyConcurrentStreams)) { |
+ globals_->max_spdy_concurrent_streams_limit = |
+ GetSwitchValueAsInt(command_line, switches::kMaxSpdyConcurrentStreams); |
+ } |
} |
void IOThread::EnableSpdy(const std::string& mode) { |
@@ -678,19 +709,19 @@ void IOThread::EnableSpdy(const std::string& mode) { |
if (option == kOff) { |
net::HttpStreamFactory::set_spdy_enabled(false); |
} else if (option == kDisableSSL) { |
- net::SpdySession::set_default_protocol(net::kProtoSPDY2); |
+ globals_->spdy_default_protocol = net::kProtoSPDY2; |
net::HttpStreamFactory::set_force_spdy_over_ssl(false); |
net::HttpStreamFactory::set_force_spdy_always(true); |
} else if (option == kSSL) { |
- net::SpdySession::set_default_protocol(net::kProtoSPDY2); |
+ globals_->spdy_default_protocol = net::kProtoSPDY2; |
net::HttpStreamFactory::set_force_spdy_over_ssl(true); |
net::HttpStreamFactory::set_force_spdy_always(true); |
} else if (option == kDisablePing) { |
- net::SpdySession::set_enable_ping_based_connection_checking(false); |
+ globals_->enable_spdy_ping_based_connection_checking = FALSE; |
} else if (option == kExclude) { |
net::HttpStreamFactory::add_forced_spdy_exclusion(value); |
} else if (option == kDisableCompression) { |
- net::BufferedSpdyFramer::set_enable_compression_default(false); |
+ globals_->enable_spdy_compression = FALSE; |
} else if (option == kDisableAltProtocols) { |
net::HttpStreamFactory::set_use_alternate_protocols(false); |
} else if (option == kForceAltProtocols) { |
@@ -700,11 +731,11 @@ void IOThread::EnableSpdy(const std::string& mode) { |
net::HttpServerPropertiesImpl::ForceAlternateProtocol(pair); |
} else if (option == kSingleDomain) { |
DLOG(INFO) << "FORCING SINGLE DOMAIN"; |
- net::SpdySessionPool::ForceSingleDomain(); |
+ globals_->force_spdy_single_domain = TRUE; |
} else if (option == kInitialMaxConcurrentStreams) { |
int streams; |
- if (base::StringToInt(value, &streams) && streams > 0) |
- net::SpdySession::set_init_max_concurrent_streams(streams); |
+ if (base::StringToInt(value, &streams)) |
+ globals_->initial_max_spdy_concurrent_streams = streams; |
} else if (option.empty() && it == spdy_options.begin()) { |
continue; |
} else { |