summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_resolver_v8.h
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-12 00:49:38 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-12 00:49:38 +0000
commit8a00f00ab5d68ffcc998fd04d2ca343af7cdf190 (patch)
treefd464ba49db4271c76c1cf8f769a22120ad631af /net/proxy/proxy_resolver_v8.h
parent77ae132c1bfdd986228b6f1c0d8c63baa441afdf (diff)
downloadchromium_src-8a00f00ab5d68ffcc998fd04d2ca343af7cdf190.zip
chromium_src-8a00f00ab5d68ffcc998fd04d2ca343af7cdf190.tar.gz
chromium_src-8a00f00ab5d68ffcc998fd04d2ca343af7cdf190.tar.bz2
* Avoid doing concurrent DNS resolves of the same hostname in HostResolver.
* Add a 1 minute cache for host resolves. * Refactor HostResolver to handle multiple requests. * Make HostResolver a dependency of URLRequestContext. operate the HostResolver in async mode for proxy resolver (bridging to IO thread). TEST=unittests BUG=13163 Review URL: http://codereview.chromium.org/118100 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_resolver_v8.h')
-rw-r--r--net/proxy/proxy_resolver_v8.h32
1 files changed, 19 insertions, 13 deletions
diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h
index 219560c..3bf2bec 100644
--- a/net/proxy/proxy_resolver_v8.h
+++ b/net/proxy/proxy_resolver_v8.h
@@ -10,8 +10,12 @@
#include "base/scoped_ptr.h"
#include "net/proxy/proxy_resolver.h"
+class MessageLoop;
+
namespace net {
+class HostResolver;
+
// Implementation of ProxyResolver that uses V8 to evaluate PAC scripts.
//
// ----------------------------------------------------------------------------
@@ -32,19 +36,6 @@ namespace net {
// and does not use locking since it expects to be alone.
class ProxyResolverV8 : public ProxyResolver {
public:
- // Constructs a ProxyResolverV8 with default javascript bindings.
- //
- // The default javascript bindings will:
- // - Send script error messages to LOG(INFO)
- // - Send script alert()s to LOG(INFO)
- // - Use the default host mapper to service dnsResolve(), synchronously
- // on the V8 thread.
- //
- // For clients that need more control (for example, sending the script output
- // to a UI widget), use the ProxyResolverV8(JSBindings*) and specify your
- // own bindings.
- ProxyResolverV8();
-
class JSBindings;
// Constructs a ProxyResolverV8 with custom bindings. ProxyResolverV8 takes
@@ -62,6 +53,21 @@ class ProxyResolverV8 : public ProxyResolver {
JSBindings* js_bindings() const { return js_bindings_.get(); }
+ // Creates a default javascript bindings implementation that will:
+ // - Send script error messages to LOG(INFO)
+ // - Send script alert()s to LOG(INFO)
+ // - Use the provided host mapper to service dnsResolve().
+ //
+ // For clients that need more control (for example, sending the script output
+ // to a UI widget), use the ProxyResolverV8(JSBindings*) and specify your
+ // own bindings.
+ //
+ // |host_resolver| will be used in async mode on |host_resolver_loop|. If
+ // |host_resolver_loop| is NULL, then |host_resolver| will be used in sync
+ // mode on the PAC thread.
+ static JSBindings* CreateDefaultBindings(HostResolver* host_resolver,
+ MessageLoop* host_resolver_loop);
+
private:
// Context holds the Javascript state for the most recently loaded PAC
// script. It corresponds with the data from the last call to