| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "net/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 SSLConfigService* ssl_config_service, | 1591 SSLConfigService* ssl_config_service, |
| 1592 const std::wstring& cache_dir, | 1592 const std::wstring& cache_dir, |
| 1593 int cache_size) | 1593 int cache_size) |
| 1594 : disk_cache_dir_(cache_dir), | 1594 : disk_cache_dir_(cache_dir), |
| 1595 mode_(NORMAL), | 1595 mode_(NORMAL), |
| 1596 type_(DISK_CACHE), | 1596 type_(DISK_CACHE), |
| 1597 network_layer_(HttpNetworkLayer::CreateFactory( | 1597 network_layer_(HttpNetworkLayer::CreateFactory( |
| 1598 host_resolver, proxy_service, ssl_config_service)), | 1598 host_resolver, proxy_service, ssl_config_service)), |
| 1599 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), | 1599 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), |
| 1600 in_memory_cache_(false), | 1600 in_memory_cache_(false), |
| 1601 enable_range_support_(false), | 1601 enable_range_support_(true), |
| 1602 cache_size_(cache_size) { | 1602 cache_size_(cache_size) { |
| 1603 } | 1603 } |
| 1604 | 1604 |
| 1605 HttpCache::HttpCache(HttpNetworkSession* session, | 1605 HttpCache::HttpCache(HttpNetworkSession* session, |
| 1606 const std::wstring& cache_dir, | 1606 const std::wstring& cache_dir, |
| 1607 int cache_size) | 1607 int cache_size) |
| 1608 : disk_cache_dir_(cache_dir), | 1608 : disk_cache_dir_(cache_dir), |
| 1609 mode_(NORMAL), | 1609 mode_(NORMAL), |
| 1610 type_(DISK_CACHE), | 1610 type_(DISK_CACHE), |
| 1611 network_layer_(HttpNetworkLayer::CreateFactory(session)), | 1611 network_layer_(HttpNetworkLayer::CreateFactory(session)), |
| 1612 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), | 1612 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), |
| 1613 in_memory_cache_(false), | 1613 in_memory_cache_(false), |
| 1614 enable_range_support_(false), | 1614 enable_range_support_(true), |
| 1615 cache_size_(cache_size) { | 1615 cache_size_(cache_size) { |
| 1616 } | 1616 } |
| 1617 | 1617 |
| 1618 HttpCache::HttpCache(HostResolver* host_resolver, | 1618 HttpCache::HttpCache(HostResolver* host_resolver, |
| 1619 ProxyService* proxy_service, | 1619 ProxyService* proxy_service, |
| 1620 SSLConfigService* ssl_config_service, | 1620 SSLConfigService* ssl_config_service, |
| 1621 int cache_size) | 1621 int cache_size) |
| 1622 : mode_(NORMAL), | 1622 : mode_(NORMAL), |
| 1623 type_(MEMORY_CACHE), | 1623 type_(MEMORY_CACHE), |
| 1624 network_layer_(HttpNetworkLayer::CreateFactory( | 1624 network_layer_(HttpNetworkLayer::CreateFactory( |
| 1625 host_resolver, proxy_service, ssl_config_service)), | 1625 host_resolver, proxy_service, ssl_config_service)), |
| 1626 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), | 1626 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), |
| 1627 in_memory_cache_(true), | 1627 in_memory_cache_(true), |
| 1628 enable_range_support_(false), | 1628 enable_range_support_(true), |
| 1629 cache_size_(cache_size) { | 1629 cache_size_(cache_size) { |
| 1630 } | 1630 } |
| 1631 | 1631 |
| 1632 HttpCache::HttpCache(HttpTransactionFactory* network_layer, | 1632 HttpCache::HttpCache(HttpTransactionFactory* network_layer, |
| 1633 disk_cache::Backend* disk_cache) | 1633 disk_cache::Backend* disk_cache) |
| 1634 : mode_(NORMAL), | 1634 : mode_(NORMAL), |
| 1635 type_(DISK_CACHE), | 1635 type_(DISK_CACHE), |
| 1636 network_layer_(network_layer), | 1636 network_layer_(network_layer), |
| 1637 disk_cache_(disk_cache), | 1637 disk_cache_(disk_cache), |
| 1638 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), | 1638 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), |
| 1639 in_memory_cache_(false), | 1639 in_memory_cache_(false), |
| 1640 enable_range_support_(false), | 1640 enable_range_support_(true), |
| 1641 cache_size_(0) { | 1641 cache_size_(0) { |
| 1642 } | 1642 } |
| 1643 | 1643 |
| 1644 HttpCache::~HttpCache() { | 1644 HttpCache::~HttpCache() { |
| 1645 // If we have any active entries remaining, then we need to deactivate them. | 1645 // If we have any active entries remaining, then we need to deactivate them. |
| 1646 // We may have some pending calls to OnProcessPendingQueue, but since those | 1646 // We may have some pending calls to OnProcessPendingQueue, but since those |
| 1647 // won't run (due to our destruction), we can simply ignore the corresponding | 1647 // won't run (due to our destruction), we can simply ignore the corresponding |
| 1648 // will_process_pending_queue flag. | 1648 // will_process_pending_queue flag. |
| 1649 while (!active_entries_.empty()) { | 1649 while (!active_entries_.empty()) { |
| 1650 ActiveEntry* entry = active_entries_.begin()->second; | 1650 ActiveEntry* entry = active_entries_.begin()->second; |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2048 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); | 2048 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); |
| 2049 HttpNetworkSession* session = network->GetSession(); | 2049 HttpNetworkSession* session = network->GetSession(); |
| 2050 if (session) { | 2050 if (session) { |
| 2051 session->tcp_socket_pool()->CloseIdleSockets(); | 2051 session->tcp_socket_pool()->CloseIdleSockets(); |
| 2052 } | 2052 } |
| 2053 } | 2053 } |
| 2054 | 2054 |
| 2055 //----------------------------------------------------------------------------- | 2055 //----------------------------------------------------------------------------- |
| 2056 | 2056 |
| 2057 } // namespace net | 2057 } // namespace net |
| OLD | NEW |