summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_service.h
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 06:33:31 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 06:33:31 +0000
commitbe180c8044f145310f9eb13fd2cab5fd20e88220 (patch)
tree707ac9f3f95f5191664dbdac2ff3f34ab08ad8e7 /net/proxy/proxy_service.h
parent4cb1d3be9986c105608991f3dde12c6346335060 (diff)
downloadchromium_src-be180c8044f145310f9eb13fd2cab5fd20e88220.zip
chromium_src-be180c8044f145310f9eb13fd2cab5fd20e88220.tar.gz
chromium_src-be180c8044f145310f9eb13fd2cab5fd20e88220.tar.bz2
Move initialization of ChromeURLRequestContexts to the IO thread.
Before, these URLRequestContexts were lazily created from the UI thread. Unfortunately that model made it easy for consumers on the UI thread to poke at stuff which was being used from the IO thread, and introduce races. So instead of providing a URLRequestContext*, the Profile now vends a URLRequestContextGetter*. The consequence of this is: * Consumers on the UI thread can no longer get access to a URLRequestContext. * Consumers on the IO thread need to call URLRequestContextGetter::GetURLRequestContext() to get at the context. This uses the same style lazy-creation of URLRequestContexts, albeit from the IO thread. OK, so now the smelly part: There were a couple of consumers of URLRequestContext on the UI thread that can't easily be moved to the IO thread -- these are the consumers of the cookie store. Before they could happily mess with the cookie store from the UI thread, and this was fine since CookieStore is threadsafe. However under the new model, they have no way to get at the URLRequestContext from the UI thread, hence can't get a pointer to the cookie store. To support that use-cases, I bastardized the API some by adding a URLRequestContextGetter::GetCookieStore() method that lets UI thread consumers get a pointer to the cookie store, since we know this particular cross-thread usage is safe. BUG=http://crbug.com/22294 Review URL: http://codereview.chromium.org/258008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29880 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service.h')
-rw-r--r--net/proxy/proxy_service.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index c5c4516..d7ed7ab 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -120,29 +120,25 @@ class ProxyService : public base::RefCountedThreadSafe<ProxyService> {
return config_;
}
- // Creates a proxy service using the specified settings. If |pc| is NULL then
- // the system's default proxy settings will be used (on Windows this will
- // use IE's settings).
+ // Creates a proxy service that polls |proxy_config_service| to notice when
+ // the proxy settings change. We take ownership of |proxy_config_service|.
// Iff |use_v8_resolver| is true, then the V8 implementation is
// used.
// |url_request_context| is only used when use_v8_resolver is true:
// it specifies the URL request context that will be used if a PAC
// script needs to be fetched.
// |io_loop| points to the IO thread's message loop. It is only used
- // when pc is NULL. If both pc and io_loop are NULL, then monitoring
- // of proxy setting changes will be disabled in ProxyConfigServiceLinux.
- // |file_loop| points to the file thread's message loop. It is used
- // to read any files necessary to get proxy settings.
+ // when pc is NULL.
// ##########################################################################
// # See the warnings in net/proxy/proxy_resolver_v8.h describing the
// # multi-threading model. In order for this to be safe to use, *ALL* the
// # other V8's running in the process must use v8::Locker.
// ##########################################################################
static ProxyService* Create(
- const ProxyConfig* pc,
+ ProxyConfigService* proxy_config_service,
bool use_v8_resolver,
URLRequestContext* url_request_context,
- MessageLoop* io_loop, MessageLoop* file_loop);
+ MessageLoop* io_loop);
// Convenience method that creates a proxy service using the
// specified fixed settings. |pc| must not be NULL.
@@ -152,6 +148,11 @@ class ProxyService : public base::RefCountedThreadSafe<ProxyService> {
// so it falls back to direct connect.
static ProxyService* CreateNull();
+ // Creates a config service appropriate for this platform that fetches the
+ // system proxy settings.
+ static ProxyConfigService* CreateSystemProxyConfigService(
+ MessageLoop* io_loop, MessageLoop* file_loop);
+
private:
FRIEND_TEST(ProxyServiceTest, IsLocalName);
FRIEND_TEST(ProxyServiceTest, UpdateConfigAfterFailedAutodetect);
@@ -163,11 +164,6 @@ class ProxyService : public base::RefCountedThreadSafe<ProxyService> {
// which expects requests to finish in the order they were added.
typedef std::vector<scoped_refptr<PacRequest> > PendingRequests;
- // Creates a config service appropriate for this platform that fetches the
- // system proxy settings.
- static ProxyConfigService* CreateSystemProxyConfigService(
- MessageLoop* io_loop, MessageLoop* file_loop);
-
// Creates a proxy resolver appropriate for this platform that doesn't rely
// on V8.
static ProxyResolver* CreateNonV8ProxyResolver();