| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/cronet/ios/cronet_environment.h" | 5 #include "components/cronet/ios/cronet_environment.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 if (!PathService::Get(base::DIR_HOME, &ssl_key_log_file)) | 235 if (!PathService::Get(base::DIR_HOME, &ssl_key_log_file)) |
| 236 return; | 236 return; |
| 237 net::SSLClientSocket::SetSSLKeyLogFile( | 237 net::SSLClientSocket::SetSSLKeyLogFile( |
| 238 ssl_key_log_file.Append(ssl_key_log_file_name_), | 238 ssl_key_log_file.Append(ssl_key_log_file_name_), |
| 239 file_thread_->task_runner()); | 239 file_thread_->task_runner()); |
| 240 } | 240 } |
| 241 | 241 |
| 242 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( | 242 proxy_config_service_ = net::ProxyService::CreateSystemProxyConfigService( |
| 243 network_io_thread_->task_runner(), nullptr); | 243 network_io_thread_->task_runner(), nullptr); |
| 244 | 244 |
| 245 #if defined(USE_NSS_VERIFIER) | 245 #if defined(USE_NSS_CERTS) |
| 246 net::SetURLRequestContextForNSSHttpIO(main_context_.get()); | 246 net::SetURLRequestContextForNSSHttpIO(main_context_.get()); |
| 247 #endif | 247 #endif |
| 248 base::subtle::MemoryBarrier(); | 248 base::subtle::MemoryBarrier(); |
| 249 PostToNetworkThread(FROM_HERE, | 249 PostToNetworkThread(FROM_HERE, |
| 250 base::Bind(&CronetEnvironment::InitializeOnNetworkThread, | 250 base::Bind(&CronetEnvironment::InitializeOnNetworkThread, |
| 251 base::Unretained(this))); | 251 base::Unretained(this))); |
| 252 } | 252 } |
| 253 | 253 |
| 254 CronetEnvironment::~CronetEnvironment() { | 254 CronetEnvironment::~CronetEnvironment() { |
| 255 // net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); | 255 // net::HTTPProtocolHandlerDelegate::SetInstance(nullptr); |
| 256 #if defined(USE_NSS_VERIFIER) | 256 #if defined(USE_NSS_CERTS) |
| 257 net::SetURLRequestContextForNSSHttpIO(nullptr); | 257 net::SetURLRequestContextForNSSHttpIO(nullptr); |
| 258 #endif | 258 #endif |
| 259 } | 259 } |
| 260 | 260 |
| 261 void CronetEnvironment::InitializeOnNetworkThread() { | 261 void CronetEnvironment::InitializeOnNetworkThread() { |
| 262 DCHECK(network_io_thread_->task_runner()->BelongsToCurrentThread()); | 262 DCHECK(network_io_thread_->task_runner()->BelongsToCurrentThread()); |
| 263 main_context_.reset(new net::URLRequestContext); | 263 main_context_.reset(new net::URLRequestContext); |
| 264 main_context_->set_net_log(net_log_.get()); | 264 main_context_->set_net_log(net_log_.get()); |
| 265 std::string user_agent(user_agent_product_name_ + | 265 std::string user_agent(user_agent_product_name_ + |
| 266 " (iOS); Cronet/" CRONET_VERSION); | 266 " (iOS); Cronet/" CRONET_VERSION); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 const net::HttpUserAgentSettings* user_agent_settings = | 362 const net::HttpUserAgentSettings* user_agent_settings = |
| 363 main_context_->http_user_agent_settings(); | 363 main_context_->http_user_agent_settings(); |
| 364 if (!user_agent_settings) { | 364 if (!user_agent_settings) { |
| 365 return nullptr; | 365 return nullptr; |
| 366 } | 366 } |
| 367 | 367 |
| 368 return user_agent_settings->GetUserAgent(); | 368 return user_agent_settings->GetUserAgent(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 } // namespace cronet | 371 } // namespace cronet |
| OLD | NEW |