Chromium Code Reviews| 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> | |
| 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, | |
|
mmenke
2013/01/18 19:59:40
May want to take this as a scoped_ptr, just to mak
eroman
2013/01/25 22:11:39
I gave this a try but didn't much care for the res
mmenke
2013/01/29 20:19:08
Yea, that is more than a little horrifyingly hideo
| |
| 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 friend class Job; | |
| 67 | |
| 68 scoped_ptr<base::Thread> thread_; | |
| 69 scoped_ptr<ProxyResolverV8> v8_resolver_; | |
| 70 | |
| 71 HostResolver* host_resolver_; | |
| 72 scoped_ptr<ProxyResolverErrorObserver> error_observer_; | |
| 73 NetLog* net_log_; | |
| 74 | |
| 75 scoped_refptr<Job> set_pac_script_job_; | |
| 76 }; | |
| 77 | |
| 78 } // namespace net | |
| 79 | |
| 80 #endif // NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ | |
| OLD | NEW |