| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 // TODO(mmenke): These really shouldn't be leaked. | 337 // TODO(mmenke): These really shouldn't be leaked. |
| 338 // See https://crbug.com/523858. | 338 // See https://crbug.com/523858. |
| 339 net::HttpNetworkSession* http_network_session = | 339 net::HttpNetworkSession* http_network_session = |
| 340 new net::HttpNetworkSession(params); | 340 new net::HttpNetworkSession(params); |
| 341 net::HttpCache* main_cache = | 341 net::HttpCache* main_cache = |
| 342 new net::HttpCache(http_network_session, std::move(main_backend), | 342 new net::HttpCache(http_network_session, std::move(main_backend), |
| 343 true /* set_up_quic_server_info */); | 343 true /* set_up_quic_server_info */); |
| 344 main_context_->set_http_transaction_factory(main_cache); | 344 main_context_->set_http_transaction_factory(main_cache); |
| 345 | 345 |
| 346 net::URLRequestJobFactoryImpl* job_factory = | 346 // TODO(mgersh): Fix this leak too. See https://crbug.com/523858. |
| 347 new net::URLRequestJobFactoryImpl; | 347 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory = |
| 348 main_context_->set_job_factory(job_factory); | 348 net::URLRequestJobFactoryImpl::CreateWithHttpProtocolHandlers(); |
| 349 main_context_->set_job_factory(job_factory.release()); |
| 349 main_context_->set_net_log(net_log_.get()); | 350 main_context_->set_net_log(net_log_.get()); |
| 350 } | 351 } |
| 351 | 352 |
| 352 std::string CronetEnvironment::user_agent() { | 353 std::string CronetEnvironment::user_agent() { |
| 353 const net::HttpUserAgentSettings* user_agent_settings = | 354 const net::HttpUserAgentSettings* user_agent_settings = |
| 354 main_context_->http_user_agent_settings(); | 355 main_context_->http_user_agent_settings(); |
| 355 if (!user_agent_settings) { | 356 if (!user_agent_settings) { |
| 356 return nullptr; | 357 return nullptr; |
| 357 } | 358 } |
| 358 | 359 |
| 359 return user_agent_settings->GetUserAgent(); | 360 return user_agent_settings->GetUserAgent(); |
| 360 } | 361 } |
| 361 | 362 |
| 362 } // namespace cronet | 363 } // namespace cronet |
| OLD | NEW |