Chromium Code Reviews| Index: net/proxy/proxy_resolver_v8_tracing.h |
| diff --git a/net/proxy/proxy_resolver_v8_tracing.h b/net/proxy/proxy_resolver_v8_tracing.h |
| index c2a9de57ad0e93b1602b62f5cf117dbb9bd06834..a27b9f6bdea5bc68a23c0419330b17336dfc41f1 100644 |
| --- a/net/proxy/proxy_resolver_v8_tracing.h |
| +++ b/net/proxy/proxy_resolver_v8_tracing.h |
| @@ -5,8 +5,6 @@ |
| #ifndef NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ |
| #define NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ |
| -#include <set> |
| - |
| #include "base/basictypes.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| @@ -17,50 +15,78 @@ |
| namespace net { |
| class HostResolver; |
| -class NetLog; |
| -class ProxyResolverErrorObserver; |
| -// ProxyResolverFactoryV8Tracing is a ProxyResolverFactory that returns |
| -// non-blocking ProxyResolver instances. Each ProxyResolver instance executes |
| +// ProxyResolverV8Tracing is a non-blocking ProxyResolver. It executes |
|
eroman
2015/06/05 01:11:47
ProxyResolver --> proxy resolver (no longer implem
Sam McNally
2015/06/23 00:32:46
Done.
|
| // ProxyResolverV8 on a single helper thread, and does some magic to avoid |
|
eroman
2015/06/05 01:11:47
This comment reads strangely now, since this is no
Sam McNally
2015/06/23 00:32:46
Done.
|
| // blocking in DNS. For more details see the design document: |
| // https://docs.google.com/a/google.com/document/d/16Ij5OcVnR3s0MH4Z5XkhI9VTPoMJdaBn9rKreAmGOdE/edit?pli=1 |
| -class NET_EXPORT ProxyResolverFactoryV8Tracing : public ProxyResolverFactory { |
| +class NET_EXPORT ProxyResolverV8Tracing { |
| public: |
| - // Note that |host_resolver| and |net_log| are expected to outlive |this| and |
| - // any ProxyResolver instances created using |this|. |error_observer_factory| |
| - // will be invoked once per CreateProxyResolver() call to create a |
| - // ProxyResolverErrorObserver to be used by the ProxyResolver instance |
| - // returned by that call. |
| - ProxyResolverFactoryV8Tracing( |
| - HostResolver* host_resolver, |
| - NetLog* net_log, |
| - const ProxyResolver::LoadStateChangedCallback& callback, |
| - const base::Callback<scoped_ptr<ProxyResolverErrorObserver>()>& |
| - error_observer_factory); |
| - ~ProxyResolverFactoryV8Tracing() override; |
| - |
| - // ProxyResolverFactory override. |
| - int CreateProxyResolver( |
| - const scoped_refptr<ProxyResolverScriptData>& pac_script, |
| - scoped_ptr<ProxyResolver>* resolver, |
| - const CompletionCallback& callback, |
| - scoped_ptr<Request>* request) override; |
| + class Bindings { |
| + public: |
| + Bindings() {} |
| + virtual ~Bindings() {} |
|
eroman
2015/06/05 01:11:47
It would also be useful to give some comments on w
Sam McNally
2015/06/23 00:32:46
Done.
|
| - private: |
| - class CreateJob; |
| + // Invoked in response to an alert() call by the PAC script. This may be |
| + // called after cancellation and from any thread. |
| + virtual void Alert(const base::string16& message) = 0; |
| + |
| + // Invoked in response to an error in the PAC script. This may be |
| + // called after cancellation and from any thread. |
| + virtual void OnError(int line_number, const base::string16& message) = 0; |
| - void RemoveJob(CreateJob* job); |
| + // Returns a HostResolver to use for DNS resolution. This will only be |
| + // called from the origin thread and will never be called after |
| + // cancellation. |
| + virtual HostResolver* GetHostResolver() = 0; |
| - HostResolver* const host_resolver_; |
| - NetLog* const net_log_; |
| - const ProxyResolver::LoadStateChangedCallback load_state_changed_callback_; |
| - const base::Callback<scoped_ptr<ProxyResolverErrorObserver>()> |
| - error_observer_factory_; |
| + // Returns a BoundNetLog to be passed to the HostResolver returned by |
| + // GetHostResolver(). This will only be called from the origin thread and |
| + // will never be called after cancellation. |
| + virtual BoundNetLog GetBoundNetLog() = 0; |
| - std::set<CreateJob*> jobs_; |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Bindings); |
| + }; |
| - DISALLOW_COPY_AND_ASSIGN(ProxyResolverFactoryV8Tracing); |
| + virtual ~ProxyResolverV8Tracing() {} |
| + |
| + // Gets a list of proxy servers to use for |url|. This request always |
| + // runs asynchronously and notifies the result by running |callback|. If the |
| + // result code is OK then the request was successful and |results| contains |
| + // the proxy resolution information. If |request| is non-null, |*request| is |
| + // written to, and can be passed to CancelRequest(). |
| + virtual void GetProxyForURL(const GURL& url, |
| + ProxyInfo* results, |
| + const CompletionCallback& callback, |
| + ProxyResolver::RequestHandle* request, |
| + scoped_ptr<Bindings> bindings) = 0; |
| + |
| + // Cancels |request|. |
| + virtual void CancelRequest(ProxyResolver::RequestHandle request) = 0; |
| + |
| + // Gets the LoadState for |request|. |
| + virtual LoadState GetLoadState( |
| + ProxyResolver::RequestHandle request) const = 0; |
| +}; |
| + |
| +// A factory for ProxyResolverV8Tracing instances. |
| +class NET_EXPORT ProxyResolverV8TracingFactory { |
| + public: |
| + ProxyResolverV8TracingFactory() {} |
| + virtual ~ProxyResolverV8TracingFactory() = default; |
| + |
| + virtual void CreateProxyResolverV8Tracing( |
| + const scoped_refptr<ProxyResolverScriptData>& pac_script, |
| + scoped_ptr<ProxyResolverV8Tracing::Bindings> bindings, |
| + scoped_ptr<ProxyResolverV8Tracing>* resolver, |
| + const CompletionCallback& callback, |
| + scoped_ptr<ProxyResolverFactory::Request>* request) = 0; |
| + |
| + static scoped_ptr<ProxyResolverV8TracingFactory> Create(); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8TracingFactory); |
| }; |
| } // namespace net |