From f40061ba0477aff1326f71d663748d6359c48a19 Mon Sep 17 00:00:00 2001 From: "willchan@chromium.org" Date: Fri, 11 Feb 2011 03:39:54 +0000 Subject: Introduce OffTheRecordProfileIOData and ProfileImplIOData. They both inherit from ProfileIOData. The former is for the off the record (incognito) profile. The latter is for the normal ProfileImpl profile. All of the IO related Profile objects are now initialized at the same time, in the subtype implementations of ProfileIOData::LazyInitializeInternal(). I also took this opportunity to clean URLRequestContext up so it is a class and keeps its member variables private. This required touching a fair number of files. TODO: Remove lots of the refcounting of member variables, since they can now be owned by ProfileIOData. BUG=67237 TEST=none Review URL: http://codereview.chromium.org/6286133 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74561 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/service/net/service_url_request_context.cc | 54 ++++++++++++----------- 1 file changed, 28 insertions(+), 26 deletions(-) (limited to 'chrome/service/net/service_url_request_context.cc') diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc index e5d75cc..b09794e 100644 --- a/chrome/service/net/service_url_request_context.cc +++ b/chrome/service/net/service_url_request_context.cc @@ -105,9 +105,9 @@ std::string MakeUserAgentForServiceProcess() { ServiceURLRequestContext::ServiceURLRequestContext( const std::string& user_agent) : user_agent_(user_agent) { - host_resolver_ = + set_host_resolver( net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism, - NULL, NULL); + NULL, NULL)); DCHECK(g_service_process); // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a // MessageLoopProxy* instead of MessageLoop*. @@ -116,29 +116,30 @@ ServiceURLRequestContext::ServiceURLRequestContext( net::ProxyService::CreateSystemProxyConfigService( g_service_process->io_thread()->message_loop(), g_service_process->file_thread()->message_loop()); - proxy_service_ = net::ProxyService::CreateUsingSystemProxyResolver( - proxy_config_service, 0u, NULL); - cert_verifier_ = new net::CertVerifier; - dnsrr_resolver_ = new net::DnsRRResolver; - ftp_transaction_factory_ = new net::FtpNetworkLayer(host_resolver_); - ssl_config_service_ = new net::SSLConfigServiceDefaults; - http_auth_handler_factory_ = net::HttpAuthHandlerFactory::CreateDefault( - host_resolver_); + set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver( + proxy_config_service, 0u, NULL)); + set_cert_verifier(new net::CertVerifier); + set_dnsrr_resolver(new net::DnsRRResolver); + set_ftp_transaction_factory(new net::FtpNetworkLayer(host_resolver())); + set_ssl_config_service(new net::SSLConfigServiceDefaults); + set_http_auth_handler_factory(net::HttpAuthHandlerFactory::CreateDefault( + host_resolver())); net::HttpNetworkSession::Params session_params; - session_params.host_resolver = host_resolver_; - session_params.cert_verifier = cert_verifier_; - session_params.dnsrr_resolver = dnsrr_resolver_; - session_params.proxy_service = proxy_service_; - session_params.ssl_config_service = ssl_config_service_; + session_params.host_resolver = host_resolver(); + session_params.cert_verifier = cert_verifier(); + session_params.dnsrr_resolver = dnsrr_resolver(); + session_params.proxy_service = proxy_service(); + session_params.ssl_config_service = ssl_config_service(); scoped_refptr network_session( new net::HttpNetworkSession(session_params)); - http_transaction_factory_ = new net::HttpCache( - network_session, - net::HttpCache::DefaultBackend::InMemory(0)); + set_http_transaction_factory( + new net::HttpCache( + network_session, + net::HttpCache::DefaultBackend::InMemory(0))); // In-memory cookie store. - cookie_store_ = new net::CookieMonster(NULL, NULL); - accept_language_ = "en-us,fr"; - accept_charset_ = "iso-8859-1,*,utf-8"; + set_cookie_store(new net::CookieMonster(NULL, NULL)); + set_accept_language("en-us,fr"); + set_accept_charset("iso-8859-1,*,utf-8"); } const std::string& ServiceURLRequestContext::GetUserAgent( @@ -150,11 +151,12 @@ const std::string& ServiceURLRequestContext::GetUserAgent( } ServiceURLRequestContext::~ServiceURLRequestContext() { - delete ftp_transaction_factory_; - delete http_transaction_factory_; - delete http_auth_handler_factory_; - delete cert_verifier_; - delete dnsrr_resolver_; + delete ftp_transaction_factory(); + delete http_transaction_factory(); + delete http_auth_handler_factory(); + delete cert_verifier(); + delete dnsrr_resolver(); + delete host_resolver(); } ServiceURLRequestContextGetter::ServiceURLRequestContextGetter() -- cgit v1.1