Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 IOThread::Globals::Globals() | 320 IOThread::Globals::Globals() |
| 321 : ALLOW_THIS_IN_INITIALIZER_LIST( | 321 : ALLOW_THIS_IN_INITIALIZER_LIST( |
| 322 system_request_context_leak_checker(this)), | 322 system_request_context_leak_checker(this)), |
| 323 ignore_certificate_errors(false), | 323 ignore_certificate_errors(false), |
| 324 http_pipelining_enabled(false), | 324 http_pipelining_enabled(false), |
| 325 testing_fixed_http_port(0), | 325 testing_fixed_http_port(0), |
| 326 testing_fixed_https_port(0) {} | 326 testing_fixed_https_port(0) {} |
| 327 | 327 |
| 328 IOThread::Globals::~Globals() {} | 328 IOThread::Globals::~Globals() {} |
| 329 | 329 |
| 330 void IOThread::Globals::InitializeNetworkSessionParams( | |
| 331 net::HttpNetworkSession::Params* params) const { | |
| 332 params->host_resolver = host_resolver.get(); | |
| 333 params->cert_verifier = cert_verifier.get(); | |
| 334 params->server_bound_cert_service = system_server_bound_cert_service.get(); | |
| 335 params->transport_security_state = transport_security_state.get(); | |
| 336 params->proxy_service = proxy_script_fetcher_proxy_service.get(); | |
| 337 params->ssl_config_service = ssl_config_service.get(); | |
| 338 params->http_auth_handler_factory = http_auth_handler_factory.get(); | |
| 339 params->http_server_properties = http_server_properties.get(); | |
| 340 params->network_delegate = system_network_delegate.get(); | |
| 341 params->host_mapping_rules = host_mapping_rules.get(); | |
| 342 params->ignore_certificate_errors = ignore_certificate_errors; | |
| 343 params->http_pipelining_enabled = http_pipelining_enabled; | |
| 344 params->testing_fixed_http_port = testing_fixed_http_port; | |
| 345 params->testing_fixed_https_port = testing_fixed_https_port; | |
| 346 } | |
| 347 | |
| 348 | |
| 330 // |local_state| is passed in explicitly in order to (1) reduce implicit | 349 // |local_state| is passed in explicitly in order to (1) reduce implicit |
| 331 // dependencies and (2) make IOThread more flexible for testing. | 350 // dependencies and (2) make IOThread more flexible for testing. |
| 332 IOThread::IOThread( | 351 IOThread::IOThread( |
| 333 PrefService* local_state, | 352 PrefService* local_state, |
| 334 policy::PolicyService* policy_service, | 353 policy::PolicyService* policy_service, |
| 335 ChromeNetLog* net_log, | 354 ChromeNetLog* net_log, |
| 336 extensions::EventRouterForwarder* extension_event_router_forwarder) | 355 extensions::EventRouterForwarder* extension_event_router_forwarder) |
| 337 : net_log_(net_log), | 356 : net_log_(net_log), |
| 338 extension_event_router_forwarder_(extension_event_router_forwarder), | 357 extension_event_router_forwarder_(extension_event_router_forwarder), |
| 339 globals_(NULL), | 358 globals_(NULL), |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 489 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { | 508 if (command_line.HasSwitch(switches::kTestingFixedHttpsPort)) { |
| 490 int value; | 509 int value; |
| 491 base::StringToInt( | 510 base::StringToInt( |
| 492 command_line.GetSwitchValueASCII( | 511 command_line.GetSwitchValueASCII( |
| 493 switches::kTestingFixedHttpsPort), | 512 switches::kTestingFixedHttpsPort), |
| 494 &value); | 513 &value); |
| 495 globals_->testing_fixed_https_port = value; | 514 globals_->testing_fixed_https_port = value; |
| 496 } | 515 } |
| 497 | 516 |
| 498 net::HttpNetworkSession::Params session_params; | 517 net::HttpNetworkSession::Params session_params; |
| 499 session_params.host_resolver = globals_->host_resolver.get(); | 518 globals_->InitializeNetworkSessionParams(&session_params); |
| 500 session_params.cert_verifier = globals_->cert_verifier.get(); | |
| 501 session_params.server_bound_cert_service = | |
| 502 globals_->system_server_bound_cert_service.get(); | |
| 503 session_params.transport_security_state = | |
| 504 globals_->transport_security_state.get(); | |
| 505 session_params.proxy_service = | |
| 506 globals_->proxy_script_fetcher_proxy_service.get(); | |
| 507 session_params.ssl_config_service = globals_->ssl_config_service.get(); | |
| 508 session_params.http_auth_handler_factory = | |
| 509 globals_->http_auth_handler_factory.get(); | |
| 510 session_params.http_server_properties = | |
| 511 globals_->http_server_properties.get(); | |
| 512 session_params.network_delegate = globals_->system_network_delegate.get(); | |
| 513 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | |
| 514 // system URLRequestContext too. There's no reason this should be tied to a | |
| 515 // profile. | |
| 516 session_params.net_log = net_log_; | 519 session_params.net_log = net_log_; |
| 517 session_params.host_mapping_rules = globals_->host_mapping_rules.get(); | |
| 518 session_params.ignore_certificate_errors = | |
| 519 globals_->ignore_certificate_errors; | |
| 520 session_params.http_pipelining_enabled = globals_->http_pipelining_enabled; | |
| 521 session_params.testing_fixed_http_port = globals_->testing_fixed_http_port; | |
| 522 session_params.testing_fixed_https_port = globals_->testing_fixed_https_port; | |
| 523 | 520 |
| 524 InitializeNetworkOptions(command_line); | 521 InitializeNetworkOptions(command_line); |
| 525 | 522 |
| 526 scoped_refptr<net::HttpNetworkSession> network_session( | 523 scoped_refptr<net::HttpNetworkSession> network_session( |
| 527 new net::HttpNetworkSession(session_params)); | 524 new net::HttpNetworkSession(session_params)); |
| 528 globals_->proxy_script_fetcher_http_transaction_factory.reset( | 525 globals_->proxy_script_fetcher_http_transaction_factory.reset( |
| 529 new net::HttpNetworkLayer(network_session)); | 526 new net::HttpNetworkLayer(network_session)); |
| 530 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( | 527 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( |
| 531 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 528 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 532 | 529 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 826 | 823 |
| 827 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 824 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 828 globals_->system_proxy_service.reset( | 825 globals_->system_proxy_service.reset( |
| 829 ProxyServiceFactory::CreateProxyService( | 826 ProxyServiceFactory::CreateProxyService( |
| 830 net_log_, | 827 net_log_, |
| 831 globals_->proxy_script_fetcher_context.get(), | 828 globals_->proxy_script_fetcher_context.get(), |
| 832 system_proxy_config_service_.release(), | 829 system_proxy_config_service_.release(), |
| 833 command_line)); | 830 command_line)); |
| 834 | 831 |
| 835 net::HttpNetworkSession::Params system_params; | 832 net::HttpNetworkSession::Params system_params; |
| 836 system_params.host_resolver = globals_->host_resolver.get(); | 833 globals_->InitializeNetworkSessionParams(&system_params); |
| 837 system_params.cert_verifier = globals_->cert_verifier.get(); | |
| 838 system_params.server_bound_cert_service = | |
| 839 globals_->system_server_bound_cert_service.get(); | |
| 840 system_params.transport_security_state = | |
| 841 globals_->transport_security_state.get(); | |
| 842 system_params.proxy_service = globals_->system_proxy_service.get(); | |
|
Ryan Sleevi
2012/11/30 00:10:05
|proxy_service| is being initialized differently h
Ryan Hamilton
2012/11/30 00:17:59
DOH! Thanks for the catch.
| |
| 843 system_params.ssl_config_service = globals_->ssl_config_service.get(); | |
| 844 system_params.http_auth_handler_factory = | |
| 845 globals_->http_auth_handler_factory.get(); | |
| 846 system_params.http_server_properties = globals_->http_server_properties.get(); | |
| 847 system_params.network_delegate = globals_->system_network_delegate.get(); | |
| 848 system_params.net_log = net_log_; | 834 system_params.net_log = net_log_; |
| 849 system_params.host_mapping_rules = globals_->host_mapping_rules.get(); | |
| 850 system_params.ignore_certificate_errors = globals_->ignore_certificate_errors; | |
| 851 system_params.http_pipelining_enabled = globals_->http_pipelining_enabled; | |
| 852 system_params.testing_fixed_http_port = globals_->testing_fixed_http_port; | |
| 853 system_params.testing_fixed_https_port = globals_->testing_fixed_https_port; | |
| 854 | 835 |
| 855 globals_->system_http_transaction_factory.reset( | 836 globals_->system_http_transaction_factory.reset( |
| 856 new net::HttpNetworkLayer( | 837 new net::HttpNetworkLayer( |
| 857 new net::HttpNetworkSession(system_params))); | 838 new net::HttpNetworkSession(system_params))); |
| 858 globals_->system_ftp_transaction_factory.reset( | 839 globals_->system_ftp_transaction_factory.reset( |
| 859 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 840 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 860 globals_->system_request_context.reset( | 841 globals_->system_request_context.reset( |
| 861 ConstructSystemRequestContext(globals_, net_log_)); | 842 ConstructSystemRequestContext(globals_, net_log_)); |
| 862 | 843 |
| 863 sdch_manager_->set_sdch_fetcher( | 844 sdch_manager_->set_sdch_fetcher( |
| 864 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); | 845 new SdchDictionaryFetcher(system_url_request_context_getter_.get())); |
| 865 } | 846 } |
| 866 | 847 |
| 867 void IOThread::UpdateDnsClientEnabled() { | 848 void IOThread::UpdateDnsClientEnabled() { |
| 868 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); | 849 globals()->host_resolver->SetDnsClientEnabled(*dns_client_enabled_); |
| 869 } | 850 } |
| OLD | NEW |