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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..569f0940ee58876470c59255bc6733b82073c9c4 |
| --- /dev/null |
| +++ b/net/proxy/proxy_resolver_v8_tracing.h |
| @@ -0,0 +1,80 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ |
| +#define NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ |
| + |
| +#include <deque> |
| +#include <vector> |
| + |
| +#include "base/basictypes.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| +#include "base/threading/non_thread_safe.h" |
| +#include "net/base/net_export.h" |
| +#include "net/proxy/proxy_resolver.h" |
| + |
| +namespace base { |
| +class Thread; |
| +class MessageLoopProxy; |
| +} // namespace base |
| + |
| +namespace net { |
| + |
| +class HostResolver; |
| +class NetLog; |
| +class ProxyResolverErrorObserver; |
| +class ProxyResolverV8; |
| + |
| +// ProxyResolverV8Tracing is a non-blocking ProxyResolver. It executes |
| +// ProxyResolverV8 on a single helper thread, and does some magic to avoid |
| +// 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_PRIVATE ProxyResolverV8Tracing |
| + : public ProxyResolver, |
| + NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| + public: |
| + // Constructs a ProxyResolver that will issue DNS requests through |
| + // |host_resolver|, forward Javascript errors through |error_observer|, and |
| + // log Javascript errors and alerts to |net_log|. |
| + // |
| + // Note that the constructor takes ownership of |error_observer|, whereas |
| + // |host_resolver| and |net_log| are expected to outlive |this|. |
| + ProxyResolverV8Tracing(HostResolver* host_resolver, |
| + 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
|
| + NetLog* net_log); |
| + |
| + virtual ~ProxyResolverV8Tracing(); |
| + |
| + // ProxyResolver implementation: |
| + virtual int GetProxyForURL(const GURL& url, |
| + ProxyInfo* results, |
| + const CompletionCallback& callback, |
| + RequestHandle* request, |
| + const BoundNetLog& net_log) OVERRIDE; |
| + virtual void CancelRequest(RequestHandle request) OVERRIDE; |
| + virtual LoadState GetLoadState(RequestHandle request) const OVERRIDE; |
| + virtual void CancelSetPacScript() OVERRIDE; |
| + virtual void PurgeMemory() OVERRIDE; |
| + virtual int SetPacScript( |
| + const scoped_refptr<ProxyResolverScriptData>& script_data, |
| + const CompletionCallback& callback) OVERRIDE; |
| + |
| + private: |
| + class Job; |
| + friend class Job; |
| + |
| + scoped_ptr<base::Thread> thread_; |
| + scoped_ptr<ProxyResolverV8> v8_resolver_; |
| + |
| + HostResolver* host_resolver_; |
| + scoped_ptr<ProxyResolverErrorObserver> error_observer_; |
| + NetLog* net_log_; |
| + |
| + scoped_refptr<Job> set_pac_script_job_; |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_ |