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

Unified Diff: chrome/browser/io_thread.cc

Issue 10834215: Remove static variables from HttpStreamFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: typo Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/profiles/off_the_record_profile_io_data.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index b44263794d98e15d388d9a195409828b19bb3b43..037868a5eb87d97d30aa7bd0fd0c1de5ce05532d 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -39,6 +39,7 @@
#include "net/base/cert_verifier.h"
#include "net/base/default_server_bound_cert_store.h"
#include "net/base/host_cache.h"
+#include "net/base/host_mapping_rules.h"
#include "net/base/host_resolver.h"
#include "net/base/mapped_host_resolver.h"
#include "net/base/net_util.h"
@@ -322,7 +323,12 @@ SystemRequestContextLeakChecker::~SystemRequestContextLeakChecker() {
IOThread::Globals::Globals()
: ALLOW_THIS_IN_INITIALIZER_LIST(
- system_request_context_leak_checker(this)) {}
+ system_request_context_leak_checker(this)),
+ ignore_certificate_errors(false),
+ http_pipelining_enabled(false),
+ testing_fixed_http_port(0),
+ testing_fixed_https_port(0) {}
+
IOThread::Globals::~Globals() {}
// |local_state| is passed in explicitly in order to (1) reduce implicit
@@ -401,6 +407,8 @@ void IOThread::Init() {
net::SetMessageLoopForNSSHttpIO();
#endif // defined(USE_NSS)
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+
DCHECK(!globals_);
globals_ = new Globals;
@@ -424,10 +432,8 @@ void IOThread::Init() {
NULL,
&system_enable_referrers_,
NULL);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableExtensionsHttpThrottling)) {
+ if (command_line.HasSwitch(switches::kDisableExtensionsHttpThrottling))
network_delegate->NeverThrottleRequests();
- }
globals_->system_network_delegate.reset(network_delegate);
globals_->host_resolver.reset(
CreateGlobalHostResolver(net_log_));
@@ -448,6 +454,32 @@ void IOThread::Init() {
new net::DefaultServerBoundCertStore(NULL),
base::WorkerPool::GetTaskRunner(true)));
globals_->load_time_stats.reset(new chrome_browser_net::LoadTimeStats());
+ globals_->host_mapping_rules.reset(new net::HostMappingRules());
+ if (command_line.HasSwitch(switches::kHostRules)) {
+ globals_->host_mapping_rules->SetRulesFromString(
+ command_line.GetSwitchValueASCII(switches::kHostRules));
+ }
+ if (command_line.HasSwitch(switches::kIgnoreCertificateErrors))
+ globals_->ignore_certificate_errors = true;
+ 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;
+ }
+ if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) {
+ int value;
+ base::StringToInt(
+ command_line.GetSwitchValueASCII(
+ switches::kTestingFixedHttpsPort),
+ &value);
+ globals_->testing_fixed_https_port = value;
+ }
+
net::HttpNetworkSession::Params session_params;
session_params.host_resolver = globals_->host_resolver.get();
session_params.cert_verifier = globals_->cert_verifier.get();
@@ -457,16 +489,23 @@ void IOThread::Init() {
globals_->transport_security_state.get();
session_params.proxy_service =
globals_->proxy_script_fetcher_proxy_service.get();
+ session_params.ssl_config_service = globals_->ssl_config_service.get();
session_params.http_auth_handler_factory =
globals_->http_auth_handler_factory.get();
+ session_params.http_server_properties =
+ globals_->http_server_properties.get();
session_params.network_delegate = globals_->system_network_delegate.get();
// TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
// system URLRequestContext too. There's no reason this should be tied to a
// profile.
- session_params.http_server_properties =
- globals_->http_server_properties.get();
session_params.net_log = net_log_;
- session_params.ssl_config_service = globals_->ssl_config_service;
+ session_params.host_mapping_rules = globals_->host_mapping_rules.get();
+ session_params.ignore_certificate_errors =
+ globals_->ignore_certificate_errors;
+ session_params.http_pipelining_enabled = globals_->http_pipelining_enabled;
+ session_params.testing_fixed_http_port = globals_->testing_fixed_http_port;
+ session_params.testing_fixed_https_port = globals_->http_pipelining_enabled;
+
scoped_refptr<net::HttpNetworkSession> network_session(
new net::HttpNetworkSession(session_params));
globals_->proxy_script_fetcher_http_transaction_factory.reset(
@@ -628,6 +667,7 @@ void IOThread::InitSystemRequestContextOnIOThread() {
globals_->proxy_script_fetcher_context.get(),
system_proxy_config_service_.release(),
command_line));
+
net::HttpNetworkSession::Params system_params;
system_params.host_resolver = globals_->host_resolver.get();
system_params.cert_verifier = globals_->cert_verifier.get();
@@ -642,6 +682,12 @@ void IOThread::InitSystemRequestContextOnIOThread() {
system_params.http_server_properties = globals_->http_server_properties.get();
system_params.network_delegate = globals_->system_network_delegate.get();
system_params.net_log = net_log_;
+ system_params.host_mapping_rules = globals_->host_mapping_rules.get();
+ system_params.ignore_certificate_errors = globals_->ignore_certificate_errors;
+ system_params.http_pipelining_enabled = globals_->http_pipelining_enabled;
+ system_params.testing_fixed_http_port = globals_->testing_fixed_http_port;
+ system_params.testing_fixed_https_port = globals_->testing_fixed_https_port;
+
globals_->system_http_transaction_factory.reset(
new net::HttpNetworkLayer(
new net::HttpNetworkSession(system_params)));
« no previous file with comments | « chrome/browser/io_thread.h ('k') | chrome/browser/profiles/off_the_record_profile_io_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698