summaryrefslogtreecommitdiffstats
path: root/chrome/service/net/service_url_request_context.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-14 19:43:39 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-14 19:43:39 +0000
commita8940f59fdf059ea999792c2782d1c899c95a46f (patch)
tree93edc70dff18a7b367ff7825f7a38575721ea3e3 /chrome/service/net/service_url_request_context.cc
parent0ef39f07d91f7bff93712f95823e5b4738e6ada1 (diff)
downloadchromium_src-a8940f59fdf059ea999792c2782d1c899c95a46f.zip
chromium_src-a8940f59fdf059ea999792c2782d1c899c95a46f.tar.gz
chromium_src-a8940f59fdf059ea999792c2782d1c899c95a46f.tar.bz2
Revert r74728 which reverted r74561 for exposing a ChromeOS bug.
r74561 added a DCHECK to make sure users didn't try to access the ChromeURLRequestContextGetter from the Profile, since the Profile should only be read on the UI thread. ChromeOS apparently tried to access it from another thread, and therefore hit the new DCHECK. I'm relanding without the DCHECK. I'm also eagerly initializing the off the record context getter to prevent the ChromeOS race. ChromeOS should fix that code so the eager initialization isn't necessary. BUG=none TEST=none Review URL: http://codereview.chromium.org/6484041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/net/service_url_request_context.cc')
-rw-r--r--chrome/service/net/service_url_request_context.cc54
1 files changed, 28 insertions, 26 deletions
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<net::HttpNetworkSession> 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()