proxy_service_v8.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
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#include "net/base/net_export.h" 10 11namespace net { 12 13class DhcpProxyScriptFetcher; 14class HostResolver; 15class NetLog; 16class NetworkDelegate; 17class ProxyConfigService; 18class ProxyScriptFetcher; 19class ProxyService; 20 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|. 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 40// any PAC scripts. The resulting ProxyService will take ownership of it. 41// 42// |dhcp_proxy_script_fetcher| specifies the dependency to use for attempting 43// to retrieve the most appropriate PAC script configured in DHCP. The 44// resulting ProxyService will take ownership of it. 45// 46// |host_resolver| points to the host resolving dependency the PAC script 47// should use for any DNS queries. It must remain valid throughout the 48// lifetime of the ProxyService. 49// 50// ########################################################################## 51// # 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 53// # other V8's running in the process must use v8::Locker. 54// ########################################################################## 55NET_EXPORT ProxyService* CreateProxyServiceUsingV8ProxyResolver( 56 ProxyConfigService* proxy_config_service, 57 size_t num_pac_threads, 58 ProxyScriptFetcher* proxy_script_fetcher, 59 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher, 60 HostResolver* host_resolver, 61 NetLog* net_log, 62 NetworkDelegate* network_delegate); 63 64} // namespace net 65 66#endif // NET_PROXY_PROXY_SERVICE_V8_H_ 67