| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 : globals_(globals) { | 405 : globals_(globals) { |
| 406 DCHECK(globals_); | 406 DCHECK(globals_); |
| 407 } | 407 } |
| 408 | 408 |
| 409 IOThread::Globals:: | 409 IOThread::Globals:: |
| 410 SystemRequestContextLeakChecker::~SystemRequestContextLeakChecker() { | 410 SystemRequestContextLeakChecker::~SystemRequestContextLeakChecker() { |
| 411 if (globals_->system_request_context.get()) | 411 if (globals_->system_request_context.get()) |
| 412 globals_->system_request_context->AssertNoURLRequests(); | 412 globals_->system_request_context->AssertNoURLRequests(); |
| 413 } | 413 } |
| 414 | 414 |
| 415 IOThread::Globals::Globals() : system_request_context_leak_checker(this) {} | 415 IOThread::Globals::Globals() : system_request_context_leak_checker(this), |
| 416 enable_brotli(false) {} |
| 416 | 417 |
| 417 IOThread::Globals::~Globals() {} | 418 IOThread::Globals::~Globals() {} |
| 418 | 419 |
| 419 // |local_state| is passed in explicitly in order to (1) reduce implicit | 420 // |local_state| is passed in explicitly in order to (1) reduce implicit |
| 420 // dependencies and (2) make IOThread more flexible for testing. | 421 // dependencies and (2) make IOThread more flexible for testing. |
| 421 IOThread::IOThread( | 422 IOThread::IOThread( |
| 422 PrefService* local_state, | 423 PrefService* local_state, |
| 423 policy::PolicyService* policy_service, | 424 policy::PolicyService* policy_service, |
| 424 net_log::ChromeNetLog* net_log, | 425 net_log::ChromeNetLog* net_log, |
| 425 extensions::EventRouterForwarder* extension_event_router_forwarder) | 426 extensions::EventRouterForwarder* extension_event_router_forwarder) |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 } | 796 } |
| 796 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 797 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 797 // is fixed. | 798 // is fixed. |
| 798 tracked_objects::ScopedTracker tracking_profile12_5( | 799 tracked_objects::ScopedTracker tracking_profile12_5( |
| 799 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 800 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 800 "466432 IOThread::InitAsync::QuicConfiguration")); | 801 "466432 IOThread::InitAsync::QuicConfiguration")); |
| 801 if (command_line.HasSwitch( | 802 if (command_line.HasSwitch( |
| 802 switches::kEnableUserAlternateProtocolPorts)) { | 803 switches::kEnableUserAlternateProtocolPorts)) { |
| 803 params_.enable_user_alternate_protocol_ports = true; | 804 params_.enable_user_alternate_protocol_ports = true; |
| 804 } | 805 } |
| 805 params_.enable_brotli = | 806 globals_->enable_brotli = |
| 806 base::FeatureList::IsEnabled(features::kBrotliEncoding); | 807 base::FeatureList::IsEnabled(features::kBrotliEncoding); |
| 807 params_.enable_token_binding = | 808 params_.enable_token_binding = |
| 808 base::FeatureList::IsEnabled(features::kTokenBinding); | 809 base::FeatureList::IsEnabled(features::kTokenBinding); |
| 809 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 810 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 810 // is fixed. | 811 // is fixed. |
| 811 tracked_objects::ScopedTracker tracking_profile13( | 812 tracked_objects::ScopedTracker tracking_profile13( |
| 812 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 813 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 813 "466432 IOThread::InitAsync::InitializeNetworkOptions")); | 814 "466432 IOThread::InitAsync::InitializeNetworkOptions")); |
| 814 // TODO(rch): Make the client socket factory a per-network session instance, | 815 // TODO(rch): Make the client socket factory a per-network session instance, |
| 815 // constructed from a NetworkSession::Params, to allow us to move this option | 816 // constructed from a NetworkSession::Params, to allow us to move this option |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1670 context->set_network_delegate(globals->system_network_delegate.get()); | 1671 context->set_network_delegate(globals->system_network_delegate.get()); |
| 1671 context->set_http_user_agent_settings( | 1672 context->set_http_user_agent_settings( |
| 1672 globals->http_user_agent_settings.get()); | 1673 globals->http_user_agent_settings.get()); |
| 1673 context->set_network_quality_estimator( | 1674 context->set_network_quality_estimator( |
| 1674 globals->network_quality_estimator.get()); | 1675 globals->network_quality_estimator.get()); |
| 1675 context->set_backoff_manager(globals->url_request_backoff_manager.get()); | 1676 context->set_backoff_manager(globals->url_request_backoff_manager.get()); |
| 1676 | 1677 |
| 1677 context->set_http_server_properties( | 1678 context->set_http_server_properties( |
| 1678 globals->http_server_properties->GetWeakPtr()); | 1679 globals->http_server_properties->GetWeakPtr()); |
| 1679 | 1680 |
| 1681 context->set_enable_brotli(globals->enable_brotli); |
| 1682 |
| 1680 net::HttpNetworkSession::Params system_params(params); | 1683 net::HttpNetworkSession::Params system_params(params); |
| 1681 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( | 1684 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( |
| 1682 context, &system_params); | 1685 context, &system_params); |
| 1683 | 1686 |
| 1684 globals->system_http_network_session.reset( | 1687 globals->system_http_network_session.reset( |
| 1685 new net::HttpNetworkSession(system_params)); | 1688 new net::HttpNetworkSession(system_params)); |
| 1686 globals->system_http_transaction_factory.reset( | 1689 globals->system_http_transaction_factory.reset( |
| 1687 new net::HttpNetworkLayer(globals->system_http_network_session.get())); | 1690 new net::HttpNetworkLayer(globals->system_http_network_session.get())); |
| 1688 context->set_http_transaction_factory( | 1691 context->set_http_transaction_factory( |
| 1689 globals->system_http_transaction_factory.get()); | 1692 globals->system_http_transaction_factory.get()); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1719 | 1722 |
| 1720 context->set_cookie_store(globals->system_cookie_store.get()); | 1723 context->set_cookie_store(globals->system_cookie_store.get()); |
| 1721 context->set_channel_id_service( | 1724 context->set_channel_id_service( |
| 1722 globals->system_channel_id_service.get()); | 1725 globals->system_channel_id_service.get()); |
| 1723 context->set_network_delegate(globals->system_network_delegate.get()); | 1726 context->set_network_delegate(globals->system_network_delegate.get()); |
| 1724 context->set_http_user_agent_settings( | 1727 context->set_http_user_agent_settings( |
| 1725 globals->http_user_agent_settings.get()); | 1728 globals->http_user_agent_settings.get()); |
| 1726 context->set_http_server_properties( | 1729 context->set_http_server_properties( |
| 1727 globals->http_server_properties->GetWeakPtr()); | 1730 globals->http_server_properties->GetWeakPtr()); |
| 1728 | 1731 |
| 1732 context->set_enable_brotli(globals->enable_brotli); |
| 1733 |
| 1729 net::HttpNetworkSession::Params session_params(params); | 1734 net::HttpNetworkSession::Params session_params(params); |
| 1730 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( | 1735 net::URLRequestContextBuilder::SetHttpNetworkSessionComponents( |
| 1731 context, &session_params); | 1736 context, &session_params); |
| 1732 | 1737 |
| 1733 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 | 1738 // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466432 |
| 1734 // is fixed. | 1739 // is fixed. |
| 1735 tracked_objects::ScopedTracker tracking_profile2( | 1740 tracked_objects::ScopedTracker tracking_profile2( |
| 1736 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 1741 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1737 "466432 IOThread::ConstructProxyScriptFetcherContext2")); | 1742 "466432 IOThread::ConstructProxyScriptFetcherContext2")); |
| 1738 globals->proxy_script_fetcher_http_network_session.reset( | 1743 globals->proxy_script_fetcher_http_network_session.reset( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the | 1781 // TODO(rtenneti): We should probably use HttpServerPropertiesManager for the |
| 1777 // system URLRequestContext too. There's no reason this should be tied to a | 1782 // system URLRequestContext too. There's no reason this should be tied to a |
| 1778 // profile. | 1783 // profile. |
| 1779 return context; | 1784 return context; |
| 1780 } | 1785 } |
| 1781 | 1786 |
| 1782 const metrics::UpdateUsagePrefCallbackType& | 1787 const metrics::UpdateUsagePrefCallbackType& |
| 1783 IOThread::GetMetricsDataUseForwarder() { | 1788 IOThread::GetMetricsDataUseForwarder() { |
| 1784 return metrics_data_use_forwarder_; | 1789 return metrics_data_use_forwarder_; |
| 1785 } | 1790 } |
| OLD | NEW |