Commit 6d0ef5ca authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Initialize URLRequestContextBuilder members in the header.

As is, the ifdefs in the header and the ifdefs in the initializer list
have to match. With this CL, there is no need for the initializer list
and it is clearer that members are being initialized.

Also fix lint errors.

Change-Id: Ie9437fb15578b6ae89bd4911f79914eb49a9357a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1476437
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarRyan Hamilton <rch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#638056}
parent 50b4e186
...@@ -196,32 +196,7 @@ URLRequestContextBuilder::HttpCacheParams::HttpCacheParams() ...@@ -196,32 +196,7 @@ URLRequestContextBuilder::HttpCacheParams::HttpCacheParams()
max_size(0) {} max_size(0) {}
URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() = default; URLRequestContextBuilder::HttpCacheParams::~HttpCacheParams() = default;
URLRequestContextBuilder::URLRequestContextBuilder() URLRequestContextBuilder::URLRequestContextBuilder() = default;
: enable_brotli_(false),
network_quality_estimator_(nullptr),
data_enabled_(false),
#if !BUILDFLAG(DISABLE_FILE_SUPPORT)
file_enabled_(false),
#endif
#if !BUILDFLAG(DISABLE_FTP_SUPPORT)
ftp_enabled_(false),
#endif
http_cache_enabled_(true),
throttling_enabled_(false),
cookie_store_set_by_client_(false),
net_log_(nullptr),
shared_host_resolver_(nullptr),
pac_quick_check_enabled_(true),
pac_sanitize_url_policy_(ProxyResolutionService::SanitizeUrlPolicy::SAFE),
shared_proxy_delegate_(nullptr),
shared_http_auth_handler_factory_(nullptr),
#if BUILDFLAG(ENABLE_REPORTING)
shared_cert_verifier_(nullptr),
network_error_logging_enabled_(false) {
#else // !BUILDFLAG(ENABLE_REPORTING)
shared_cert_verifier_(nullptr){
#endif // !BUILDFLAG(ENABLE_REPORTING)
}
URLRequestContextBuilder::~URLRequestContextBuilder() = default; URLRequestContextBuilder::~URLRequestContextBuilder() = default;
...@@ -536,8 +511,10 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() { ...@@ -536,8 +511,10 @@ std::unique_ptr<URLRequestContext> URLRequestContextBuilder::Build() {
std::move(proxy_config_service_), context.get(), std::move(proxy_config_service_), context.get(),
context->host_resolver(), context->network_delegate(), context->host_resolver(), context->network_delegate(),
context->net_log()); context->net_log());
proxy_resolution_service_->set_quick_check_enabled(pac_quick_check_enabled_); proxy_resolution_service_->set_quick_check_enabled(
proxy_resolution_service_->set_sanitize_url_policy(pac_sanitize_url_policy_); pac_quick_check_enabled_);
proxy_resolution_service_->set_sanitize_url_policy(
pac_sanitize_url_policy_);
} }
ProxyResolutionService* proxy_resolution_service = ProxyResolutionService* proxy_resolution_service =
proxy_resolution_service_.get(); proxy_resolution_service_.get();
......
...@@ -372,53 +372,54 @@ class NET_EXPORT URLRequestContextBuilder { ...@@ -372,53 +372,54 @@ class NET_EXPORT URLRequestContextBuilder {
private: private:
std::string name_; std::string name_;
bool enable_brotli_; bool enable_brotli_ = false;
NetworkQualityEstimator* network_quality_estimator_; NetworkQualityEstimator* network_quality_estimator_ = nullptr;
std::string accept_language_; std::string accept_language_;
std::string user_agent_; std::string user_agent_;
std::unique_ptr<HttpUserAgentSettings> http_user_agent_settings_; std::unique_ptr<HttpUserAgentSettings> http_user_agent_settings_;
// Include support for data:// requests. // Include support for data:// requests.
bool data_enabled_; bool data_enabled_ = false;
#if !BUILDFLAG(DISABLE_FILE_SUPPORT) #if !BUILDFLAG(DISABLE_FILE_SUPPORT)
// Include support for file:// requests. // Include support for file:// requests.
bool file_enabled_; bool file_enabled_ = false;
#endif #endif
#if !BUILDFLAG(DISABLE_FTP_SUPPORT) #if !BUILDFLAG(DISABLE_FTP_SUPPORT)
// Include support for ftp:// requests. // Include support for ftp:// requests.
bool ftp_enabled_; bool ftp_enabled_ = false;
#endif #endif
bool http_cache_enabled_; bool http_cache_enabled_ = true;
bool throttling_enabled_; bool throttling_enabled_ = false;
bool cookie_store_set_by_client_; bool cookie_store_set_by_client_ = false;
HttpCacheParams http_cache_params_; HttpCacheParams http_cache_params_;
HttpNetworkSession::Params http_network_session_params_; HttpNetworkSession::Params http_network_session_params_;
CreateHttpTransactionFactoryCallback create_http_network_transaction_factory_; CreateHttpTransactionFactoryCallback create_http_network_transaction_factory_;
base::FilePath transport_security_persister_path_; base::FilePath transport_security_persister_path_;
NetLog* net_log_; NetLog* net_log_ = nullptr;
std::unique_ptr<HostResolver> host_resolver_; std::unique_ptr<HostResolver> host_resolver_;
HostResolver* shared_host_resolver_; HostResolver* shared_host_resolver_ = nullptr;
std::unique_ptr<ProxyConfigService> proxy_config_service_; std::unique_ptr<ProxyConfigService> proxy_config_service_;
bool pac_quick_check_enabled_; bool pac_quick_check_enabled_ = true;
ProxyResolutionService::SanitizeUrlPolicy pac_sanitize_url_policy_; ProxyResolutionService::SanitizeUrlPolicy pac_sanitize_url_policy_ =
ProxyResolutionService::SanitizeUrlPolicy::SAFE;
std::unique_ptr<ProxyResolutionService> proxy_resolution_service_; std::unique_ptr<ProxyResolutionService> proxy_resolution_service_;
std::unique_ptr<SSLConfigService> ssl_config_service_; std::unique_ptr<SSLConfigService> ssl_config_service_;
std::unique_ptr<NetworkDelegate> network_delegate_; std::unique_ptr<NetworkDelegate> network_delegate_;
CreateLayeredNetworkDelegate create_layered_network_delegate_callback_; CreateLayeredNetworkDelegate create_layered_network_delegate_callback_;
std::unique_ptr<ProxyDelegate> proxy_delegate_; std::unique_ptr<ProxyDelegate> proxy_delegate_;
ProxyDelegate* shared_proxy_delegate_; ProxyDelegate* shared_proxy_delegate_ = nullptr;
std::unique_ptr<CookieStore> cookie_store_; std::unique_ptr<CookieStore> cookie_store_;
std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_; std::unique_ptr<HttpAuthHandlerFactory> http_auth_handler_factory_;
HttpAuthHandlerFactory* shared_http_auth_handler_factory_; HttpAuthHandlerFactory* shared_http_auth_handler_factory_ = nullptr;
std::unique_ptr<CertVerifier> cert_verifier_; std::unique_ptr<CertVerifier> cert_verifier_;
CertVerifier* shared_cert_verifier_; CertVerifier* shared_cert_verifier_ = nullptr;
std::unique_ptr<CTVerifier> ct_verifier_; std::unique_ptr<CTVerifier> ct_verifier_;
std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer_; std::unique_ptr<CTPolicyEnforcer> ct_policy_enforcer_;
#if BUILDFLAG(ENABLE_REPORTING) #if BUILDFLAG(ENABLE_REPORTING)
std::unique_ptr<ReportingPolicy> reporting_policy_; std::unique_ptr<ReportingPolicy> reporting_policy_;
bool network_error_logging_enabled_; bool network_error_logging_enabled_ = false;
#endif // BUILDFLAG(ENABLE_REPORTING) #endif // BUILDFLAG(ENABLE_REPORTING)
std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_; std::vector<std::unique_ptr<URLRequestInterceptor>> url_request_interceptors_;
CreateInterceptingJobFactory create_intercepting_job_factory_; CreateInterceptingJobFactory create_intercepting_job_factory_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment