| 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 // This file declares a HttpTransactionFactory implementation that can be | 5 // This file declares a HttpTransactionFactory implementation that can be |
| 6 // layered on top of another HttpTransactionFactory to add HTTP caching. The | 6 // layered on top of another HttpTransactionFactory to add HTTP caching. The |
| 7 // caching logic follows RFC 7234 (any exceptions are called out in the code). | 7 // caching logic follows RFC 7234 (any exceptions are called out in the code). |
| 8 // | 8 // |
| 9 // The HttpCache takes a disk_cache::Backend as a parameter, and uses that for | 9 // The HttpCache takes a disk_cache::Backend as a parameter, and uses that for |
| 10 // the cache storage. | 10 // the cache storage. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "net/base/load_states.h" | 31 #include "net/base/load_states.h" |
| 32 #include "net/base/net_export.h" | 32 #include "net/base/net_export.h" |
| 33 #include "net/base/request_priority.h" | 33 #include "net/base/request_priority.h" |
| 34 #include "net/http/http_network_session.h" | 34 #include "net/http/http_network_session.h" |
| 35 #include "net/http/http_transaction_factory.h" | 35 #include "net/http/http_transaction_factory.h" |
| 36 | 36 |
| 37 class GURL; | 37 class GURL; |
| 38 | 38 |
| 39 namespace base { | 39 namespace base { |
| 40 class SingleThreadTaskRunner; | 40 class SingleThreadTaskRunner; |
| 41 namespace trace_event { |
| 42 class ProcessMemoryDump; |
| 43 } |
| 41 } // namespace base | 44 } // namespace base |
| 42 | 45 |
| 43 namespace disk_cache { | 46 namespace disk_cache { |
| 44 class Backend; | 47 class Backend; |
| 45 class Entry; | 48 class Entry; |
| 46 } // namespace disk_cache | 49 } // namespace disk_cache |
| 47 | 50 |
| 48 namespace net { | 51 namespace net { |
| 49 | 52 |
| 50 class HttpNetworkSession; | 53 class HttpNetworkSession; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } | 211 base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } |
| 209 | 212 |
| 210 // Resets the network layer to allow for tests that probe | 213 // Resets the network layer to allow for tests that probe |
| 211 // network changes (e.g. host unreachable). The old network layer is | 214 // network changes (e.g. host unreachable). The old network layer is |
| 212 // returned to allow for filter patterns that only intercept | 215 // returned to allow for filter patterns that only intercept |
| 213 // some creation requests. Note ownership exchange. | 216 // some creation requests. Note ownership exchange. |
| 214 std::unique_ptr<HttpTransactionFactory> | 217 std::unique_ptr<HttpTransactionFactory> |
| 215 SetHttpNetworkTransactionFactoryForTesting( | 218 SetHttpNetworkTransactionFactoryForTesting( |
| 216 std::unique_ptr<HttpTransactionFactory> new_network_layer); | 219 std::unique_ptr<HttpTransactionFactory> new_network_layer); |
| 217 | 220 |
| 221 // Dumps memory allocation stats. |parent_dump_absolute_name| is the name |
| 222 // used by the parent MemoryAllocatorDump in the memory dump hierarchy. |
| 223 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, |
| 224 const std::string& parent_absolute_name) const; |
| 225 |
| 218 private: | 226 private: |
| 219 // Types -------------------------------------------------------------------- | 227 // Types -------------------------------------------------------------------- |
| 220 | 228 |
| 221 // Disk cache entry data indices. | 229 // Disk cache entry data indices. |
| 222 enum { | 230 enum { |
| 223 kResponseInfoIndex = 0, | 231 kResponseInfoIndex = 0, |
| 224 kResponseContentIndex, | 232 kResponseContentIndex, |
| 225 kMetadataIndex, | 233 kMetadataIndex, |
| 226 | 234 |
| 227 // Must remain at the end of the enum. | 235 // Must remain at the end of the enum. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 std::unique_ptr<base::Clock> clock_; | 430 std::unique_ptr<base::Clock> clock_; |
| 423 | 431 |
| 424 base::WeakPtrFactory<HttpCache> weak_factory_; | 432 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 425 | 433 |
| 426 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 434 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 427 }; | 435 }; |
| 428 | 436 |
| 429 } // namespace net | 437 } // namespace net |
| 430 | 438 |
| 431 #endif // NET_HTTP_HTTP_CACHE_H_ | 439 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |