OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/crnet/crnet_environment.h" | 5 #include "ios/crnet/crnet_environment.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 if (!params.channel_id_service) { | 444 if (!params.channel_id_service) { |
445 // The main context may not have a ChannelIDService, since it is lazily | 445 // The main context may not have a ChannelIDService, since it is lazily |
446 // constructed. If not, build an ephemeral ChannelIDService with no backing | 446 // constructed. If not, build an ephemeral ChannelIDService with no backing |
447 // disk store. | 447 // disk store. |
448 // TODO(ellyjones): support persisting ChannelID. | 448 // TODO(ellyjones): support persisting ChannelID. |
449 params.channel_id_service = new net::ChannelIDService( | 449 params.channel_id_service = new net::ChannelIDService( |
450 new net::DefaultChannelIDStore(NULL), | 450 new net::DefaultChannelIDStore(NULL), |
451 base::WorkerPool::GetTaskRunner(true)); | 451 base::WorkerPool::GetTaskRunner(true)); |
452 } | 452 } |
453 | 453 |
454 net::HttpCache* main_cache = new net::HttpCache(params, main_backend); | 454 // TODO(mmenke): These really shouldn't be leaked. |
| 455 // See https://crbug.com/523858. |
| 456 net::HttpNetworkSession* http_network_session = |
| 457 new net::HttpNetworkSession(params); |
| 458 net::HttpCache* main_cache = new net::HttpCache( |
| 459 http_network_session, main_backend, true /* set_up_quic_server_info */); |
455 main_context_->set_http_transaction_factory(main_cache); | 460 main_context_->set_http_transaction_factory(main_cache); |
456 | 461 |
457 // Cookies | 462 // Cookies |
458 scoped_refptr<net::CookieStore> cookie_store = | 463 scoped_refptr<net::CookieStore> cookie_store = |
459 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); | 464 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); |
460 main_context_->set_cookie_store(cookie_store.get()); | 465 main_context_->set_cookie_store(cookie_store.get()); |
461 | 466 |
462 net::URLRequestJobFactoryImpl* job_factory = | 467 net::URLRequestJobFactoryImpl* job_factory = |
463 new net::URLRequestJobFactoryImpl; | 468 new net::URLRequestJobFactoryImpl; |
464 job_factory->SetProtocolHandler( | 469 job_factory->SetProtocolHandler( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 if (backend) | 506 if (backend) |
502 backend->DoomAllEntries(client_callback); | 507 backend->DoomAllEntries(client_callback); |
503 }); | 508 }); |
504 int rc = cache->GetBackend(&backend, doom_callback); | 509 int rc = cache->GetBackend(&backend, doom_callback); |
505 if (rc != net::ERR_IO_PENDING) { | 510 if (rc != net::ERR_IO_PENDING) { |
506 // GetBackend doesn't call the callback if it completes synchronously, so | 511 // GetBackend doesn't call the callback if it completes synchronously, so |
507 // call it directly here. | 512 // call it directly here. |
508 doom_callback.Run(rc); | 513 doom_callback.Run(rc); |
509 } | 514 } |
510 } | 515 } |
OLD | NEW |