OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 | 10 |
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 read_offset_ += result; | 953 read_offset_ += result; |
954 } else if (result == 0) { // end of file | 954 } else if (result == 0) { // end of file |
955 cache_->DoneReadingFromEntry(entry_, this); | 955 cache_->DoneReadingFromEntry(entry_, this); |
956 entry_ = NULL; | 956 entry_ = NULL; |
957 } | 957 } |
958 HandleResult(result); | 958 HandleResult(result); |
959 } | 959 } |
960 | 960 |
961 //----------------------------------------------------------------------------- | 961 //----------------------------------------------------------------------------- |
962 | 962 |
963 HttpCache::HttpCache(ProxyService* proxy_service, | 963 HttpCache::HttpCache(HostResolver* host_resolver, |
| 964 ProxyService* proxy_service, |
964 const std::wstring& cache_dir, | 965 const std::wstring& cache_dir, |
965 int cache_size) | 966 int cache_size) |
966 : disk_cache_dir_(cache_dir), | 967 : disk_cache_dir_(cache_dir), |
967 mode_(NORMAL), | 968 mode_(NORMAL), |
968 type_(DISK_CACHE), | 969 type_(DISK_CACHE), |
969 network_layer_(HttpNetworkLayer::CreateFactory(proxy_service)), | 970 network_layer_(HttpNetworkLayer::CreateFactory( |
| 971 host_resolver, proxy_service)), |
970 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), | 972 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), |
971 in_memory_cache_(false), | 973 in_memory_cache_(false), |
972 cache_size_(cache_size) { | 974 cache_size_(cache_size) { |
973 } | 975 } |
974 | 976 |
975 HttpCache::HttpCache(HttpNetworkSession* session, | 977 HttpCache::HttpCache(HttpNetworkSession* session, |
976 const std::wstring& cache_dir, | 978 const std::wstring& cache_dir, |
977 int cache_size) | 979 int cache_size) |
978 : disk_cache_dir_(cache_dir), | 980 : disk_cache_dir_(cache_dir), |
979 mode_(NORMAL), | 981 mode_(NORMAL), |
980 type_(DISK_CACHE), | 982 type_(DISK_CACHE), |
981 network_layer_(HttpNetworkLayer::CreateFactory(session)), | 983 network_layer_(HttpNetworkLayer::CreateFactory(session)), |
982 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), | 984 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), |
983 in_memory_cache_(false), | 985 in_memory_cache_(false), |
984 cache_size_(cache_size) { | 986 cache_size_(cache_size) { |
985 } | 987 } |
986 | 988 |
987 HttpCache::HttpCache(ProxyService* proxy_service, int cache_size) | 989 HttpCache::HttpCache(HostResolver* host_resolver, |
| 990 ProxyService* proxy_service, |
| 991 int cache_size) |
988 : mode_(NORMAL), | 992 : mode_(NORMAL), |
989 type_(MEMORY_CACHE), | 993 type_(MEMORY_CACHE), |
990 network_layer_(HttpNetworkLayer::CreateFactory(proxy_service)), | 994 network_layer_(HttpNetworkLayer::CreateFactory( |
| 995 host_resolver, proxy_service)), |
991 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), | 996 ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)), |
992 in_memory_cache_(true), | 997 in_memory_cache_(true), |
993 cache_size_(cache_size) { | 998 cache_size_(cache_size) { |
994 } | 999 } |
995 | 1000 |
996 HttpCache::HttpCache(HttpTransactionFactory* network_layer, | 1001 HttpCache::HttpCache(HttpTransactionFactory* network_layer, |
997 disk_cache::Backend* disk_cache) | 1002 disk_cache::Backend* disk_cache) |
998 : mode_(NORMAL), | 1003 : mode_(NORMAL), |
999 type_(DISK_CACHE), | 1004 type_(DISK_CACHE), |
1000 network_layer_(network_layer), | 1005 network_layer_(network_layer), |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); | 1480 static_cast<net::HttpNetworkLayer*>(network_layer_.get()); |
1476 HttpNetworkSession* session = network->GetSession(); | 1481 HttpNetworkSession* session = network->GetSession(); |
1477 if (session) { | 1482 if (session) { |
1478 session->connection_pool()->CloseIdleSockets(); | 1483 session->connection_pool()->CloseIdleSockets(); |
1479 } | 1484 } |
1480 } | 1485 } |
1481 | 1486 |
1482 //----------------------------------------------------------------------------- | 1487 //----------------------------------------------------------------------------- |
1483 | 1488 |
1484 } // namespace net | 1489 } // namespace net |
OLD | NEW |