OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ | 5 #ifndef NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ |
6 #define NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ | 6 #define NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "net/base/net_export.h" | 11 #include "net/base/net_export.h" |
12 #include "net/proxy/proxy_resolver.h" | 12 #include "net/proxy/proxy_resolver.h" |
13 #include "net/proxy/proxy_resolver_factory.h" | 13 #include "net/proxy/proxy_resolver_factory.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 class HostResolver; | 17 class HostResolver; |
18 | 18 |
19 // ProxyResolverV8Tracing is a non-blocking proxy resolver. | 19 // ProxyResolverV8Tracing is a non-blocking proxy resolver. |
20 class NET_EXPORT ProxyResolverV8Tracing { | 20 class NET_EXPORT ProxyResolverV8Tracing { |
21 public: | 21 public: |
22 class Request : public ProxyResolver::Request {}; | |
eroman
2016/02/24 03:08:07
Why is this needed? Can it just be declared in the
| |
22 // Bindings is an interface used by ProxyResolverV8Tracing to delegate | 23 // Bindings is an interface used by ProxyResolverV8Tracing to delegate |
23 // per-request functionality. Each instance will be destroyed on the origin | 24 // per-request functionality. Each instance will be destroyed on the origin |
24 // thread of the ProxyResolverV8Tracing when the request completes or is | 25 // thread of the ProxyResolverV8Tracing when the request completes or is |
25 // cancelled. All methods will be invoked from the origin thread. | 26 // cancelled. All methods will be invoked from the origin thread. |
26 class Bindings { | 27 class Bindings { |
27 public: | 28 public: |
28 Bindings() {} | 29 Bindings() {} |
29 virtual ~Bindings() {} | 30 virtual ~Bindings() {} |
30 | 31 |
31 // Invoked in response to an alert() call by the PAC script. | 32 // Invoked in response to an alert() call by the PAC script. |
(...skipping 12 matching lines...) Expand all Loading... | |
44 private: | 45 private: |
45 DISALLOW_COPY_AND_ASSIGN(Bindings); | 46 DISALLOW_COPY_AND_ASSIGN(Bindings); |
46 }; | 47 }; |
47 | 48 |
48 virtual ~ProxyResolverV8Tracing() {} | 49 virtual ~ProxyResolverV8Tracing() {} |
49 | 50 |
50 // Gets a list of proxy servers to use for |url|. This request always | 51 // Gets a list of proxy servers to use for |url|. This request always |
51 // runs asynchronously and notifies the result by running |callback|. If the | 52 // runs asynchronously and notifies the result by running |callback|. If the |
52 // result code is OK then the request was successful and |results| contains | 53 // result code is OK then the request was successful and |results| contains |
53 // the proxy resolution information. If |request| is non-null, |*request| is | 54 // the proxy resolution information. If |request| is non-null, |*request| is |
54 // written to, and can be passed to CancelRequest(). | 55 // written to, and can be passed to CancelRequest(). |
eroman
2016/02/24 03:08:07
Please update the comment referencing CancelReques
| |
55 virtual void GetProxyForURL(const GURL& url, | 56 virtual void GetProxyForURL(const GURL& url, |
56 ProxyInfo* results, | 57 ProxyInfo* results, |
57 const CompletionCallback& callback, | 58 const CompletionCallback& callback, |
58 ProxyResolver::RequestHandle* request, | 59 scoped_ptr<ProxyResolver::Request>* request, |
59 scoped_ptr<Bindings> bindings) = 0; | 60 scoped_ptr<Bindings> bindings) = 0; |
60 | |
61 // Cancels |request|. | |
62 virtual void CancelRequest(ProxyResolver::RequestHandle request) = 0; | |
63 | |
64 // Gets the LoadState for |request|. | |
65 virtual LoadState GetLoadState( | |
66 ProxyResolver::RequestHandle request) const = 0; | |
67 }; | 61 }; |
68 | 62 |
69 // A factory for ProxyResolverV8Tracing instances. The default implementation, | 63 // A factory for ProxyResolverV8Tracing instances. The default implementation, |
70 // returned by Create(), creates ProxyResolverV8Tracing instances that execute | 64 // returned by Create(), creates ProxyResolverV8Tracing instances that execute |
71 // ProxyResolverV8 on a single helper thread, and do some magic to avoid | 65 // ProxyResolverV8 on a single helper thread, and do some magic to avoid |
72 // blocking in DNS. For more details see the design document: | 66 // blocking in DNS. For more details see the design document: |
73 // https://docs.google.com/a/google.com/document/d/16Ij5OcVnR3s0MH4Z5XkhI9VTPoMJ daBn9rKreAmGOdE/edit?pli=1 | 67 // https://docs.google.com/a/google.com/document/d/16Ij5OcVnR3s0MH4Z5XkhI9VTPoMJ daBn9rKreAmGOdE/edit?pli=1 |
74 class NET_EXPORT ProxyResolverV8TracingFactory { | 68 class NET_EXPORT ProxyResolverV8TracingFactory { |
75 public: | 69 public: |
76 ProxyResolverV8TracingFactory() {} | 70 ProxyResolverV8TracingFactory() {} |
77 virtual ~ProxyResolverV8TracingFactory() = default; | 71 virtual ~ProxyResolverV8TracingFactory() = default; |
78 | 72 |
79 virtual void CreateProxyResolverV8Tracing( | 73 virtual void CreateProxyResolverV8Tracing( |
80 const scoped_refptr<ProxyResolverScriptData>& pac_script, | 74 const scoped_refptr<ProxyResolverScriptData>& pac_script, |
81 scoped_ptr<ProxyResolverV8Tracing::Bindings> bindings, | 75 scoped_ptr<ProxyResolverV8Tracing::Bindings> bindings, |
82 scoped_ptr<ProxyResolverV8Tracing>* resolver, | 76 scoped_ptr<ProxyResolverV8Tracing>* resolver, |
83 const CompletionCallback& callback, | 77 const CompletionCallback& callback, |
84 scoped_ptr<ProxyResolverFactory::Request>* request) = 0; | 78 scoped_ptr<ProxyResolverFactory::Request>* request) = 0; |
85 | 79 |
86 static scoped_ptr<ProxyResolverV8TracingFactory> Create(); | 80 static scoped_ptr<ProxyResolverV8TracingFactory> Create(); |
87 | 81 |
88 private: | 82 private: |
89 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8TracingFactory); | 83 DISALLOW_COPY_AND_ASSIGN(ProxyResolverV8TracingFactory); |
90 }; | 84 }; |
91 | 85 |
92 } // namespace net | 86 } // namespace net |
93 | 87 |
94 #endif // NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ | 88 #endif // NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ |
OLD | NEW |