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

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

Issue 2893005: Change the default number of proxy resolver threads used for evaluating PAC s... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address wtc comments Created 10 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/service/net/service_url_request_context.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_H_ 5 #ifndef NET_PROXY_PROXY_SERVICE_H_
6 #define NET_PROXY_PROXY_SERVICE_H_ 6 #define NET_PROXY_PROXY_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 // Forces refetching the proxy configuration, and applying it. 131 // Forces refetching the proxy configuration, and applying it.
132 // This re-does everything from fetching the system configuration, 132 // This re-does everything from fetching the system configuration,
133 // to downloading and testing the PAC files. 133 // to downloading and testing the PAC files.
134 void ForceReloadProxyConfig(); 134 void ForceReloadProxyConfig();
135 135
136 // Creates a proxy service that polls |proxy_config_service| to notice when 136 // Creates a proxy service that polls |proxy_config_service| to notice when
137 // the proxy settings change. We take ownership of |proxy_config_service|. 137 // the proxy settings change. We take ownership of |proxy_config_service|.
138 // Iff |use_v8_resolver| is true, then the V8 implementation is 138 // Iff |use_v8_resolver| is true, then the V8 implementation is
139 // used. 139 // used.
140 //
141 // |num_pac_threads| specifies the maximum number of threads to use for
142 // executing PAC scripts. Threads are created lazily on demand.
143 // If |0| is specified, then a default number of threads will be selected.
144 //
145 // Having more threads avoids stalling proxy resolve requests when the
146 // PAC script takes a while to run. This is particularly a problem when PAC
147 // scripts do synchronous DNS resolutions, since that can take on the order
148 // of seconds.
149 //
150 // However, the disadvantages of using more than 1 thread are:
151 // (a) can cause compatibility issues for scripts that rely on side effects
152 // between runs (such scripts should not be common though).
153 // (b) increases the memory used by proxy resolving, as each thread will
154 // duplicate its own script context.
155
140 // |url_request_context| is only used when use_v8_resolver is true: 156 // |url_request_context| is only used when use_v8_resolver is true:
141 // it specifies the URL request context that will be used if a PAC 157 // it specifies the URL request context that will be used if a PAC
142 // script needs to be fetched. 158 // script needs to be fetched.
143 // |io_loop| points to the IO thread's message loop. It is only used 159 // |io_loop| points to the IO thread's message loop. It is only used
144 // when pc is NULL. 160 // when pc is NULL.
145 // ########################################################################## 161 // ##########################################################################
146 // # See the warnings in net/proxy/proxy_resolver_v8.h describing the 162 // # See the warnings in net/proxy/proxy_resolver_v8.h describing the
147 // # multi-threading model. In order for this to be safe to use, *ALL* the 163 // # multi-threading model. In order for this to be safe to use, *ALL* the
148 // # other V8's running in the process must use v8::Locker. 164 // # other V8's running in the process must use v8::Locker.
149 // ########################################################################## 165 // ##########################################################################
150 static ProxyService* Create( 166 static ProxyService* Create(
151 ProxyConfigService* proxy_config_service, 167 ProxyConfigService* proxy_config_service,
152 bool use_v8_resolver, 168 bool use_v8_resolver,
169 size_t num_pac_threads,
153 URLRequestContext* url_request_context, 170 URLRequestContext* url_request_context,
154 NetLog* net_log, 171 NetLog* net_log,
155 MessageLoop* io_loop); 172 MessageLoop* io_loop);
156 173
157 // Convenience method that creates a proxy service using the 174 // Convenience method that creates a proxy service using the
158 // specified fixed settings. |pc| must not be NULL. 175 // specified fixed settings. |pc| must not be NULL.
159 static ProxyService* CreateFixed(const ProxyConfig& pc); 176 static ProxyService* CreateFixed(const ProxyConfig& pc);
160 177
161 // Creates a proxy service that always fails to fetch the proxy configuration, 178 // Creates a proxy service that always fails to fetch the proxy configuration,
162 // so it falls back to direct connect. 179 // so it falls back to direct connect.
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 327
311 base::WaitableEvent event_; 328 base::WaitableEvent event_;
312 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; 329 CompletionCallbackImpl<SyncProxyServiceHelper> callback_;
313 ProxyInfo proxy_info_; 330 ProxyInfo proxy_info_;
314 int result_; 331 int result_;
315 }; 332 };
316 333
317 } // namespace net 334 } // namespace net
318 335
319 #endif // NET_PROXY_PROXY_SERVICE_H_ 336 #endif // NET_PROXY_PROXY_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/service/net/service_url_request_context.cc ('k') | net/proxy/proxy_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698