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

Unified Diff: chrome/browser/io_thread.cc

Issue 11415219: Move a number of static variables SPDY to HttpNetworkSession::Params. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index 4e176a0a20b8ea2cfed40891716d204e63fe7196..1af86e79a3731c5940383609cd154581a52b2021 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -239,6 +239,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;
Nico 2012/12/02 03:54:23 Does this even work? params->enabled_spdy_ip_pooli
Ryan Hamilton 2012/12/03 23:04:12 Ugh. Yes, that was a bug. At one point I had DEF
+ 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 +374,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 +538,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 +626,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 +638,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 +710,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 +732,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 {

Powered by Google App Engine
This is Rietveld 408576698