summaryrefslogtreecommitdiffstats
path: root/chrome/service/net
diff options
context:
space:
mode:
authorscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 22:49:52 +0000
committerscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 22:49:52 +0000
commitba2e465d364c573b530c3a14c99c2b377e5f626d (patch)
tree6345f9cef85ce55fceaaadbe7a97d2e5b62611b3 /chrome/service/net
parentebe11a5c6f543ed54e7c62c386f8933f954208d8 (diff)
downloadchromium_src-ba2e465d364c573b530c3a14c99c2b377e5f626d.zip
chromium_src-ba2e465d364c573b530c3a14c99c2b377e5f626d.tar.gz
chromium_src-ba2e465d364c573b530c3a14c99c2b377e5f626d.tar.bz2
Revert 76612 - Service process fixes for Linux.
Linux requires that the proxy_config_service be created on the I/O thread. Fortunately, ServiceURLRequestContextGetter was already thread safe ref counted, so we lift creation of that and the (also, fortunately) thread safe ref counted net::ProxyService up to service process initialization time. That created proxy service now gets passed in to the dynamic creation of the ServiceURLRequestContexts. Should have no effect on other platforms. BUG=74226 TEST=Start Chromium on Linux with --enable-cloud-print-proxy, sign in, and examine ~/.config/chromium/Service State. With the fix, Service State properly contains the needed tokens to properly re-launch and be a proxy. Review URL: http://codereview.chromium.org/6602041 TBR=scottbyer@chromium.org Review URL: http://codereview.chromium.org/6606022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76638 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service/net')
-rw-r--r--chrome/service/net/service_url_request_context.cc39
-rw-r--r--chrome/service/net/service_url_request_context.h11
2 files changed, 15 insertions, 35 deletions
diff --git a/chrome/service/net/service_url_request_context.cc b/chrome/service/net/service_url_request_context.cc
index 4f12f54..b09794e 100644
--- a/chrome/service/net/service_url_request_context.cc
+++ b/chrome/service/net/service_url_request_context.cc
@@ -104,12 +104,20 @@ std::string MakeUserAgentForServiceProcess() {
} // namespace
ServiceURLRequestContext::ServiceURLRequestContext(
- const std::string& user_agent,
- net::ProxyService* net_proxy_service) : user_agent_(user_agent) {
+ const std::string& user_agent) : user_agent_(user_agent) {
set_host_resolver(
net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism,
NULL, NULL));
- set_proxy_service(net_proxy_service);
+ DCHECK(g_service_process);
+ // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a
+ // MessageLoopProxy* instead of MessageLoop*.
+ // Also this needs to be created on the UI thread on Linux. Fix this.
+ net::ProxyConfigService * proxy_config_service =
+ net::ProxyService::CreateSystemProxyConfigService(
+ g_service_process->io_thread()->message_loop(),
+ g_service_process->file_thread()->message_loop());
+ 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()));
@@ -156,23 +164,12 @@ ServiceURLRequestContextGetter::ServiceURLRequestContextGetter()
g_service_process->io_thread()->message_loop_proxy()) {
// Build the default user agent.
user_agent_ = MakeUserAgentForServiceProcess();
-
-#if !defined(OS_MACOSX)
- // Create the proxy service now, at initialization time, on the main thread.
- // The Mac needs it created later, on the I/O thread.
- CreateProxyService();
-#endif
}
net::URLRequestContext*
ServiceURLRequestContextGetter::GetURLRequestContext() {
-#if defined(OS_MACOSX)
- if (!proxy_service_)
- CreateProxyService();
-#endif
if (!url_request_context_)
- url_request_context_ = new ServiceURLRequestContext(user_agent_,
- proxy_service_);
+ url_request_context_ = new ServiceURLRequestContext(user_agent_);
return url_request_context_;
}
@@ -182,15 +179,3 @@ ServiceURLRequestContextGetter::GetIOMessageLoopProxy() const {
}
ServiceURLRequestContextGetter::~ServiceURLRequestContextGetter() {}
-
-void ServiceURLRequestContextGetter::CreateProxyService() {
- // TODO(sanjeevr): Change CreateSystemProxyConfigService to accept a
- // MessageLoopProxy* instead of MessageLoop*.
- DCHECK(g_service_process);
- net::ProxyConfigService * proxy_config_service =
- 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);
-}
diff --git a/chrome/service/net/service_url_request_context.h b/chrome/service/net/service_url_request_context.h
index becc21a..7ffda3c 100644
--- a/chrome/service/net/service_url_request_context.h
+++ b/chrome/service/net/service_url_request_context.h
@@ -31,8 +31,7 @@ class MessageLoopProxy;
//
class ServiceURLRequestContext : public net::URLRequestContext {
public:
- explicit ServiceURLRequestContext(const std::string& user_agent,
- net::ProxyService* net_proxy_service);
+ explicit ServiceURLRequestContext(const std::string& user_agent);
// Overridden from net::URLRequestContext:
virtual const std::string& GetUserAgent(const GURL& url) const;
@@ -46,6 +45,8 @@ class ServiceURLRequestContext : public net::URLRequestContext {
class ServiceURLRequestContextGetter : public URLRequestContextGetter {
public:
+ ServiceURLRequestContextGetter();
+
virtual net::URLRequestContext* GetURLRequestContext();
virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const;
@@ -55,18 +56,12 @@ class ServiceURLRequestContextGetter : public URLRequestContextGetter {
std::string user_agent() const {
return user_agent_;
}
-
private:
- friend class ServiceProcess;
- ServiceURLRequestContextGetter();
virtual ~ServiceURLRequestContextGetter();
- void CreateProxyService();
-
std::string user_agent_;
scoped_refptr<net::URLRequestContext> url_request_context_;
scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
- scoped_refptr<net::ProxyService> proxy_service_;
};
#endif // CHROME_SERVICE_NET_SERVICE_URL_REQUEST_CONTEXT_H_