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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 1298253002: Remove reference counting from HttpNetworkSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missed two comments, fix some tests Created 5 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
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 "chrome/browser/profiles/profile_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "components/dom_distiller/core/url_constants.h" 58 #include "components/dom_distiller/core/url_constants.h"
59 #include "components/sync_driver/pref_names.h" 59 #include "components/sync_driver/pref_names.h"
60 #include "components/url_formatter/url_fixer.h" 60 #include "components/url_formatter/url_fixer.h"
61 #include "content/public/browser/browser_thread.h" 61 #include "content/public/browser/browser_thread.h"
62 #include "content/public/browser/host_zoom_map.h" 62 #include "content/public/browser/host_zoom_map.h"
63 #include "content/public/browser/notification_service.h" 63 #include "content/public/browser/notification_service.h"
64 #include "content/public/browser/resource_context.h" 64 #include "content/public/browser/resource_context.h"
65 #include "net/base/keygen_handler.h" 65 #include "net/base/keygen_handler.h"
66 #include "net/cert/cert_verifier.h" 66 #include "net/cert/cert_verifier.h"
67 #include "net/cookies/canonical_cookie.h" 67 #include "net/cookies/canonical_cookie.h"
68 #include "net/http/http_network_session.h"
68 #include "net/http/http_transaction_factory.h" 69 #include "net/http/http_transaction_factory.h"
69 #include "net/http/http_util.h" 70 #include "net/http/http_util.h"
70 #include "net/http/transport_security_persister.h" 71 #include "net/http/transport_security_persister.h"
71 #include "net/proxy/proxy_config_service_fixed.h" 72 #include "net/proxy/proxy_config_service_fixed.h"
72 #include "net/proxy/proxy_script_fetcher_impl.h" 73 #include "net/proxy/proxy_script_fetcher_impl.h"
73 #include "net/proxy/proxy_service.h" 74 #include "net/proxy/proxy_service.h"
74 #include "net/ssl/channel_id_service.h" 75 #include "net/ssl/channel_id_service.h"
75 #include "net/ssl/client_cert_store.h" 76 #include "net/ssl/client_cert_store.h"
76 #include "net/url_request/certificate_report_sender.h" 77 #include "net/url_request/certificate_report_sender.h"
77 #include "net/url_request/data_protocol_handler.h" 78 #include "net/url_request/data_protocol_handler.h"
(...skipping 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after
1281 1282
1282 void ProfileIOData::set_channel_id_service( 1283 void ProfileIOData::set_channel_id_service(
1283 net::ChannelIDService* channel_id_service) const { 1284 net::ChannelIDService* channel_id_service) const {
1284 channel_id_service_.reset(channel_id_service); 1285 channel_id_service_.reset(channel_id_service);
1285 } 1286 }
1286 1287
1287 void ProfileIOData::DestroyResourceContext() { 1288 void ProfileIOData::DestroyResourceContext() {
1288 resource_context_.reset(); 1289 resource_context_.reset();
1289 } 1290 }
1290 1291
1291 scoped_ptr<net::HttpCache> ProfileIOData::CreateMainHttpFactory( 1292 // Creates the HTTP network session
pauljensen 2015/09/11 13:05:25 Google C++ style guide says "you should not just r
mmenke 2015/09/11 14:46:49 Done. Accidentally copied from the header. Remov
1292 const ProfileParams* profile_params, 1293 scoped_ptr<net::HttpNetworkSession> ProfileIOData::CreateHttpNetworkSession(
1293 net::HttpCache::BackendFactory* main_backend) const { 1294 const ProfileParams& profile_params) const {
1294 net::HttpNetworkSession::Params params; 1295 net::HttpNetworkSession::Params params;
1295 net::URLRequestContext* context = main_request_context(); 1296 net::URLRequestContext* context = main_request_context();
1296 1297
1297 IOThread* const io_thread = profile_params->io_thread; 1298 IOThread* const io_thread = profile_params.io_thread;
1298 1299
1299 io_thread->InitializeNetworkSessionParams(&params); 1300 io_thread->InitializeNetworkSessionParams(&params);
1300 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(context, 1301 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents(context,
1301 &params); 1302 &params);
1302 1303
1303 params.ssl_session_cache_shard = GetSSLSessionCacheShard(); 1304 params.ssl_session_cache_shard = GetSSLSessionCacheShard();
1304 if (data_reduction_proxy_io_data_.get()) 1305 if (data_reduction_proxy_io_data_.get())
1305 params.proxy_delegate = data_reduction_proxy_io_data_->proxy_delegate(); 1306 params.proxy_delegate = data_reduction_proxy_io_data_->proxy_delegate();
1306 1307
1307 net::HttpNetworkSession* session = new net::HttpNetworkSession(params); 1308 return scoped_ptr<net::HttpNetworkSession>(
1309 new net::HttpNetworkSession(params));
1310 }
1311
1312 scoped_ptr<net::HttpCache> ProfileIOData::CreateMainHttpFactory(
1313 net::HttpNetworkSession* session,
1314 net::HttpCache::BackendFactory* main_backend) const {
1315 net::URLRequestContext* context = main_request_context();
1308 return scoped_ptr<net::HttpCache>(new net::HttpCache( 1316 return scoped_ptr<net::HttpCache>(new net::HttpCache(
1309 new DevToolsNetworkTransactionFactory( 1317 new DevToolsNetworkTransactionFactory(
1310 network_controller_handle_.GetController(), session), 1318 network_controller_handle_.GetController(), session),
1311 context->net_log(), main_backend)); 1319 context->net_log(), main_backend,
1320 true /* set_up_quic_server_info */));
1312 } 1321 }
1313 1322
1314 scoped_ptr<net::HttpCache> ProfileIOData::CreateHttpFactory( 1323 scoped_ptr<net::HttpCache> ProfileIOData::CreateHttpFactory(
1315 net::HttpNetworkSession* shared_session, 1324 net::HttpNetworkSession* shared_session,
1316 net::HttpCache::BackendFactory* backend) const { 1325 net::HttpCache::BackendFactory* backend) const {
1317 return scoped_ptr<net::HttpCache>(new net::HttpCache( 1326 return scoped_ptr<net::HttpCache>(new net::HttpCache(
1318 new DevToolsNetworkTransactionFactory( 1327 new DevToolsNetworkTransactionFactory(
1319 network_controller_handle_.GetController(), shared_session), 1328 network_controller_handle_.GetController(), shared_session),
1320 shared_session->net_log(), backend)); 1329 shared_session->net_log(), backend,
1330 true /* set_up_quic_server_info */));
1321 } 1331 }
1322 1332
1323 void ProfileIOData::SetCookieSettingsForTesting( 1333 void ProfileIOData::SetCookieSettingsForTesting(
1324 content_settings::CookieSettings* cookie_settings) { 1334 content_settings::CookieSettings* cookie_settings) {
1325 DCHECK(!cookie_settings_.get()); 1335 DCHECK(!cookie_settings_.get());
1326 cookie_settings_ = cookie_settings; 1336 cookie_settings_ = cookie_settings;
1327 } 1337 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698