summaryrefslogtreecommitdiffstats
path: root/chrome/service/net/service_url_request_context.cc
diff options
context:
space:
mode:
authorscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-28 17:13:11 +0000
committerscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-28 17:13:11 +0000
commite8c5920f109d136da624f6a31ff80d4967fba7bf (patch)
treef5482f559f98ed667b6084e24a5a71e663dae92b /chrome/service/net/service_url_request_context.cc
parentfc9b931da04e8c2738ad33e0de0b2d9ee09a99fd (diff)
downloadchromium_src-e8c5920f109d136da624f6a31ff80d4967fba7bf.zip
chromium_src-e8c5920f109d136da624f6a31ff80d4967fba7bf.tar.gz
chromium_src-e8c5920f109d136da624f6a31ff80d4967fba7bf.tar.bz2
Fix Linux proxy.
Somewhere along the way, the proxy service creation code got more strict and the fragile earlier fix broke. This is much more correct and consistent across platforms. Create the proxy config service on the UI thread, create the proxy service itself on the IO thread. BUG=none TEST=start up the linux proxy, it works again. Check windows, still works. Check Mac, still works. Review URL: http://codereview.chromium.org/6905046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83350 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.cc43
1 files changed, 15 insertions, 28 deletions
diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc
index 9e876d9..eddbbbf 100644
--- a/chrome/service/net/service_url_request_context.cc
+++ b/chrome/service/net/service_url_request_context.cc
@@ -24,6 +24,7 @@
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_cache.h"
#include "net/http/http_network_session.h"
+#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_service.h"
namespace {
@@ -106,13 +107,14 @@ std::string MakeUserAgentForServiceProcess() {
ServiceURLRequestContext::ServiceURLRequestContext(
const std::string& user_agent,
- net::ProxyService* net_proxy_service)
+ net::ProxyConfigService* net_proxy_config_service)
: user_agent_(user_agent),
ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) {
storage_.set_host_resolver(
net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism,
NULL));
- storage_.set_proxy_service(net_proxy_service);
+ storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver(
+ net_proxy_config_service, 0u, NULL));
storage_.set_cert_verifier(new net::CertVerifier);
storage_.set_dnsrr_resolver(new net::DnsRRResolver);
storage_.set_ftp_transaction_factory(
@@ -157,26 +159,21 @@ ServiceURLRequestContextGetter::ServiceURLRequestContextGetter()
// Build the default user agent.
user_agent_ = MakeUserAgentForServiceProcess();
-#if defined(OS_LINUX)
- // Create the proxy service now, at initialization time, on the main thread,
- // only for Linux, which requires that.
- CreateProxyConfigService();
-#endif
+ // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a
+ // MessageLoopProxy* instead of MessageLoop*.
+ DCHECK(g_service_process);
+ proxy_config_service_.reset(
+ net::ProxyService::CreateSystemProxyConfigService(
+ g_service_process->io_thread()->message_loop(),
+ g_service_process->file_thread()->message_loop()));
}
net::URLRequestContext*
ServiceURLRequestContextGetter::GetURLRequestContext() {
-#if !defined(OS_LINUX)
- if (!proxy_config_service_.get())
- CreateProxyConfigService();
-#endif
- if (!url_request_context_) {
- net::ProxyService* proxy_service =
- net::ProxyService::CreateUsingSystemProxyResolver(
- proxy_config_service_.release(), 0u, NULL);
- url_request_context_ = new ServiceURLRequestContext(user_agent_,
- proxy_service);
- }
+ if (!url_request_context_)
+ url_request_context_ =
+ new ServiceURLRequestContext(user_agent_,
+ proxy_config_service_.release());
return url_request_context_;
}
@@ -186,13 +183,3 @@ ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const {
}
ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {}
-
-void ServiceURLRequestContextGetter::CreateProxyConfigService() {
- // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a
- // MessageLoopProxy* instead of MessageLoop*.
- DCHECK(g_service_process);
- proxy_config_service_.reset(
- net::ProxyService::CreateSystemProxyConfigService(
- g_service_process->io_thread()->message_loop(),
- g_service_process->file_thread()->message_loop()));
-}