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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
439 if (!params.channel_id_service) { | 439 if (!params.channel_id_service) { |
440 // The main context may not have a ChannelIDService, since it is lazily | 440 // The main context may not have a ChannelIDService, since it is lazily |
441 // constructed. If not, build an ephemeral ChannelIDService with no backing | 441 // constructed. If not, build an ephemeral ChannelIDService with no backing |
442 // disk store. | 442 // disk store. |
443 // TODO(ellyjones): support persisting ChannelID. | 443 // TODO(ellyjones): support persisting ChannelID. |
444 params.channel_id_service = new net::ChannelIDService( | 444 params.channel_id_service = new net::ChannelIDService( |
445 new net::DefaultChannelIDStore(NULL), | 445 new net::DefaultChannelIDStore(NULL), |
446 base::WorkerPool::GetTaskRunner(true)); | 446 base::WorkerPool::GetTaskRunner(true)); |
447 } | 447 } |
448 | 448 |
449 net::HttpCache* main_cache = new net::HttpCache(params, main_backend); | 449 // TODO(mmenke): These really shouldn't be leaked. |
450 // See http://crbug.com/523858. | |
pauljensen
2015/09/11 13:05:25
nit: http->https or personally I'd shorten it to j
mmenke
2015/09/11 14:46:49
Done (Went with https - some editors have build-in
| |
451 net::HttpNetworkSession* http_network_session = | |
452 new net::HttpNetworkSession(params); | |
453 net::HttpCache* main_cache = new net::HttpCache( | |
454 http_network_session, main_backend, true /* set_up_quic_server_info */); | |
450 main_context_->set_http_transaction_factory(main_cache); | 455 main_context_->set_http_transaction_factory(main_cache); |
451 | 456 |
452 // Cookies | 457 // Cookies |
453 scoped_refptr<net::CookieStore> cookie_store = | 458 scoped_refptr<net::CookieStore> cookie_store = |
454 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); | 459 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); |
455 main_context_->set_cookie_store(cookie_store.get()); | 460 main_context_->set_cookie_store(cookie_store.get()); |
456 | 461 |
457 net::URLRequestJobFactoryImpl* job_factory = | 462 net::URLRequestJobFactoryImpl* job_factory = |
458 new net::URLRequestJobFactoryImpl; | 463 new net::URLRequestJobFactoryImpl; |
459 job_factory->SetProtocolHandler( | 464 job_factory->SetProtocolHandler( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 if (backend) | 501 if (backend) |
497 backend->DoomAllEntries(client_callback); | 502 backend->DoomAllEntries(client_callback); |
498 }); | 503 }); |
499 int rc = cache->GetBackend(&backend, doom_callback); | 504 int rc = cache->GetBackend(&backend, doom_callback); |
500 if (rc != net::ERR_IO_PENDING) { | 505 if (rc != net::ERR_IO_PENDING) { |
501 // GetBackend doesn't call the callback if it completes synchronously, so | 506 // GetBackend doesn't call the callback if it completes synchronously, so |
502 // call it directly here. | 507 // call it directly here. |
503 doom_callback.Run(rc); | 508 doom_callback.Run(rc); |
504 } | 509 } |
505 } | 510 } |
OLD | NEW |