Chromium Code Reviews| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 public: | 61 public: |
| 62 // The cache mode of operation. | 62 // The cache mode of operation. |
| 63 enum Mode { | 63 enum Mode { |
| 64 // Normal mode just behaves like a standard web cache. | 64 // Normal mode just behaves like a standard web cache. |
| 65 NORMAL = 0, | 65 NORMAL = 0, |
| 66 // Disables reads and writes from the cache. | 66 // Disables reads and writes from the cache. |
| 67 // Equivalent to setting LOAD_DISABLE_CACHE on every request. | 67 // Equivalent to setting LOAD_DISABLE_CACHE on every request. |
| 68 DISABLE | 68 DISABLE |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // class WritersTest; | |
|
jkarlin
2017/06/28 15:50:08
What's this?
shivanisha
2017/06/28 19:38:19
Removed in a subsequent patch.
| |
| 72 | |
| 71 // A BackendFactory creates a backend object to be used by the HttpCache. | 73 // A BackendFactory creates a backend object to be used by the HttpCache. |
| 72 class NET_EXPORT BackendFactory { | 74 class NET_EXPORT BackendFactory { |
| 73 public: | 75 public: |
| 74 virtual ~BackendFactory() {} | 76 virtual ~BackendFactory() {} |
| 75 | 77 |
| 76 // The actual method to build the backend. Returns a net error code. If | 78 // The actual method to build the backend. Returns a net error code. If |
| 77 // ERR_IO_PENDING is returned, the |callback| will be notified when the | 79 // ERR_IO_PENDING is returned, the |callback| will be notified when the |
| 78 // operation completes, and |backend| must remain valid until the | 80 // operation completes, and |backend| must remain valid until the |
| 79 // notification arrives. | 81 // notification arrives. |
| 80 // The implementation must not access the factory object after invoking the | 82 // The implementation must not access the factory object after invoking the |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 kMetadataIndex, | 241 kMetadataIndex, |
| 240 | 242 |
| 241 // Must remain at the end of the enum. | 243 // Must remain at the end of the enum. |
| 242 kNumCacheEntryDataIndices | 244 kNumCacheEntryDataIndices |
| 243 }; | 245 }; |
| 244 | 246 |
| 245 class MetadataWriter; | 247 class MetadataWriter; |
| 246 class QuicServerInfoFactoryAdaptor; | 248 class QuicServerInfoFactoryAdaptor; |
| 247 class Transaction; | 249 class Transaction; |
| 248 class WorkItem; | 250 class WorkItem; |
| 251 class Writers; | |
| 252 friend class WritersTest; // To access ActiveEntry in the test class. | |
| 253 friend class WritersTest1; // To access ActiveEntry in the test class. | |
|
jkarlin
2017/06/28 15:50:08
What's this?
shivanisha
2017/06/28 19:38:19
Removed in a subsequent patch.
| |
| 249 friend class Transaction; | 254 friend class Transaction; |
| 250 friend class ViewCacheHelper; | 255 friend class ViewCacheHelper; |
| 251 struct PendingOp; // Info for an entry under construction. | 256 struct PendingOp; // Info for an entry under construction. |
| 252 | 257 |
| 253 // To help with testing. | 258 // To help with testing. |
| 254 friend class MockHttpCache; | 259 friend class MockHttpCache; |
| 255 | 260 |
| 256 using TransactionList = std::list<Transaction*>; | 261 using TransactionList = std::list<Transaction*>; |
| 257 using TransactionSet = std::unordered_set<Transaction*>; | 262 using TransactionSet = std::unordered_set<Transaction*>; |
| 258 typedef std::list<std::unique_ptr<WorkItem>> WorkItemList; | 263 typedef std::list<std::unique_ptr<WorkItem>> WorkItemList; |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 546 THREAD_CHECKER(thread_checker_); | 551 THREAD_CHECKER(thread_checker_); |
| 547 | 552 |
| 548 base::WeakPtrFactory<HttpCache> weak_factory_; | 553 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 549 | 554 |
| 550 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 555 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 551 }; | 556 }; |
| 552 | 557 |
| 553 } // namespace net | 558 } // namespace net |
| 554 | 559 |
| 555 #endif // NET_HTTP_HTTP_CACHE_H_ | 560 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |