Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: net/http/http_cache.h

Issue 2886483002: Adds a new class HttpCache::Writers for multiple cache transactions reading from the network. (Closed)
Patch Set: Feedback addressed Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 kMetadataIndex, 234 kMetadataIndex,
233 235
234 // Must remain at the end of the enum. 236 // Must remain at the end of the enum.
235 kNumCacheEntryDataIndices 237 kNumCacheEntryDataIndices
236 }; 238 };
237 239
238 class MetadataWriter; 240 class MetadataWriter;
239 class QuicServerInfoFactoryAdaptor; 241 class QuicServerInfoFactoryAdaptor;
240 class Transaction; 242 class Transaction;
241 class WorkItem; 243 class WorkItem;
244 class Writers;
245 friend class WritersTest; // To access ActiveEntry in the test class.
242 friend class Transaction; 246 friend class Transaction;
243 friend class ViewCacheHelper; 247 friend class ViewCacheHelper;
244 struct PendingOp; // Info for an entry under construction. 248 struct PendingOp; // Info for an entry under construction.
245 249
246 // To help with testing. 250 // To help with testing.
247 friend class MockHttpCache; 251 friend class MockHttpCache;
248 252
249 using TransactionList = std::list<Transaction*>; 253 using TransactionList = std::list<Transaction*>;
250 using TransactionSet = std::unordered_set<Transaction*>; 254 using TransactionSet = std::unordered_set<Transaction*>;
251 typedef std::list<std::unique_ptr<WorkItem>> WorkItemList; 255 typedef std::list<std::unique_ptr<WorkItem>> WorkItemList;
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 THREAD_CHECKER(thread_checker_); 542 THREAD_CHECKER(thread_checker_);
539 543
540 base::WeakPtrFactory<HttpCache> weak_factory_; 544 base::WeakPtrFactory<HttpCache> weak_factory_;
541 545
542 DISALLOW_COPY_AND_ASSIGN(HttpCache); 546 DISALLOW_COPY_AND_ASSIGN(HttpCache);
543 }; 547 };
544 548
545 } // namespace net 549 } // namespace net
546 550
547 #endif // NET_HTTP_HTTP_CACHE_H_ 551 #endif // NET_HTTP_HTTP_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698