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

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

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 5 years, 2 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
« no previous file with comments | « net/spdy/spdy_test_util_common.cc ('k') | net/url_request/url_request_context_storage.h » ('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) 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 http_network_session_params_.use_alternative_services; 379 http_network_session_params_.use_alternative_services;
380 network_session_params.trusted_spdy_proxy = 380 network_session_params.trusted_spdy_proxy =
381 http_network_session_params_.trusted_spdy_proxy; 381 http_network_session_params_.trusted_spdy_proxy;
382 network_session_params.next_protos = http_network_session_params_.next_protos; 382 network_session_params.next_protos = http_network_session_params_.next_protos;
383 network_session_params.enable_quic = http_network_session_params_.enable_quic; 383 network_session_params.enable_quic = http_network_session_params_.enable_quic;
384 network_session_params.enable_insecure_quic = 384 network_session_params.enable_insecure_quic =
385 http_network_session_params_.enable_insecure_quic; 385 http_network_session_params_.enable_insecure_quic;
386 network_session_params.quic_connection_options = 386 network_session_params.quic_connection_options =
387 http_network_session_params_.quic_connection_options; 387 http_network_session_params_.quic_connection_options;
388 388
389 storage->set_http_network_session(
390 make_scoped_ptr(new HttpNetworkSession(network_session_params)));
391
389 scoped_ptr<HttpTransactionFactory> http_transaction_factory; 392 scoped_ptr<HttpTransactionFactory> http_transaction_factory;
390 if (http_cache_enabled_) { 393 if (http_cache_enabled_) {
391 HttpCache::BackendFactory* http_cache_backend = NULL; 394 HttpCache::BackendFactory* http_cache_backend;
392 if (http_cache_params_.type == HttpCacheParams::DISK) { 395 if (http_cache_params_.type == HttpCacheParams::DISK) {
393 http_cache_backend = new HttpCache::DefaultBackend( 396 http_cache_backend = new HttpCache::DefaultBackend(
394 DISK_CACHE, CACHE_BACKEND_DEFAULT, http_cache_params_.path, 397 DISK_CACHE, CACHE_BACKEND_DEFAULT, http_cache_params_.path,
395 http_cache_params_.max_size, context->GetFileTaskRunner()); 398 http_cache_params_.max_size, context->GetFileTaskRunner());
396 } else { 399 } else {
397 http_cache_backend = 400 http_cache_backend =
398 HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size); 401 HttpCache::DefaultBackend::InMemory(http_cache_params_.max_size);
399 } 402 }
400 403
404 http_transaction_factory.reset(new HttpCache(
405 storage->http_network_session(), http_cache_backend, true));
406 } else {
401 http_transaction_factory.reset( 407 http_transaction_factory.reset(
402 new HttpCache(network_session_params, http_cache_backend)); 408 new HttpNetworkLayer(storage->http_network_session()));
403 } else {
404 scoped_refptr<HttpNetworkSession> network_session(
405 new HttpNetworkSession(network_session_params));
406
407 http_transaction_factory.reset(new HttpNetworkLayer(network_session.get()));
408 } 409 }
409 storage->set_http_transaction_factory(http_transaction_factory.Pass()); 410 storage->set_http_transaction_factory(http_transaction_factory.Pass());
410 411
411 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl; 412 URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl;
412 if (data_enabled_) 413 if (data_enabled_)
413 job_factory->SetProtocolHandler("data", 414 job_factory->SetProtocolHandler("data",
414 make_scoped_ptr(new DataProtocolHandler)); 415 make_scoped_ptr(new DataProtocolHandler));
415 416
416 #if !defined(DISABLE_FILE_SUPPORT) 417 #if !defined(DISABLE_FILE_SUPPORT)
417 if (file_enabled_) { 418 if (file_enabled_) {
(...skipping 25 matching lines...) Expand all
443 } 444 }
444 url_request_interceptors_.weak_clear(); 445 url_request_interceptors_.weak_clear();
445 } 446 }
446 storage->set_job_factory(top_job_factory.Pass()); 447 storage->set_job_factory(top_job_factory.Pass());
447 // TODO(willchan): Support sdch. 448 // TODO(willchan): Support sdch.
448 449
449 return context.Pass(); 450 return context.Pass();
450 } 451 }
451 452
452 } // namespace net 453 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_test_util_common.cc ('k') | net/url_request/url_request_context_storage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698