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