OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ | |
6 #define NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ | |
7 | |
8 #include <deque> | |
9 #include <vector> | |
mmenke
2013/01/29 20:19:08
Neither of these is used in thsi file.
eroman
2013/01/29 22:51:23
Done.
| |
10 | |
11 #include "base/basictypes.h" | |
12 #include "base/memory/ref_counted.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/threading/non_thread_safe.h" | |
15 #include "net/base/net_export.h" | |
16 #include "net/proxy/proxy_resolver.h" | |
17 | |
18 namespace base { | |
19 class Thread; | |
20 class MessageLoopProxy; | |
21 } // namespace base | |
22 | |
23 namespace net { | |
24 | |
25 class HostResolver; | |
26 class NetLog; | |
27 class ProxyResolverErrorObserver; | |
28 class ProxyResolverV8; | |
29 | |
30 // ProxyResolverV8Tracing is a non-blocking ProxyResolver. It executes | |
31 // ProxyResolverV8 on a single helper thread, and does some magic to avoid | |
32 // blocking in DNS. For more details see the design document: | |
33 // https://docs.google.com/a/google.com/document/d/16Ij5OcVnR3s0MH4Z5XkhI9VTPoMJ daBn9rKreAmGOdE/edit?pli=1 | |
34 class NET_EXPORT_PRIVATE ProxyResolverV8Tracing | |
35 : public ProxyResolver, | |
36 NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
37 public: | |
38 // Constructs a ProxyResolver that will issue DNS requests through | |
39 // |host_resolver|, forward Javascript errors through |error_observer|, and | |
40 // log Javascript errors and alerts to |net_log|. | |
41 // | |
42 // Note that the constructor takes ownership of |error_observer|, whereas | |
43 // |host_resolver| and |net_log| are expected to outlive |this|. | |
44 ProxyResolverV8Tracing(HostResolver* host_resolver, | |
45 ProxyResolverErrorObserver* error_observer, | |
46 NetLog* net_log); | |
47 | |
48 virtual ~ProxyResolverV8Tracing(); | |
49 | |
50 // ProxyResolver implementation: | |
51 virtual int GetProxyForURL(const GURL& url, | |
52 ProxyInfo* results, | |
53 const CompletionCallback& callback, | |
54 RequestHandle* request, | |
55 const BoundNetLog& net_log) OVERRIDE; | |
56 virtual void CancelRequest(RequestHandle request) OVERRIDE; | |
57 virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; | |
58 virtual void CancelSetPacScript() OVERRIDE; | |
59 virtual void PurgeMemory() OVERRIDE; | |
60 virtual int SetPacScript( | |
61 const scoped_refptr<ProxyResolverScriptData>& script_data, | |
62 const CompletionCallback& callback) OVERRIDE; | |
63 | |
64 private: | |
65 class Job; | |
66 | |
67 // The worker thread on which the ProxyResolverV8 will be run. | |
68 scoped_ptr<base::Thread> thread_; | |
69 scoped_ptr<ProxyResolverV8> v8_resolver_; | |
70 | |
71 // Non-owned host resolver, which is to be operated on the origin thread. | |
72 HostResolver* host_resolver_; | |
73 | |
74 scoped_ptr<ProxyResolverErrorObserver> error_observer_; | |
75 NetLog* net_log_; | |
76 | |
77 // The outstanding SetPacScript operation, or NULL. | |
78 scoped_refptr<Job> set_pac_script_job_; | |
79 | |
80 // The number of outstanding (non-cancelled) jobs. | |
81 int num_outstanding_callbacks_; | |
mmenke
2013/01/29 20:19:08
DISALLOW_COPY_AND_ASSIGN, and add the correspoding
eroman
2013/01/29 22:51:23
Done.
| |
82 }; | |
83 | |
84 } // namespace net | |
85 | |
86 #endif // NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ | |
OLD | NEW |