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. |
pauljensen
2015/09/02 14:32:29
Perhaps expanding and mentioning http://crbug.com/
mmenke
2015/09/02 16:29:33
Done.
| |
450 net::HttpNetworkSession* http_network_session = | |
451 new net::HttpNetworkSession(params); | |
452 net::HttpCache* main_cache = new net::HttpCache( | |
453 http_network_session, main_backend, true); | |
450 main_context_->set_http_transaction_factory(main_cache); | 454 main_context_->set_http_transaction_factory(main_cache); |
451 | 455 |
452 // Cookies | 456 // Cookies |
453 scoped_refptr<net::CookieStore> cookie_store = | 457 scoped_refptr<net::CookieStore> cookie_store = |
454 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); | 458 net::CookieStoreIOS::CreateCookieStoreFromNSHTTPCookieStorage(); |
455 main_context_->set_cookie_store(cookie_store.get()); | 459 main_context_->set_cookie_store(cookie_store.get()); |
456 | 460 |
457 net::URLRequestJobFactoryImpl* job_factory = | 461 net::URLRequestJobFactoryImpl* job_factory = |
458 new net::URLRequestJobFactoryImpl; | 462 new net::URLRequestJobFactoryImpl; |
459 job_factory->SetProtocolHandler( | 463 job_factory->SetProtocolHandler( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 if (backend) | 500 if (backend) |
497 backend->DoomAllEntries(client_callback); | 501 backend->DoomAllEntries(client_callback); |
498 }); | 502 }); |
499 int rc = cache->GetBackend(&backend, doom_callback); | 503 int rc = cache->GetBackend(&backend, doom_callback); |
500 if (rc != net::ERR_IO_PENDING) { | 504 if (rc != net::ERR_IO_PENDING) { |
501 // GetBackend doesn't call the callback if it completes synchronously, so | 505 // GetBackend doesn't call the callback if it completes synchronously, so |
502 // call it directly here. | 506 // call it directly here. |
503 doom_callback.Run(rc); | 507 doom_callback.Run(rc); |
504 } | 508 } |
505 } | 509 } |
OLD | NEW |