| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 public: | 62 public: |
| 63 // The cache mode of operation. | 63 // The cache mode of operation. |
| 64 enum Mode { | 64 enum Mode { |
| 65 // Normal mode just behaves like a standard web cache. | 65 // Normal mode just behaves like a standard web cache. |
| 66 NORMAL = 0, | 66 NORMAL = 0, |
| 67 // Disables reads and writes from the cache. | 67 // Disables reads and writes from the cache. |
| 68 // Equivalent to setting LOAD_DISABLE_CACHE on every request. | 68 // Equivalent to setting LOAD_DISABLE_CACHE on every request. |
| 69 DISABLE | 69 DISABLE |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 class WritersTest; |
| 73 |
| 72 // A BackendFactory creates a backend object to be used by the HttpCache. | 74 // A BackendFactory creates a backend object to be used by the HttpCache. |
| 73 class NET_EXPORT BackendFactory { | 75 class NET_EXPORT BackendFactory { |
| 74 public: | 76 public: |
| 75 virtual ~BackendFactory() {} | 77 virtual ~BackendFactory() {} |
| 76 | 78 |
| 77 // The actual method to build the backend. Returns a net error code. If | 79 // The actual method to build the backend. Returns a net error code. If |
| 78 // ERR_IO_PENDING is returned, the |callback| will be notified when the | 80 // ERR_IO_PENDING is returned, the |callback| will be notified when the |
| 79 // operation completes, and |backend| must remain valid until the | 81 // operation completes, and |backend| must remain valid until the |
| 80 // notification arrives. | 82 // notification arrives. |
| 81 // The implementation must not access the factory object after invoking the | 83 // The implementation must not access the factory object after invoking the |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 kMetadataIndex, | 235 kMetadataIndex, |
| 234 | 236 |
| 235 // Must remain at the end of the enum. | 237 // Must remain at the end of the enum. |
| 236 kNumCacheEntryDataIndices | 238 kNumCacheEntryDataIndices |
| 237 }; | 239 }; |
| 238 | 240 |
| 239 class MetadataWriter; | 241 class MetadataWriter; |
| 240 class QuicServerInfoFactoryAdaptor; | 242 class QuicServerInfoFactoryAdaptor; |
| 241 class Transaction; | 243 class Transaction; |
| 242 class WorkItem; | 244 class WorkItem; |
| 245 class Writers; |
| 246 friend class WritersTest; // To access ActiveEntry in the test class. |
| 243 friend class Transaction; | 247 friend class Transaction; |
| 244 friend class ViewCacheHelper; | 248 friend class ViewCacheHelper; |
| 245 struct PendingOp; // Info for an entry under construction. | 249 struct PendingOp; // Info for an entry under construction. |
| 246 | 250 |
| 247 using TransactionList = std::list<Transaction*>; | 251 using TransactionList = std::list<Transaction*>; |
| 248 using TransactionSet = std::unordered_set<Transaction*>; | 252 using TransactionSet = std::unordered_set<Transaction*>; |
| 249 typedef std::list<std::unique_ptr<WorkItem>> WorkItemList; | 253 typedef std::list<std::unique_ptr<WorkItem>> WorkItemList; |
| 250 | 254 |
| 251 struct ActiveEntry { | 255 struct ActiveEntry { |
| 252 explicit ActiveEntry(disk_cache::Entry* entry); | 256 explicit ActiveEntry(disk_cache::Entry* entry); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 std::unique_ptr<base::Clock> clock_; | 439 std::unique_ptr<base::Clock> clock_; |
| 436 | 440 |
| 437 base::WeakPtrFactory<HttpCache> weak_factory_; | 441 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 438 | 442 |
| 439 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 443 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 440 }; | 444 }; |
| 441 | 445 |
| 442 } // namespace net | 446 } // namespace net |
| 443 | 447 |
| 444 #endif // NET_HTTP_HTTP_CACHE_H_ | 448 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |