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

Side by Side Diff: net/url_request/url_request_context_builder.cc

Issue 10834215: Remove static variables from HttpStreamFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: typo Created 8 years, 3 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
OLDNEW
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 #include "net/url_request/url_request_context_builder.h" 5 #include "net/url_request/url_request_context_builder.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 URLRequestContextBuilder::HostResolverParams::HostResolverParams() 174 URLRequestContextBuilder::HostResolverParams::HostResolverParams()
175 : parallelism(HostResolver::kDefaultParallelism), 175 : parallelism(HostResolver::kDefaultParallelism),
176 retry_attempts(HostResolver::kDefaultRetryAttempts) {} 176 retry_attempts(HostResolver::kDefaultRetryAttempts) {}
177 URLRequestContextBuilder::HostResolverParams::~HostResolverParams() {} 177 URLRequestContextBuilder::HostResolverParams::~HostResolverParams() {}
178 178
179 URLRequestContextBuilder::HttpCacheParams::HttpCacheParams() 179 URLRequestContextBuilder::HttpCacheParams::HttpCacheParams()
180 : type(IN_MEMORY), 180 : type(IN_MEMORY),
181 max_size(0) {} 181 max_size(0) {}
182 URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() {} 182 URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() {}
183 183
184 URLRequestContextBuilder::HttpNetworkSessionParams::HttpNetworkSessionParams()
185 : ignore_certificate_errors(false),
186 host_mapping_rules(NULL),
187 http_pipelining_enabled(false),
188 testing_fixed_http_port(0),
189 testing_fixed_https_port(0),
190 trusted_spdy_proxy() {}
191
192 URLRequestContextBuilder::HttpNetworkSessionParams::~HttpNetworkSessionParams()
193 {}
194
184 URLRequestContextBuilder::URLRequestContextBuilder() 195 URLRequestContextBuilder::URLRequestContextBuilder()
185 : ftp_enabled_(false), 196 : ftp_enabled_(false),
186 http_cache_enabled_(true) {} 197 http_cache_enabled_(true) {}
187 URLRequestContextBuilder::~URLRequestContextBuilder() {} 198 URLRequestContextBuilder::~URLRequestContextBuilder() {}
188 199
189 #if defined(OS_LINUX) 200 #if defined(OS_LINUX)
190 void URLRequestContextBuilder::set_proxy_config_service( 201 void URLRequestContextBuilder::set_proxy_config_service(
191 ProxyConfigService* proxy_config_service) { 202 ProxyConfigService* proxy_config_service) {
192 proxy_config_service_.reset(proxy_config_service); 203 proxy_config_service_.reset(proxy_config_service);
193 } 204 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 4, // TODO(willchan): Find a better constant somewhere. 241 4, // TODO(willchan): Find a better constant somewhere.
231 context->net_log())); 242 context->net_log()));
232 storage->set_ssl_config_service(new net::SSLConfigServiceDefaults); 243 storage->set_ssl_config_service(new net::SSLConfigServiceDefaults);
233 storage->set_http_auth_handler_factory( 244 storage->set_http_auth_handler_factory(
234 net::HttpAuthHandlerRegistryFactory::CreateDefault(host_resolver)); 245 net::HttpAuthHandlerRegistryFactory::CreateDefault(host_resolver));
235 storage->set_cookie_store(new CookieMonster(NULL, NULL)); 246 storage->set_cookie_store(new CookieMonster(NULL, NULL));
236 storage->set_transport_security_state(new net::TransportSecurityState()); 247 storage->set_transport_security_state(new net::TransportSecurityState());
237 storage->set_http_server_properties(new net::HttpServerPropertiesImpl); 248 storage->set_http_server_properties(new net::HttpServerPropertiesImpl);
238 storage->set_cert_verifier(CertVerifier::CreateDefault()); 249 storage->set_cert_verifier(CertVerifier::CreateDefault());
239 250
251 net::HttpNetworkSession::Params network_session_params;
252 network_session_params.host_resolver = host_resolver;
253 network_session_params.cert_verifier = context->cert_verifier();
254 network_session_params.transport_security_state =
255 context->transport_security_state();
256 network_session_params.proxy_service = context->proxy_service();
257 network_session_params.ssl_config_service =
258 context->ssl_config_service();
259 network_session_params.http_auth_handler_factory =
260 context->http_auth_handler_factory();
261 network_session_params.network_delegate =
262 context->network_delegate();
263 network_session_params.http_server_properties =
264 context->http_server_properties();
265 network_session_params.net_log = context->net_log();
266 network_session_params.ignore_certificate_errors =
267 http_network_session_params_.ignore_certificate_errors;
268 network_session_params.host_mapping_rules =
269 http_network_session_params_.host_mapping_rules;
270 network_session_params.http_pipelining_enabled =
271 http_network_session_params_.http_pipelining_enabled;
272 network_session_params.testing_fixed_http_port =
273 http_network_session_params_.testing_fixed_http_port;
274 network_session_params.testing_fixed_https_port =
275 http_network_session_params_.testing_fixed_https_port;
276 network_session_params.trusted_spdy_proxy =
277 http_network_session_params_.trusted_spdy_proxy;
278
240 HttpTransactionFactory* http_transaction_factory = NULL; 279 HttpTransactionFactory* http_transaction_factory = NULL;
241 if (http_cache_enabled_) { 280 if (http_cache_enabled_) {
281 network_session_params.server_bound_cert_service =
282 context->server_bound_cert_service();
242 HttpCache::BackendFactory* http_cache_backend = NULL; 283 HttpCache::BackendFactory* http_cache_backend = NULL;
243 if (http_cache_params_.type == HttpCacheParams::DISK) { 284 if (http_cache_params_.type == HttpCacheParams::DISK) {
244 context->StartCacheThread(); 285 context->StartCacheThread();
245 http_cache_backend = 286 http_cache_backend =
246 new HttpCache::DefaultBackend(DISK_CACHE, 287 new HttpCache::DefaultBackend(DISK_CACHE,
247 http_cache_params_.path, 288 http_cache_params_.path,
248 http_cache_params_.max_size, 289 http_cache_params_.max_size,
249 context->cache_message_loop_proxy()); 290 context->cache_message_loop_proxy());
250 } else { 291 } else {
251 http_cache_backend = 292 http_cache_backend =
252 HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size); 293 HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size);
253 } 294 }
295
254 http_transaction_factory = new HttpCache( 296 http_transaction_factory = new HttpCache(
255 context->host_resolver(), 297 network_session_params, http_cache_backend);
256 context->cert_verifier(),
257 context->server_bound_cert_service(),
258 context->transport_security_state(),
259 context->proxy_service(),
260 "",
261 context->ssl_config_service(),
262 context->http_auth_handler_factory(),
263 context->network_delegate(),
264 context->http_server_properties(),
265 context->net_log(),
266 http_cache_backend,
267 "" /* trusted_spdy_proxy */ );
268 } else { 298 } else {
269 HttpNetworkSession::Params session_params;
270 session_params.host_resolver = context->host_resolver();
271 session_params.cert_verifier = context->cert_verifier();
272 session_params.transport_security_state =
273 context->transport_security_state();
274 session_params.proxy_service = context->proxy_service();
275 session_params.ssl_config_service = context->ssl_config_service();
276 session_params.http_auth_handler_factory =
277 context->http_auth_handler_factory();
278 session_params.network_delegate = context->network_delegate();
279 session_params.http_server_properties =
280 context->http_server_properties();
281 session_params.net_log = context->net_log();
282 scoped_refptr<net::HttpNetworkSession> network_session( 299 scoped_refptr<net::HttpNetworkSession> network_session(
283 new net::HttpNetworkSession(session_params)); 300 new net::HttpNetworkSession(network_session_params));
284 301
285 http_transaction_factory = new HttpNetworkLayer(network_session); 302 http_transaction_factory = new HttpNetworkLayer(network_session);
286 } 303 }
287 storage->set_http_transaction_factory(http_transaction_factory); 304 storage->set_http_transaction_factory(http_transaction_factory);
288 305
289 // TODO(willchan): Support sdch. 306 // TODO(willchan): Support sdch.
290 307
291 return context; 308 return context;
292 } 309 }
293 310
294 } // namespace net 311 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_context_builder.h ('k') | webkit/tools/test_shell/test_shell_request_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698