OLD | NEW |
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 <utility> | 7 #include <utility> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 IOThread* const io_thread_; // Weak pointer, owned by BrowserProcess. | 257 IOThread* const io_thread_; // Weak pointer, owned by BrowserProcess. |
258 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; | 258 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner_; |
259 | 259 |
260 base::debug::LeakTracker<SystemURLRequestContextGetter> leak_tracker_; | 260 base::debug::LeakTracker<SystemURLRequestContextGetter> leak_tracker_; |
261 }; | 261 }; |
262 | 262 |
263 SystemURLRequestContextGetter::SystemURLRequestContextGetter( | 263 SystemURLRequestContextGetter::SystemURLRequestContextGetter( |
264 IOThread* io_thread) | 264 IOThread* io_thread) |
265 : io_thread_(io_thread), | 265 : io_thread_(io_thread), |
266 network_task_runner_( | 266 network_task_runner_( |
267 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)) { | 267 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)) {} |
268 } | |
269 | 268 |
270 SystemURLRequestContextGetter::~SystemURLRequestContextGetter() {} | 269 SystemURLRequestContextGetter::~SystemURLRequestContextGetter() {} |
271 | 270 |
272 net::URLRequestContext* SystemURLRequestContextGetter::GetURLRequestContext() { | 271 net::URLRequestContext* SystemURLRequestContextGetter::GetURLRequestContext() { |
273 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 272 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
274 DCHECK(io_thread_->globals()->system_request_context.get()); | 273 DCHECK(io_thread_->globals()->system_request_context.get()); |
275 | 274 |
276 return io_thread_->globals()->system_request_context.get(); | 275 return io_thread_->globals()->system_request_context.get(); |
277 } | 276 } |
278 | 277 |
(...skipping 30 matching lines...) Expand all Loading... |
309 : net_log_(net_log), | 308 : net_log_(net_log), |
310 #if defined(ENABLE_EXTENSIONS) | 309 #if defined(ENABLE_EXTENSIONS) |
311 extension_event_router_forwarder_(extension_event_router_forwarder), | 310 extension_event_router_forwarder_(extension_event_router_forwarder), |
312 #endif | 311 #endif |
313 globals_(NULL), | 312 globals_(NULL), |
314 is_spdy_allowed_by_policy_(true), | 313 is_spdy_allowed_by_policy_(true), |
315 is_quic_allowed_by_policy_(true), | 314 is_quic_allowed_by_policy_(true), |
316 creation_time_(base::TimeTicks::Now()), | 315 creation_time_(base::TimeTicks::Now()), |
317 weak_factory_(this) { | 316 weak_factory_(this) { |
318 scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy = | 317 scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy = |
319 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); | 318 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO); |
320 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); | 319 auth_schemes_ = local_state->GetString(prefs::kAuthSchemes); |
321 negotiate_disable_cname_lookup_.Init( | 320 negotiate_disable_cname_lookup_.Init( |
322 prefs::kDisableAuthNegotiateCnameLookup, local_state, | 321 prefs::kDisableAuthNegotiateCnameLookup, local_state, |
323 base::Bind(&IOThread::UpdateNegotiateDisableCnameLookup, | 322 base::Bind(&IOThread::UpdateNegotiateDisableCnameLookup, |
324 base::Unretained(this))); | 323 base::Unretained(this))); |
325 negotiate_disable_cname_lookup_.MoveToThread(io_thread_proxy); | 324 negotiate_disable_cname_lookup_.MoveToThread(io_thread_proxy); |
326 negotiate_enable_port_.Init( | 325 negotiate_enable_port_.Init( |
327 prefs::kEnableAuthNegotiatePort, local_state, | 326 prefs::kEnableAuthNegotiatePort, local_state, |
328 base::Bind(&IOThread::UpdateNegotiateEnablePort, base::Unretained(this))); | 327 base::Bind(&IOThread::UpdateNegotiateEnablePort, base::Unretained(this))); |
329 negotiate_enable_port_.MoveToThread(io_thread_proxy); | 328 negotiate_enable_port_.MoveToThread(io_thread_proxy); |
(...skipping 21 matching lines...) Expand all Loading... |
351 ChromeNetworkDelegate::InitializePrefsOnUIThread( | 350 ChromeNetworkDelegate::InitializePrefsOnUIThread( |
352 &system_enable_referrers_, | 351 &system_enable_referrers_, |
353 nullptr, | 352 nullptr, |
354 nullptr, | 353 nullptr, |
355 nullptr, | 354 nullptr, |
356 nullptr, | 355 nullptr, |
357 local_state); | 356 local_state); |
358 ssl_config_service_manager_.reset( | 357 ssl_config_service_manager_.reset( |
359 ssl_config::SSLConfigServiceManager::CreateDefaultManager( | 358 ssl_config::SSLConfigServiceManager::CreateDefaultManager( |
360 local_state, | 359 local_state, |
361 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO))); | 360 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO))); |
362 | 361 |
363 base::Value* dns_client_enabled_default = new base::FundamentalValue( | 362 base::Value* dns_client_enabled_default = new base::FundamentalValue( |
364 chrome_browser_net::ConfigureAsyncDnsFieldTrial()); | 363 chrome_browser_net::ConfigureAsyncDnsFieldTrial()); |
365 local_state->SetDefaultPrefValue(prefs::kBuiltInDnsClientEnabled, | 364 local_state->SetDefaultPrefValue(prefs::kBuiltInDnsClientEnabled, |
366 dns_client_enabled_default); | 365 dns_client_enabled_default); |
367 chrome_browser_net::LogAsyncDnsPrefSource( | 366 chrome_browser_net::LogAsyncDnsPrefSource( |
368 local_state->FindPreference(prefs::kBuiltInDnsClientEnabled)); | 367 local_state->FindPreference(prefs::kBuiltInDnsClientEnabled)); |
369 | 368 |
370 dns_client_enabled_.Init(prefs::kBuiltInDnsClientEnabled, | 369 dns_client_enabled_.Init(prefs::kBuiltInDnsClientEnabled, |
371 local_state, | 370 local_state, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 #endif | 460 #endif |
462 | 461 |
463 const base::CommandLine& command_line = | 462 const base::CommandLine& command_line = |
464 *base::CommandLine::ForCurrentProcess(); | 463 *base::CommandLine::ForCurrentProcess(); |
465 | 464 |
466 // Export ssl keys if log file specified. | 465 // Export ssl keys if log file specified. |
467 base::FilePath ssl_keylog_file = GetSSLKeyLogFile(command_line); | 466 base::FilePath ssl_keylog_file = GetSSLKeyLogFile(command_line); |
468 if (!ssl_keylog_file.empty()) { | 467 if (!ssl_keylog_file.empty()) { |
469 net::SSLClientSocket::SetSSLKeyLogFile( | 468 net::SSLClientSocket::SetSSLKeyLogFile( |
470 ssl_keylog_file, | 469 ssl_keylog_file, |
471 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 470 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE)); |
472 } | 471 } |
473 | 472 |
474 DCHECK(!globals_); | 473 DCHECK(!globals_); |
475 globals_ = new Globals; | 474 globals_ = new Globals; |
476 | 475 |
477 // Add an observer that will emit network change events to the ChromeNetLog. | 476 // Add an observer that will emit network change events to the ChromeNetLog. |
478 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be | 477 // Assuming NetworkChangeNotifier dispatches in FIFO order, we should be |
479 // logging the network change before other IO thread consumers respond to it. | 478 // logging the network change before other IO thread consumers respond to it. |
480 network_change_observer_.reset( | 479 network_change_observer_.reset( |
481 new net::LoggingNetworkChangeObserver(net_log_)); | 480 new net::LoggingNetworkChangeObserver(net_log_)); |
(...skipping 22 matching lines...) Expand all Loading... |
504 metrics_data_use_forwarder_)); | 503 metrics_data_use_forwarder_)); |
505 // By default, data usage is considered off the record. | 504 // By default, data usage is considered off the record. |
506 chrome_network_delegate->set_data_use_aggregator( | 505 chrome_network_delegate->set_data_use_aggregator( |
507 globals_->data_use_aggregator.get(), | 506 globals_->data_use_aggregator.get(), |
508 true /* is_data_usage_off_the_record */); | 507 true /* is_data_usage_off_the_record */); |
509 | 508 |
510 #if BUILDFLAG(ANDROID_JAVA_UI) | 509 #if BUILDFLAG(ANDROID_JAVA_UI) |
511 globals_->external_data_use_observer.reset( | 510 globals_->external_data_use_observer.reset( |
512 new chrome::android::ExternalDataUseObserver( | 511 new chrome::android::ExternalDataUseObserver( |
513 globals_->data_use_aggregator.get(), | 512 globals_->data_use_aggregator.get(), |
514 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 513 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO), |
515 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI))); | 514 BrowserThread::GetTaskRunnerForThread(BrowserThread::UI))); |
516 #endif | 515 #endif |
517 | 516 |
518 globals_->system_network_delegate = std::move(chrome_network_delegate); | 517 globals_->system_network_delegate = std::move(chrome_network_delegate); |
519 globals_->host_resolver = CreateGlobalHostResolver(net_log_); | 518 globals_->host_resolver = CreateGlobalHostResolver(net_log_); |
520 | 519 |
521 std::map<std::string, std::string> network_quality_estimator_params; | 520 std::map<std::string, std::string> network_quality_estimator_params; |
522 variations::GetVariationParams(kNetworkQualityEstimatorFieldTrialName, | 521 variations::GetVariationParams(kNetworkQualityEstimatorFieldTrialName, |
523 &network_quality_estimator_params); | 522 &network_quality_estimator_params); |
524 | 523 |
525 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider; | 524 std::unique_ptr<net::ExternalEstimateProvider> external_estimate_provider; |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 997 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
999 // system URLRequestContext too. There's no reason this should be tied to a | 998 // system URLRequestContext too. There's no reason this should be tied to a |
1000 // profile. | 999 // profile. |
1001 return context; | 1000 return context; |
1002 } | 1001 } |
1003 | 1002 |
1004 const metrics::UpdateUsagePrefCallbackType& | 1003 const metrics::UpdateUsagePrefCallbackType& |
1005 IOThread::GetMetricsDataUseForwarder() { | 1004 IOThread::GetMetricsDataUseForwarder() { |
1006 return metrics_data_use_forwarder_; | 1005 return metrics_data_use_forwarder_; |
1007 } | 1006 } |
OLD | NEW |