OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SERVICE_V8_H_ | 5 #ifndef NET_PROXY_PROXY_SERVICE_V8_H_ |
6 #define NET_PROXY_PROXY_SERVICE_V8_H_ | 6 #define NET_PROXY_PROXY_SERVICE_V8_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "net/base/net_export.h" | 9 #include "net/base/net_export.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 class DhcpProxyScriptFetcher; | 13 class DhcpProxyScriptFetcher; |
14 class HostResolver; | 14 class HostResolver; |
15 class NetLog; | 15 class NetLog; |
16 class NetworkDelegate; | 16 class NetworkDelegate; |
17 class ProxyConfigService; | 17 class ProxyConfigService; |
18 class ProxyScriptFetcher; | 18 class ProxyScriptFetcher; |
19 class ProxyService; | 19 class ProxyService; |
20 | 20 |
21 // Creates a proxy service that polls |proxy_config_service| to notice when | 21 // Creates a proxy service that polls |proxy_config_service| to notice when |
22 // the proxy settings change. We take ownership of |proxy_config_service|. | 22 // the proxy settings change. We take ownership of |proxy_config_service|. |
23 // | 23 // |
24 // |num_pac_threads| specifies the maximum number of threads to use for | |
25 // executing PAC scripts. Threads are created lazily on demand. | |
26 // If |0| is specified, then a default number of threads will be selected. | |
27 // | |
28 // Having more threads avoids stalling proxy resolve requests when the | |
29 // PAC script takes a while to run. This is particularly a problem when PAC | |
30 // scripts do synchronous DNS resolutions, since that can take on the order | |
31 // of seconds. | |
32 // | |
33 // However, the disadvantages of using more than 1 thread are: | |
34 // (a) can cause compatibility issues for scripts that rely on side effects | |
35 // between runs (such scripts should not be common though). | |
36 // (b) increases the memory used by proxy resolving, as each thread will | |
37 // duplicate its own script context. | |
38 | |
39 // |proxy_script_fetcher| specifies the dependency to use for downloading | 24 // |proxy_script_fetcher| specifies the dependency to use for downloading |
40 // any PAC scripts. The resulting ProxyService will take ownership of it. | 25 // any PAC scripts. The resulting ProxyService will take ownership of it. |
41 // | 26 // |
42 // |dhcp_proxy_script_fetcher| specifies the dependency to use for attempting | 27 // |dhcp_proxy_script_fetcher| specifies the dependency to use for attempting |
43 // to retrieve the most appropriate PAC script configured in DHCP. The | 28 // to retrieve the most appropriate PAC script configured in DHCP. The |
44 // resulting ProxyService will take ownership of it. | 29 // resulting ProxyService will take ownership of it. |
45 // | 30 // |
46 // |host_resolver| points to the host resolving dependency the PAC script | 31 // |host_resolver| points to the host resolving dependency the PAC script |
47 // should use for any DNS queries. It must remain valid throughout the | 32 // should use for any DNS queries. It must remain valid throughout the |
48 // lifetime of the ProxyService. | 33 // lifetime of the ProxyService. |
49 // | 34 // |
50 // ########################################################################## | 35 // ########################################################################## |
51 // # See the warnings in net/proxy/proxy_resolver_v8.h describing the | 36 // # See the warnings in net/proxy/proxy_resolver_v8.h describing the |
52 // # multi-threading model. In order for this to be safe to use, *ALL* the | 37 // # multi-threading model. In order for this to be safe to use, *ALL* the |
53 // # other V8's running in the process must use v8::Locker. | 38 // # other V8's running in the process must use v8::Locker. |
54 // ########################################################################## | 39 // ########################################################################## |
55 NET_EXPORT ProxyService* CreateProxyServiceUsingV8ProxyResolver( | 40 NET_EXPORT ProxyService* CreateProxyServiceUsingV8ProxyResolver( |
56 ProxyConfigService* proxy_config_service, | 41 ProxyConfigService* proxy_config_service, |
57 size_t num_pac_threads, | |
58 ProxyScriptFetcher* proxy_script_fetcher, | 42 ProxyScriptFetcher* proxy_script_fetcher, |
59 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher, | 43 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher, |
60 HostResolver* host_resolver, | 44 HostResolver* host_resolver, |
61 NetLog* net_log, | 45 NetLog* net_log, |
62 NetworkDelegate* network_delegate); | 46 NetworkDelegate* network_delegate); |
63 | 47 |
64 } // namespace net | 48 } // namespace net |
65 | 49 |
66 #endif // NET_PROXY_PROXY_SERVICE_V8_H_ | 50 #endif // NET_PROXY_PROXY_SERVICE_V8_H_ |
OLD | NEW |