Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1470)

Unified Diff: net/proxy/proxy_resolver_v8.h

Issue 11885009: Improve performance of proxy resolver by tracing DNS dependencies. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: whitespace changes Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/proxy/proxy_resolver_v8.h
diff --git a/net/proxy/proxy_resolver_v8.h b/net/proxy/proxy_resolver_v8.h
index c00bb8a4b2465e57ef49f8baa375a87dc61935c8..759ffbe2d508e212fb0c5cb9d68191f6dd350244 100644
--- a/net/proxy/proxy_resolver_v8.h
+++ b/net/proxy/proxy_resolver_v8.h
@@ -12,8 +12,6 @@
namespace net {
-class ProxyResolverJSBindings;
-
// Implementation of ProxyResolver that uses V8 to evaluate PAC scripts.
//
// ----------------------------------------------------------------------------
@@ -34,14 +32,43 @@ class ProxyResolverJSBindings;
// and does not use locking since it expects to be alone.
class NET_EXPORT_PRIVATE ProxyResolverV8 : public ProxyResolver {
public:
- // Constructs a ProxyResolverV8 with custom bindings. ProxyResolverV8 takes
- // ownership of |custom_js_bindings| and deletes it when ProxyResolverV8
- // is destroyed.
- explicit ProxyResolverV8(ProxyResolverJSBindings* custom_js_bindings);
+ // Interface for the javascript bindings.
+ class NET_EXPORT_PRIVATE JSBindings {
+ public:
+ enum ResolveDnsOperation {
+ DNS_RESOLVE,
+ DNS_RESOLVE_EX,
+ MY_IP_ADDRESS,
+ MY_IP_ADDRESS_EX,
+ NUM_DNS_OPERATIONS,
+ };
+
+ JSBindings() {}
+
+ virtual ~JSBindings() {}
+
+ // Handler for "dnsResolve()", "dnsResolveEx()", "myIpAddress()",
+ // "myIpAddressEx()". Returns true on success and fills |*output| with the
+ // result.
+ virtual bool ResolveDns(const std::string& host,
+ ResolveDnsOperation op,
+ std::string* output) = 0;
+
+ // Handler for "alert(message)"
+ virtual void Alert(const string16& message) = 0;
+
+ // Handler for when an error is encountered. |line_number| may be -1
+ // if a line number is not applicable to this error.
+ virtual void OnError(int line_number, const string16& error) = 0;
+ };
+
+ // Constructs a ProxyResolverV8.
+ ProxyResolverV8();
virtual ~ProxyResolverV8();
- ProxyResolverJSBindings* js_bindings() const { return js_bindings_.get(); }
+ JSBindings* js_bindings() const { return js_bindings_; }
+ void set_js_bindings(JSBindings* js_bindings) { js_bindings_ = js_bindings; }
// ProxyResolver implementation:
virtual int GetProxyForURL(const GURL& url,
@@ -51,11 +78,8 @@ class NET_EXPORT_PRIVATE ProxyResolverV8 : public ProxyResolver {
const BoundNetLog& net_log) OVERRIDE;
virtual void CancelRequest(RequestHandle request) OVERRIDE;
virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE;
- virtual LoadState GetLoadStateThreadSafe(
- RequestHandle request) const OVERRIDE;
virtual void CancelSetPacScript() OVERRIDE;
virtual void PurgeMemory() OVERRIDE;
- virtual void Shutdown() OVERRIDE;
virtual int SetPacScript(
const scoped_refptr<ProxyResolverScriptData>& script_data,
const net::CompletionCallback& /*callback*/) OVERRIDE;
@@ -65,9 +89,11 @@ class NET_EXPORT_PRIVATE ProxyResolverV8 : public ProxyResolver {
// script. It corresponds with the data from the last call to
// SetPacScript().
class Context;
+ friend class Context;
mmenke 2013/01/24 21:06:33 nit: No need to friend an inner class.
eroman 2013/01/25 03:02:01 But I want more friends :( So lonely
+
scoped_ptr<Context> context_;
- scoped_ptr<ProxyResolverJSBindings> js_bindings_;
+ JSBindings* js_bindings_;
DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8);
};

Powered by Google App Engine
This is Rietveld 408576698