Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Side by Side Diff: net/proxy/proxy_resolver_v8_tracing.h

Issue 11885009: Improve performance of proxy resolver by tracing DNS dependencies. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: whitespace changes Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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,
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 scoped_ptr<base::Thread> thread_;
68 scoped_ptr<ProxyResolverV8> v8_resolver_;
69
70 HostResolver* host_resolver_;
71 scoped_ptr<ProxyResolverErrorObserver> error_observer_;
72 NetLog* net_log_;
73
74 scoped_refptr<Job> set_pac_script_job_;
75 };
76
77 } // namespace net
78
79 #endif // NET_PROXY_PROXY_RESOLVER_V8_TRACING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698