| 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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } | 212 base::WeakPtr<HttpCache> GetWeakPtr() { return weak_factory_.GetWeakPtr(); } |
| 210 | 213 |
| 211 // Resets the network layer to allow for tests that probe | 214 // Resets the network layer to allow for tests that probe |
| 212 // network changes (e.g. host unreachable). The old network layer is | 215 // network changes (e.g. host unreachable). The old network layer is |
| 213 // returned to allow for filter patterns that only intercept | 216 // returned to allow for filter patterns that only intercept |
| 214 // some creation requests. Note ownership exchange. | 217 // some creation requests. Note ownership exchange. |
| 215 std::unique_ptr<HttpTransactionFactory> | 218 std::unique_ptr<HttpTransactionFactory> |
| 216 SetHttpNetworkTransactionFactoryForTesting( | 219 SetHttpNetworkTransactionFactoryForTesting( |
| 217 std::unique_ptr<HttpTransactionFactory> new_network_layer); | 220 std::unique_ptr<HttpTransactionFactory> new_network_layer); |
| 218 | 221 |
| 222 // Dumps memory allocation stats. |parent_dump_absolute_name| is the name |
| 223 // used by the parent MemoryAllocatorDump in the memory dump hierarchy. |
| 224 void DumpMemoryStats(base::trace_event::ProcessMemoryDump* pmd, |
| 225 const std::string& parent_absolute_name) const; |
| 226 |
| 219 private: | 227 private: |
| 220 // Types -------------------------------------------------------------------- | 228 // Types -------------------------------------------------------------------- |
| 221 | 229 |
| 222 // Disk cache entry data indices. | 230 // Disk cache entry data indices. |
| 223 enum { | 231 enum { |
| 224 kResponseInfoIndex = 0, | 232 kResponseInfoIndex = 0, |
| 225 kResponseContentIndex, | 233 kResponseContentIndex, |
| 226 kMetadataIndex, | 234 kMetadataIndex, |
| 227 | 235 |
| 228 // Must remain at the end of the enum. | 236 // Must remain at the end of the enum. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 std::unique_ptr<base::Clock> clock_; | 431 std::unique_ptr<base::Clock> clock_; |
| 424 | 432 |
| 425 base::WeakPtrFactory<HttpCache> weak_factory_; | 433 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 426 | 434 |
| 427 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 435 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 428 }; | 436 }; |
| 429 | 437 |
| 430 } // namespace net | 438 } // namespace net |
| 431 | 439 |
| 432 #endif // NET_HTTP_HTTP_CACHE_H_ | 440 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |