summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 21:37:09 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-03 21:37:09 +0000
commit8699534623783eafa2f64a8bfe98c89bb561bb1a (patch)
tree3628efed1646013baa5ccef2ed99e4ba4b12ab3f /chrome/browser/net
parenta514488aafec0dd0eaba9e22e8b5ce0651cff1cd (diff)
downloadchromium_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 'chrome/browser/net')
-rw-r--r--chrome/browser/net/chrome_url_request_context.cc30
1 files changed, 24 insertions, 6 deletions
diff --git a/chrome/browser/net/chrome_url_request_context.cc b/chrome/browser/net/chrome_url_request_context.cc
index 748c497..351107a 100644
--- a/chrome/browser/net/chrome_url_request_context.cc
+++ b/chrome/browser/net/chrome_url_request_context.cc
@@ -21,12 +21,12 @@
#include "net/proxy/proxy_service.h"
#include "webkit/glue/webkit_glue.h"
-// Sets up proxy info if it was specified, otherwise returns NULL. The
-// returned pointer MUST be deleted by the caller if non-NULL.
-static net::ProxyInfo* CreateProxyInfo() {
+// Sets up proxy info if overrides were specified on the command line.
+// Otherwise returns NULL (meaning we should use the system defaults).
+// The caller is responsible for deleting returned pointer.
+static net::ProxyInfo* CreateProxyInfo(const CommandLine& command_line) {
net::ProxyInfo* proxy_info = NULL;
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kProxyServer)) {
proxy_info = new net::ProxyInfo();
const std::wstring& proxy_server =
@@ -37,6 +37,24 @@ static net::ProxyInfo* CreateProxyInfo() {
return proxy_info;
}
+// Create a proxy service according to the options on command line.
+static net::ProxyService* CreateProxyService(URLRequestContext* context,
+ const CommandLine& command_line) {
+ scoped_ptr<net::ProxyInfo> proxy_info(CreateProxyInfo(command_line));
+
+ bool use_v8 = command_line.HasSwitch(switches::kV8ProxyResolver);
+ if (use_v8 && command_line.HasSwitch(switches::kSingleProcess)) {
+ // See the note about V8 multithreading in net/proxy/proxy_resolver_v8.h
+ // to understand why we have this limitation.
+ LOG(ERROR) << "Cannot use V8 Proxy resolver in single process mode.";
+ use_v8 = false; // Fallback to non-v8 implementation.
+ }
+
+ return use_v8 ?
+ net::ProxyService::CreateUsingV8Resolver(proxy_info.get(), context) :
+ net::ProxyService::Create(proxy_info.get());
+}
+
// static
ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginal(
Profile* profile, const FilePath& cookie_store_path,
@@ -44,8 +62,8 @@ ChromeURLRequestContext* ChromeURLRequestContext::CreateOriginal(
DCHECK(!profile->IsOffTheRecord());
ChromeURLRequestContext* context = new ChromeURLRequestContext(profile);
- scoped_ptr<net::ProxyInfo> proxy_info(CreateProxyInfo());
- context->proxy_service_ = net::ProxyService::Create(proxy_info.get());
+ context->proxy_service_ = CreateProxyService(
+ context, *CommandLine::ForCurrentProcess());
net::HttpCache* cache =
new net::HttpCache(context->proxy_service_,