diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-03 21:37:09 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-03 21:37:09 +0000 |
commit | 8699534623783eafa2f64a8bfe98c89bb561bb1a (patch) | |
tree | 3628efed1646013baa5ccef2ed99e4ba4b12ab3f /net | |
parent | a514488aafec0dd0eaba9e22e8b5ce0651cff1cd (diff) | |
download | chromium_src-8699534623783eafa2f64a8bfe98c89bb561bb1a.zip chromium_src-8699534623783eafa2f64a8bfe98c89bb561bb1a.tar.gz chromium_src-8699534623783eafa2f64a8bfe98c89bb561bb1a.tar.bz2 |
Add a command line flag --v8-proxy-resolver, to select the new PAC implementation.
When running in single process mode, this flag has no effect (since we can't run side by side with the renderer's V8).
In regular mode, the v8 resolver is currently running in the browser process.
This means it has to share with the v8 debugger shell.
Added locking around the debugger shell so they can peacefully co-exist.
When this flag is enabled, PAC scripts are downloaded through the browser.
BUG=74,2764
Review URL: http://codereview.chromium.org/27365
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10827 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/proxy/proxy_service.cc | 33 | ||||
-rw-r--r-- | net/proxy/proxy_service.h | 21 |
2 files changed, 51 insertions, 3 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index 14b60f6..443a46b 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -21,6 +21,7 @@ #include "net/proxy/proxy_resolver_mac.h" #endif #include "net/proxy/proxy_resolver.h" +#include "net/proxy/proxy_resolver_v8.h" using base::TimeDelta; using base::TimeTicks; @@ -214,6 +215,38 @@ ProxyService* ProxyService::Create(const ProxyInfo* pi) { } // static +ProxyService* ProxyService::CreateUsingV8Resolver( + const ProxyInfo* pi, URLRequestContext* url_request_context) { + if (pi) { + // The ProxyResolver is set to NULL, since it should never be called + // (because the configuration will never require PAC). + return new ProxyService(new ProxyConfigServiceFixed(*pi), NULL); + } + + // Choose the system configuration service appropriate for each platform. + ProxyConfigService* config_service; +#if defined(OS_WIN) + config_service = new ProxyConfigServiceWin(); +#elif defined(OS_MACOSX) + config_service = new ProxyConfigServiceMac(); +#else + // TODO(port): implement ProxyConfigServiceLinux. + // See: http://code.google.com/p/chromium/issues/detail?id=8143 + return CreateNull(); +#endif + + // Create a ProxyService that uses V8 to evaluate PAC scripts. + ProxyService* proxy_service = new ProxyService( + config_service, new ProxyResolverV8()); + + // Configure PAC script downloads to be issued using |url_request_context|. + proxy_service->SetProxyScriptFetcher( + ProxyScriptFetcher::Create(url_request_context)); + + return proxy_service; +} + +// static ProxyService* ProxyService::CreateNull() { // The ProxyResolver is set to NULL, since it should never be called // (because the configuration will never require PAC). diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h index 21b0e07..cb1fc91 100644 --- a/net/proxy/proxy_service.h +++ b/net/proxy/proxy_service.h @@ -17,6 +17,7 @@ #include "net/proxy/proxy_info.h" class GURL; +class URLRequestContext; namespace net { @@ -80,17 +81,31 @@ class ProxyService { // Call this method with a non-null |pac_request| to cancel the PAC request. void CancelPacRequest(PacRequest* pac_request); - // Set the ProxyScriptFetcher dependency. This is needed if the ProxyResolver + // Sets the ProxyScriptFetcher dependency. This is needed if the ProxyResolver // is of type ProxyResolverWithoutFetch. ProxyService takes ownership of // |proxy_script_fetcher|. void SetProxyScriptFetcher(ProxyScriptFetcher* proxy_script_fetcher); - // Create a proxy service using the specified settings. If |pi| is NULL then + // Creates a proxy service using the specified settings. If |pi| is NULL then // the system's default proxy settings will be used (on Windows this will // use IE's settings). static ProxyService* Create(const ProxyInfo* pi); - // Create a proxy service that always fails to fetch the proxy configuration, + // Creates a proxy service using the specified settings. If |pi| is NULL then + // the system's default proxy settings will be used. This is basically the + // same as Create(const ProxyInfo*), however under the hood it uses a + // different implementation (V8). |url_request_context| is the URL request + // context that will be used if a PAC script needs to be fetched. + // ########################################################################## + // # 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* CreateUsingV8Resolver( + const ProxyInfo* pi, + URLRequestContext* url_request_context); + + // Creates a proxy service that always fails to fetch the proxy configuration, // so it falls back to direct connect. static ProxyService* CreateNull(); |