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

Side by Side Diff: chrome/browser/io_thread.cc

Issue 886933010: ScopedTrackers to help pin down where IOThread::InitSystemRequestContextOnIOThread is janky (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | chrome/browser/net/proxy_service_factory.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) 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/io_thread.h" 5 #include "chrome/browser/io_thread.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/debug/leak_tracker.h" 14 #include "base/debug/leak_tracker.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/metrics/field_trial.h" 16 #include "base/metrics/field_trial.h"
17 #include "base/metrics/user_metrics.h" 17 #include "base/metrics/user_metrics.h"
18 #include "base/prefs/pref_registry_simple.h" 18 #include "base/prefs/pref_registry_simple.h"
19 #include "base/prefs/pref_service.h" 19 #include "base/prefs/pref_service.h"
20 #include "base/profiler/scoped_tracker.h"
20 #include "base/stl_util.h" 21 #include "base/stl_util.h"
21 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_piece.h" 23 #include "base/strings/string_piece.h"
23 #include "base/strings/string_split.h" 24 #include "base/strings/string_split.h"
24 #include "base/strings/string_util.h" 25 #include "base/strings/string_util.h"
25 #include "base/threading/sequenced_worker_pool.h" 26 #include "base/threading/sequenced_worker_pool.h"
26 #include "base/threading/thread.h" 27 #include "base/threading/thread.h"
27 #include "base/threading/worker_pool.h" 28 #include "base/threading/worker_pool.h"
28 #include "base/time/time.h" 29 #include "base/time/time.h"
29 #include "base/trace_event/trace_event.h" 30 #include "base/trace_event/trace_event.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 globals->http_user_agent_settings.get()); 247 globals->http_user_agent_settings.get());
247 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the 248 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the
248 // system URLRequestContext too. There's no reason this should be tied to a 249 // system URLRequestContext too. There's no reason this should be tied to a
249 // profile. 250 // profile.
250 return context; 251 return context;
251 } 252 }
252 253
253 net::URLRequestContext* 254 net::URLRequestContext*
254 ConstructSystemRequestContext(IOThread::Globals* globals, 255 ConstructSystemRequestContext(IOThread::Globals* globals,
255 net::NetLog* net_log) { 256 net::NetLog* net_log) {
257 // TODO(michaeln): Remove ScopedTracker below once crbug.com/454983 is fixed.
258 tracked_objects::ScopedTracker tracking_profile(
259 FROM_HERE_WITH_EXPLICIT_FUNCTION(
260 "454983 ConstructSystemRequestContext"));
256 net::URLRequestContext* context = new SystemURLRequestContext; 261 net::URLRequestContext* context = new SystemURLRequestContext;
257 context->set_net_log(net_log); 262 context->set_net_log(net_log);
258 context->set_host_resolver(globals->host_resolver.get()); 263 context->set_host_resolver(globals->host_resolver.get());
259 context->set_cert_verifier(globals->cert_verifier.get()); 264 context->set_cert_verifier(globals->cert_verifier.get());
260 context->set_transport_security_state( 265 context->set_transport_security_state(
261 globals->transport_security_state.get()); 266 globals->transport_security_state.get());
262 context->set_cert_transparency_verifier( 267 context->set_cert_transparency_verifier(
263 globals->cert_transparency_verifier.get()); 268 globals->cert_transparency_verifier.get());
264 context->set_http_auth_handler_factory( 269 context->set_http_auth_handler_factory(
265 globals->http_auth_handler_factory.get()); 270 globals->http_auth_handler_factory.get());
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 void IOThread::ClearHostCache() { 980 void IOThread::ClearHostCache() {
976 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 981 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
977 982
978 net::HostCache* host_cache = globals_->host_resolver->GetHostCache(); 983 net::HostCache* host_cache = globals_->host_resolver->GetHostCache();
979 if (host_cache) 984 if (host_cache)
980 host_cache->clear(); 985 host_cache->clear();
981 } 986 }
982 987
983 void IOThread::InitializeNetworkSessionParams( 988 void IOThread::InitializeNetworkSessionParams(
984 net::HttpNetworkSession::Params* params) { 989 net::HttpNetworkSession::Params* params) {
990 // TODO(michaeln): Remove ScopedTracker below once crbug.com/454983 is fixed.
991 tracked_objects::ScopedTracker tracking_profile(
992 FROM_HERE_WITH_EXPLICIT_FUNCTION(
993 "454983 IOThread::InitializeNetworkSessionParams"));
985 InitializeNetworkSessionParamsFromGlobals(*globals_, params); 994 InitializeNetworkSessionParamsFromGlobals(*globals_, params);
986 } 995 }
987 996
988 // static 997 // static
989 void IOThread::InitializeNetworkSessionParamsFromGlobals( 998 void IOThread::InitializeNetworkSessionParamsFromGlobals(
990 const IOThread::Globals& globals, 999 const IOThread::Globals& globals,
991 net::HttpNetworkSession::Params* params) { 1000 net::HttpNetworkSession::Params* params) {
992 params->host_resolver = globals.host_resolver.get(); 1001 params->host_resolver = globals.host_resolver.get();
993 params->cert_verifier = globals.cert_verifier.get(); 1002 params->cert_verifier = globals.cert_verifier.get();
994 params->cert_policy_enforcer = globals.cert_policy_enforcer.get(); 1003 params->cert_policy_enforcer = globals.cert_policy_enforcer.get();
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 BrowserThread::IO, 1096 BrowserThread::IO,
1088 FROM_HERE, 1097 FROM_HERE,
1089 base::Bind(&IOThread::InitSystemRequestContextOnIOThread, 1098 base::Bind(&IOThread::InitSystemRequestContextOnIOThread,
1090 base::Unretained(this))); 1099 base::Unretained(this)));
1091 } 1100 }
1092 1101
1093 void IOThread::InitSystemRequestContextOnIOThread() { 1102 void IOThread::InitSystemRequestContextOnIOThread() {
1094 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 1103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
1095 DCHECK(!globals_->system_proxy_service.get()); 1104 DCHECK(!globals_->system_proxy_service.get());
1096 DCHECK(system_proxy_config_service_.get()); 1105 DCHECK(system_proxy_config_service_.get());
1097 1106
Peter Kasting 2015/02/09 23:35:44 Do you want a tracker here to measure the remainin
michaeln 2015/02/10 00:02:24 No, i'm trying to distinguish between objs being c
1098 const base::CommandLine& command_line = 1107 const base::CommandLine& command_line =
1099 *base::CommandLine::ForCurrentProcess(); 1108 *base::CommandLine::ForCurrentProcess();
1100 globals_->system_proxy_service.reset( 1109 globals_->system_proxy_service.reset(
1101 ProxyServiceFactory::CreateProxyService( 1110 ProxyServiceFactory::CreateProxyService(
1102 net_log_, 1111 net_log_,
1103 globals_->proxy_script_fetcher_context.get(), 1112 globals_->proxy_script_fetcher_context.get(),
1104 globals_->system_network_delegate.get(), 1113 globals_->system_network_delegate.get(),
1105 system_proxy_config_service_.release(), 1114 system_proxy_config_service_.release(),
1106 command_line, 1115 command_line,
1107 quick_check_enabled_.GetValue())); 1116 quick_check_enabled_.GetValue()));
1108 1117
1109 net::HttpNetworkSession::Params system_params; 1118 net::HttpNetworkSession::Params system_params;
1110 InitializeNetworkSessionParams(&system_params); 1119 InitializeNetworkSessionParams(&system_params);
1111 system_params.net_log = net_log_; 1120 system_params.net_log = net_log_;
1112 system_params.proxy_service = globals_->system_proxy_service.get(); 1121 system_params.proxy_service = globals_->system_proxy_service.get();
1113 1122
1114 globals_->system_http_transaction_factory.reset( 1123 {
1115 new net::HttpNetworkLayer( 1124 // TODO(michaeln): Remove after crbug.com/454983 is fixed.
1116 new net::HttpNetworkSession(system_params))); 1125 tracked_objects::ScopedTracker tracking_profile(
1126 FROM_HERE_WITH_EXPLICIT_FUNCTION(
1127 "454983 IOThread::InitSystemRequestContextOnIOThread"
1128 ".HttpNetworkSession"));
Peter Kasting 2015/02/09 23:35:44 Nit: Name seems slightly misleading since this is
1129 globals_->system_http_transaction_factory.reset(
1130 new net::HttpNetworkLayer(
1131 new net::HttpNetworkSession(system_params)));
1132 }
1117 globals_->system_url_request_job_factory.reset( 1133 globals_->system_url_request_job_factory.reset(
1118 new net::URLRequestJobFactoryImpl()); 1134 new net::URLRequestJobFactoryImpl());
1119 globals_->system_request_context.reset( 1135 globals_->system_request_context.reset(
1120 ConstructSystemRequestContext(globals_, net_log_)); 1136 ConstructSystemRequestContext(globals_, net_log_));
1121 globals_->system_request_context->set_ssl_config_service( 1137 globals_->system_request_context->set_ssl_config_service(
1122 globals_->ssl_config_service.get()); 1138 globals_->ssl_config_service.get());
1123 globals_->system_request_context->set_http_server_properties( 1139 globals_->system_request_context->set_http_server_properties(
1124 globals_->http_server_properties->GetWeakPtr()); 1140 globals_->http_server_properties->GetWeakPtr());
1125 } 1141 }
1126 1142
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 net::QuicVersionVector supported_versions = net::QuicSupportedVersions(); 1402 net::QuicVersionVector supported_versions = net::QuicSupportedVersions();
1387 for (size_t i = 0; i < supported_versions.size(); ++i) { 1403 for (size_t i = 0; i < supported_versions.size(); ++i) {
1388 net::QuicVersion version = supported_versions[i]; 1404 net::QuicVersion version = supported_versions[i];
1389 if (net::QuicVersionToString(version) == quic_version) { 1405 if (net::QuicVersionToString(version) == quic_version) {
1390 return version; 1406 return version;
1391 } 1407 }
1392 } 1408 }
1393 1409
1394 return net::QUIC_VERSION_UNSUPPORTED; 1410 return net::QUIC_VERSION_UNSUPPORTED;
1395 } 1411 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/net/proxy_service_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698