Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/leak_tracker.h" | 10 #include "base/debug/leak_tracker.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 #include "chrome/browser/net/proxy_service_factory.h" | 29 #include "chrome/browser/net/proxy_service_factory.h" |
| 30 #include "chrome/browser/prefs/pref_service.h" | 30 #include "chrome/browser/prefs/pref_service.h" |
| 31 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 32 #include "chrome/common/pref_names.h" | 32 #include "chrome/common/pref_names.h" |
| 33 #include "content/browser/browser_thread.h" | 33 #include "content/browser/browser_thread.h" |
| 34 #include "content/browser/gpu/gpu_process_host.h" | 34 #include "content/browser/gpu/gpu_process_host.h" |
| 35 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" | 35 #include "content/browser/in_process_webkit/indexed_db_key_utility_client.h" |
| 36 #include "content/common/url_fetcher.h" | 36 #include "content/common/url_fetcher.h" |
| 37 #include "net/base/cert_verifier.h" | 37 #include "net/base/cert_verifier.h" |
| 38 #include "net/base/cookie_monster.h" | 38 #include "net/base/cookie_monster.h" |
| 39 #include "net/base/default_origin_bound_cert_store.h" | |
| 39 #include "net/base/dnsrr_resolver.h" | 40 #include "net/base/dnsrr_resolver.h" |
| 40 #include "net/base/host_cache.h" | 41 #include "net/base/host_cache.h" |
| 41 #include "net/base/host_resolver.h" | 42 #include "net/base/host_resolver.h" |
| 42 #include "net/base/host_resolver_impl.h" | 43 #include "net/base/host_resolver_impl.h" |
| 43 #include "net/base/mapped_host_resolver.h" | 44 #include "net/base/mapped_host_resolver.h" |
| 44 #include "net/base/net_util.h" | 45 #include "net/base/net_util.h" |
| 46 #include "net/base/origin_bound_cert_service.h" | |
| 45 #include "net/dns/async_host_resolver.h" | 47 #include "net/dns/async_host_resolver.h" |
| 46 #include "net/ftp/ftp_network_layer.h" | 48 #include "net/ftp/ftp_network_layer.h" |
| 47 #include "net/http/http_auth_filter.h" | 49 #include "net/http/http_auth_filter.h" |
| 48 #include "net/http/http_auth_handler_factory.h" | 50 #include "net/http/http_auth_handler_factory.h" |
| 49 #include "net/http/http_network_layer.h" | 51 #include "net/http/http_network_layer.h" |
| 50 #include "net/http/http_network_session.h" | 52 #include "net/http/http_network_session.h" |
| 51 #include "net/proxy/proxy_config_service.h" | 53 #include "net/proxy/proxy_config_service.h" |
| 52 #include "net/proxy/proxy_script_fetcher_impl.h" | 54 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 53 #include "net/proxy/proxy_service.h" | 55 #include "net/proxy/proxy_service.h" |
| 54 #include "net/socket/dns_cert_provenance_checker.h" | 56 #include "net/socket/dns_cert_provenance_checker.h" |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 context->set_cert_verifier(globals->cert_verifier.get()); | 249 context->set_cert_verifier(globals->cert_verifier.get()); |
| 248 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); | 250 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); |
| 249 context->set_http_auth_handler_factory( | 251 context->set_http_auth_handler_factory( |
| 250 globals->http_auth_handler_factory.get()); | 252 globals->http_auth_handler_factory.get()); |
| 251 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); | 253 context->set_proxy_service(globals->proxy_script_fetcher_proxy_service.get()); |
| 252 context->set_http_transaction_factory( | 254 context->set_http_transaction_factory( |
| 253 globals->proxy_script_fetcher_http_transaction_factory.get()); | 255 globals->proxy_script_fetcher_http_transaction_factory.get()); |
| 254 context->set_ftp_transaction_factory( | 256 context->set_ftp_transaction_factory( |
| 255 globals->proxy_script_fetcher_ftp_transaction_factory.get()); | 257 globals->proxy_script_fetcher_ftp_transaction_factory.get()); |
| 256 // In-memory cookie store. | 258 // In-memory cookie store. |
| 257 context->set_cookie_store(new net::CookieMonster(NULL, NULL)); | 259 context->set_cookie_store(globals->cookie_store.get()); |
| 260 // In-memory origin-bound cert store. | |
|
wtc
2011/08/09 17:43:45
The "In-memory cookie store" and "In-memory origin
| |
| 261 context->set_origin_bound_cert_service( | |
| 262 globals->origin_bound_cert_service.get()); | |
| 258 context->set_network_delegate(globals->system_network_delegate.get()); | 263 context->set_network_delegate(globals->system_network_delegate.get()); |
| 259 return context; | 264 return context; |
| 260 } | 265 } |
| 261 | 266 |
| 262 scoped_refptr<net::URLRequestContext> | 267 scoped_refptr<net::URLRequestContext> |
| 263 ConstructSystemRequestContext(IOThread::Globals* globals, | 268 ConstructSystemRequestContext(IOThread::Globals* globals, |
| 264 net::NetLog* net_log) { | 269 net::NetLog* net_log) { |
| 265 scoped_refptr<net::URLRequestContext> context( | 270 scoped_refptr<net::URLRequestContext> context( |
| 266 new SystemURLRequestContext); | 271 new SystemURLRequestContext); |
| 267 context->set_net_log(net_log); | 272 context->set_net_log(net_log); |
| 268 context->set_host_resolver(globals->host_resolver.get()); | 273 context->set_host_resolver(globals->host_resolver.get()); |
| 269 context->set_cert_verifier(globals->cert_verifier.get()); | 274 context->set_cert_verifier(globals->cert_verifier.get()); |
| 270 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); | 275 context->set_dnsrr_resolver(globals->dnsrr_resolver.get()); |
| 271 context->set_http_auth_handler_factory( | 276 context->set_http_auth_handler_factory( |
| 272 globals->http_auth_handler_factory.get()); | 277 globals->http_auth_handler_factory.get()); |
| 273 context->set_proxy_service(globals->system_proxy_service.get()); | 278 context->set_proxy_service(globals->system_proxy_service.get()); |
| 274 context->set_http_transaction_factory( | 279 context->set_http_transaction_factory( |
| 275 globals->system_http_transaction_factory.get()); | 280 globals->system_http_transaction_factory.get()); |
| 276 context->set_ftp_transaction_factory( | 281 context->set_ftp_transaction_factory( |
| 277 globals->system_ftp_transaction_factory.get()); | 282 globals->system_ftp_transaction_factory.get()); |
| 278 // In-memory cookie store. | 283 // In-memory cookie store. |
| 279 context->set_cookie_store(new net::CookieMonster(NULL, NULL)); | 284 context->set_cookie_store(globals->cookie_store.get()); |
| 285 // In-memory origin bound cert-store. | |
| 286 context->set_origin_bound_cert_service( | |
| 287 globals->origin_bound_cert_service.get()); | |
| 280 return context; | 288 return context; |
| 281 } | 289 } |
| 282 | 290 |
| 283 } // namespace | 291 } // namespace |
| 284 | 292 |
| 285 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { | 293 class SystemURLRequestContextGetter : public net::URLRequestContextGetter { |
| 286 public: | 294 public: |
| 287 explicit SystemURLRequestContextGetter(IOThread* io_thread); | 295 explicit SystemURLRequestContextGetter(IOThread* io_thread); |
| 288 virtual ~SystemURLRequestContextGetter(); | 296 virtual ~SystemURLRequestContextGetter(); |
| 289 | 297 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 485 globals_->host_resolver.reset( | 493 globals_->host_resolver.reset( |
| 486 CreateGlobalHostResolver(net_log_)); | 494 CreateGlobalHostResolver(net_log_)); |
| 487 globals_->cert_verifier.reset(new net::CertVerifier); | 495 globals_->cert_verifier.reset(new net::CertVerifier); |
| 488 globals_->dnsrr_resolver.reset(new net::DnsRRResolver); | 496 globals_->dnsrr_resolver.reset(new net::DnsRRResolver); |
| 489 globals_->ssl_config_service = GetSSLConfigService(); | 497 globals_->ssl_config_service = GetSSLConfigService(); |
| 490 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( | 498 globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory( |
| 491 globals_->host_resolver.get())); | 499 globals_->host_resolver.get())); |
| 492 // For the ProxyScriptFetcher, we use a direct ProxyService. | 500 // For the ProxyScriptFetcher, we use a direct ProxyService. |
| 493 globals_->proxy_script_fetcher_proxy_service.reset( | 501 globals_->proxy_script_fetcher_proxy_service.reset( |
| 494 net::ProxyService::CreateDirectWithNetLog(net_log_)); | 502 net::ProxyService::CreateDirectWithNetLog(net_log_)); |
| 503 globals_->cookie_store = new net::CookieMonster(NULL, NULL); | |
| 504 globals_->origin_bound_cert_service.reset( | |
| 505 new net::OriginBoundCertService( | |
| 506 new net::DefaultOriginBoundCertStore(NULL))); | |
| 495 net::HttpNetworkSession::Params session_params; | 507 net::HttpNetworkSession::Params session_params; |
| 496 session_params.host_resolver = globals_->host_resolver.get(); | 508 session_params.host_resolver = globals_->host_resolver.get(); |
| 497 session_params.cert_verifier = globals_->cert_verifier.get(); | 509 session_params.cert_verifier = globals_->cert_verifier.get(); |
| 510 session_params.origin_bound_cert_service = | |
| 511 globals_->origin_bound_cert_service.get(); | |
| 498 session_params.proxy_service = | 512 session_params.proxy_service = |
| 499 globals_->proxy_script_fetcher_proxy_service.get(); | 513 globals_->proxy_script_fetcher_proxy_service.get(); |
| 500 session_params.http_auth_handler_factory = | 514 session_params.http_auth_handler_factory = |
| 501 globals_->http_auth_handler_factory.get(); | 515 globals_->http_auth_handler_factory.get(); |
| 502 session_params.network_delegate = globals_->system_network_delegate.get(); | 516 session_params.network_delegate = globals_->system_network_delegate.get(); |
| 503 session_params.net_log = net_log_; | 517 session_params.net_log = net_log_; |
| 504 session_params.ssl_config_service = globals_->ssl_config_service; | 518 session_params.ssl_config_service = globals_->ssl_config_service; |
| 505 scoped_refptr<net::HttpNetworkSession> network_session( | 519 scoped_refptr<net::HttpNetworkSession> network_session( |
| 506 new net::HttpNetworkSession(session_params)); | 520 new net::HttpNetworkSession(session_params)); |
| 507 globals_->proxy_script_fetcher_http_transaction_factory.reset( | 521 globals_->proxy_script_fetcher_http_transaction_factory.reset( |
| 508 new net::HttpNetworkLayer(network_session)); | 522 new net::HttpNetworkLayer(network_session)); |
| 509 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( | 523 globals_->proxy_script_fetcher_ftp_transaction_factory.reset( |
| 510 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 524 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 511 | 525 |
| 512 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context = | 526 globals_->proxy_script_fetcher_context = |
| 513 ConstructProxyScriptFetcherContext(globals_, net_log_); | 527 ConstructProxyScriptFetcherContext(globals_, net_log_); |
| 514 globals_->proxy_script_fetcher_context = proxy_script_fetcher_context; | |
| 515 } | 528 } |
| 516 | 529 |
| 517 void IOThread::CleanUp() { | 530 void IOThread::CleanUp() { |
| 518 // Step 1: Kill all things that might be holding onto | 531 // Step 1: Kill all things that might be holding onto |
| 519 // net::URLRequest/net::URLRequestContexts. | 532 // net::URLRequest/net::URLRequestContexts. |
| 520 | 533 |
| 521 #if defined(USE_NSS) | 534 #if defined(USE_NSS) |
| 522 net::ShutdownOCSP(); | 535 net::ShutdownOCSP(); |
| 523 #endif // defined(USE_NSS) | 536 #endif // defined(USE_NSS) |
| 524 | 537 |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 711 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 724 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 712 globals_->system_proxy_service.reset( | 725 globals_->system_proxy_service.reset( |
| 713 ProxyServiceFactory::CreateProxyService( | 726 ProxyServiceFactory::CreateProxyService( |
| 714 net_log_, | 727 net_log_, |
| 715 globals_->proxy_script_fetcher_context, | 728 globals_->proxy_script_fetcher_context, |
| 716 system_proxy_config_service_.release(), | 729 system_proxy_config_service_.release(), |
| 717 command_line)); | 730 command_line)); |
| 718 net::HttpNetworkSession::Params system_params; | 731 net::HttpNetworkSession::Params system_params; |
| 719 system_params.host_resolver = globals_->host_resolver.get(); | 732 system_params.host_resolver = globals_->host_resolver.get(); |
| 720 system_params.cert_verifier = globals_->cert_verifier.get(); | 733 system_params.cert_verifier = globals_->cert_verifier.get(); |
| 734 system_params.origin_bound_cert_service = | |
| 735 globals_->origin_bound_cert_service.get(); | |
| 721 system_params.dnsrr_resolver = globals_->dnsrr_resolver.get(); | 736 system_params.dnsrr_resolver = globals_->dnsrr_resolver.get(); |
| 722 system_params.dns_cert_checker = NULL; | 737 system_params.dns_cert_checker = NULL; |
| 723 system_params.ssl_host_info_factory = NULL; | 738 system_params.ssl_host_info_factory = NULL; |
| 724 system_params.proxy_service = globals_->system_proxy_service.get(); | 739 system_params.proxy_service = globals_->system_proxy_service.get(); |
| 725 system_params.ssl_config_service = globals_->ssl_config_service.get(); | 740 system_params.ssl_config_service = globals_->ssl_config_service.get(); |
| 726 system_params.http_auth_handler_factory = | 741 system_params.http_auth_handler_factory = |
| 727 globals_->http_auth_handler_factory.get(); | 742 globals_->http_auth_handler_factory.get(); |
| 728 system_params.network_delegate = globals_->system_network_delegate.get(); | 743 system_params.network_delegate = globals_->system_network_delegate.get(); |
| 729 system_params.net_log = net_log_; | 744 system_params.net_log = net_log_; |
| 730 globals_->system_http_transaction_factory.reset( | 745 globals_->system_http_transaction_factory.reset( |
| 731 new net::HttpNetworkLayer( | 746 new net::HttpNetworkLayer( |
| 732 new net::HttpNetworkSession(system_params))); | 747 new net::HttpNetworkSession(system_params))); |
| 733 globals_->system_ftp_transaction_factory.reset( | 748 globals_->system_ftp_transaction_factory.reset( |
| 734 new net::FtpNetworkLayer(globals_->host_resolver.get())); | 749 new net::FtpNetworkLayer(globals_->host_resolver.get())); |
| 735 globals_->system_request_context = | 750 globals_->system_request_context = |
| 736 ConstructSystemRequestContext(globals_, net_log_); | 751 ConstructSystemRequestContext(globals_, net_log_); |
| 737 } | 752 } |
| OLD | NEW |