| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/profiles/profile_impl_io_data.h" | 5 #include "chrome/browser/profiles/profile_impl_io_data.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 | 408 |
| 409 set_server_bound_cert_service(server_bound_cert_service); | 409 set_server_bound_cert_service(server_bound_cert_service); |
| 410 main_context->set_server_bound_cert_service(server_bound_cert_service); | 410 main_context->set_server_bound_cert_service(server_bound_cert_service); |
| 411 | 411 |
| 412 net::HttpCache::DefaultBackend* main_backend = | 412 net::HttpCache::DefaultBackend* main_backend = |
| 413 new net::HttpCache::DefaultBackend( | 413 new net::HttpCache::DefaultBackend( |
| 414 net::DISK_CACHE, | 414 net::DISK_CACHE, |
| 415 ChooseCacheBackendType(), | 415 ChooseCacheBackendType(), |
| 416 lazy_params_->cache_path, | 416 lazy_params_->cache_path, |
| 417 lazy_params_->cache_max_size, | 417 lazy_params_->cache_max_size, |
| 418 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 418 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) |
| 419 .get()); |
| 419 net::HttpNetworkSession::Params network_session_params; | 420 net::HttpNetworkSession::Params network_session_params; |
| 420 PopulateNetworkSessionParams(profile_params, &network_session_params); | 421 PopulateNetworkSessionParams(profile_params, &network_session_params); |
| 421 net::HttpCache* main_cache = new net::HttpCache( | 422 net::HttpCache* main_cache = new net::HttpCache( |
| 422 network_session_params, main_backend); | 423 network_session_params, main_backend); |
| 423 main_cache->InitializeInfiniteCache(lazy_params_->infinite_cache_path); | 424 main_cache->InitializeInfiniteCache(lazy_params_->infinite_cache_path); |
| 424 | 425 |
| 425 #if defined(OS_ANDROID) | 426 #if defined(OS_ANDROID) |
| 426 ChromeDataReductionProxyAndroid::Init(main_cache->GetSession()); | 427 ChromeDataReductionProxyAndroid::Init(main_cache->GetSession()); |
| 427 #endif | 428 #endif |
| 428 | 429 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 // Use a separate HTTP disk cache for isolated apps. | 532 // Use a separate HTTP disk cache for isolated apps. |
| 532 net::HttpCache::BackendFactory* app_backend = NULL; | 533 net::HttpCache::BackendFactory* app_backend = NULL; |
| 533 if (partition_descriptor.in_memory) { | 534 if (partition_descriptor.in_memory) { |
| 534 app_backend = net::HttpCache::DefaultBackend::InMemory(0); | 535 app_backend = net::HttpCache::DefaultBackend::InMemory(0); |
| 535 } else { | 536 } else { |
| 536 app_backend = new net::HttpCache::DefaultBackend( | 537 app_backend = new net::HttpCache::DefaultBackend( |
| 537 net::DISK_CACHE, | 538 net::DISK_CACHE, |
| 538 ChooseCacheBackendType(), | 539 ChooseCacheBackendType(), |
| 539 cache_path, | 540 cache_path, |
| 540 app_cache_max_size_, | 541 app_cache_max_size_, |
| 541 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 542 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) |
| 543 .get()); |
| 542 } | 544 } |
| 543 net::HttpNetworkSession* main_network_session = | 545 net::HttpNetworkSession* main_network_session = |
| 544 main_http_factory_->GetSession(); | 546 main_http_factory_->GetSession(); |
| 545 net::HttpCache* app_http_cache = | 547 net::HttpCache* app_http_cache = |
| 546 new net::HttpCache(main_network_session, app_backend); | 548 new net::HttpCache(main_network_session, app_backend); |
| 547 | 549 |
| 548 scoped_refptr<net::CookieStore> cookie_store = NULL; | 550 scoped_refptr<net::CookieStore> cookie_store = NULL; |
| 549 if (partition_descriptor.in_memory) { | 551 if (partition_descriptor.in_memory) { |
| 550 cookie_store = new net::CookieMonster(NULL, NULL); | 552 cookie_store = new net::CookieMonster(NULL, NULL); |
| 551 } else if (record_mode || playback_mode) { | 553 } else if (record_mode || playback_mode) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 cache_path = partition_descriptor.path.Append(chrome::kMediaCacheDirname); | 624 cache_path = partition_descriptor.path.Append(chrome::kMediaCacheDirname); |
| 623 } | 625 } |
| 624 | 626 |
| 625 // Use a separate HTTP disk cache for isolated apps. | 627 // Use a separate HTTP disk cache for isolated apps. |
| 626 net::HttpCache::BackendFactory* media_backend = | 628 net::HttpCache::BackendFactory* media_backend = |
| 627 new net::HttpCache::DefaultBackend( | 629 new net::HttpCache::DefaultBackend( |
| 628 net::MEDIA_CACHE, | 630 net::MEDIA_CACHE, |
| 629 ChooseCacheBackendType(), | 631 ChooseCacheBackendType(), |
| 630 cache_path, | 632 cache_path, |
| 631 cache_max_size, | 633 cache_max_size, |
| 632 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE)); | 634 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE) |
| 635 .get()); |
| 633 net::HttpNetworkSession* main_network_session = | 636 net::HttpNetworkSession* main_network_session = |
| 634 main_http_factory_->GetSession(); | 637 main_http_factory_->GetSession(); |
| 635 scoped_ptr<net::HttpTransactionFactory> media_http_cache( | 638 scoped_ptr<net::HttpTransactionFactory> media_http_cache( |
| 636 new net::HttpCache(main_network_session, media_backend)); | 639 new net::HttpCache(main_network_session, media_backend)); |
| 637 | 640 |
| 638 // Transfer ownership of the cache to MediaRequestContext. | 641 // Transfer ownership of the cache to MediaRequestContext. |
| 639 context->SetHttpTransactionFactory(media_http_cache.Pass()); | 642 context->SetHttpTransactionFactory(media_http_cache.Pass()); |
| 640 | 643 |
| 641 // Note that we do not create a new URLRequestJobFactory because | 644 // Note that we do not create a new URLRequestJobFactory because |
| 642 // the media context should behave exactly like its parent context | 645 // the media context should behave exactly like its parent context |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 const base::Closure& completion) { | 693 const base::Closure& completion) { |
| 691 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 694 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 692 DCHECK(initialized()); | 695 DCHECK(initialized()); |
| 693 | 696 |
| 694 DCHECK(transport_security_state()); | 697 DCHECK(transport_security_state()); |
| 695 // Completes synchronously. | 698 // Completes synchronously. |
| 696 transport_security_state()->DeleteAllDynamicDataSince(time); | 699 transport_security_state()->DeleteAllDynamicDataSince(time); |
| 697 DCHECK(http_server_properties_manager_); | 700 DCHECK(http_server_properties_manager_); |
| 698 http_server_properties_manager_->Clear(completion); | 701 http_server_properties_manager_->Clear(completion); |
| 699 } | 702 } |
| OLD | NEW |