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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
345 | 345 |
346 // TODO(mmenke): These really shouldn't be leaked. | 346 // TODO(mmenke): These really shouldn't be leaked. |
347 // See https://crbug.com/523858. | 347 // See https://crbug.com/523858. |
348 net::HttpNetworkSession* http_network_session = | 348 net::HttpNetworkSession* http_network_session = |
349 new net::HttpNetworkSession(params); | 349 new net::HttpNetworkSession(params); |
350 net::HttpCache* main_cache = | 350 net::HttpCache* main_cache = |
351 new net::HttpCache(http_network_session, std::move(main_backend), | 351 new net::HttpCache(http_network_session, std::move(main_backend), |
352 true /* set_up_quic_server_info */); | 352 true /* set_up_quic_server_info */); |
353 main_context_->set_http_transaction_factory(main_cache); | 353 main_context_->set_http_transaction_factory(main_cache); |
354 | 354 |
355 net::URLRequestJobFactoryImpl* job_factory = | 355 std::unique_ptr<net::URLRequestJobFactoryImpl> job_factory = |
356 new net::URLRequestJobFactoryImpl; | 356 net::URLRequestJobFactoryImpl::CreateWithDefaultProtocolHandlers(); |
mmenke
2016/04/22 18:37:52
Could you add a TODO about fixing this leak?
mgersh
2016/04/22 20:27:15
This function, and the crnet equivalent, already h
mmenke
2016/04/22 20:41:04
I'd say yes, just to make it clearer that this is
mgersh
2016/04/27 16:13:52
Done.
| |
357 main_context_->set_job_factory(job_factory); | 357 main_context_->set_job_factory(job_factory.release()); |
358 main_context_->set_net_log(net_log_.get()); | 358 main_context_->set_net_log(net_log_.get()); |
359 } | 359 } |
360 | 360 |
361 std::string CronetEnvironment::user_agent() { | 361 std::string CronetEnvironment::user_agent() { |
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 |