OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 2616 (any exceptions are called out in the code). | 7 // caching logic follows RFC 2616 (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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 Transaction* writer; | 218 Transaction* writer; |
219 TransactionList readers; | 219 TransactionList readers; |
220 TransactionList pending_queue; | 220 TransactionList pending_queue; |
221 bool will_process_pending_queue; | 221 bool will_process_pending_queue; |
222 bool doomed; | 222 bool doomed; |
223 }; | 223 }; |
224 | 224 |
225 typedef base::hash_map<std::string, ActiveEntry*> ActiveEntriesMap; | 225 typedef base::hash_map<std::string, ActiveEntry*> ActiveEntriesMap; |
226 typedef base::hash_map<std::string, PendingOp*> PendingOpsMap; | 226 typedef base::hash_map<std::string, PendingOp*> PendingOpsMap; |
227 typedef std::set<ActiveEntry*> ActiveEntriesSet; | 227 typedef std::set<ActiveEntry*> ActiveEntriesSet; |
| 228 typedef base::hash_map<std::string, int> PlaybackCacheMap; |
228 | 229 |
229 // Methods ------------------------------------------------------------------ | 230 // Methods ------------------------------------------------------------------ |
230 | 231 |
231 // Creates the |backend| object and notifies the |callback| when the operation | 232 // Creates the |backend| object and notifies the |callback| when the operation |
232 // completes. Returns an error code. | 233 // completes. Returns an error code. |
233 int CreateBackend(disk_cache::Backend** backend, | 234 int CreateBackend(disk_cache::Backend** backend, |
234 CompletionCallback* callback); | 235 CompletionCallback* callback); |
235 | 236 |
236 // Makes sure that the backend creation is complete before allowing the | 237 // Makes sure that the backend creation is complete before allowing the |
237 // provided transaction to use the object. Returns an error code. |trans| | 238 // provided transaction to use the object. Returns an error code. |trans| |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 ActiveEntriesMap active_entries_; | 365 ActiveEntriesMap active_entries_; |
365 | 366 |
366 // The set of doomed entries. | 367 // The set of doomed entries. |
367 ActiveEntriesSet doomed_entries_; | 368 ActiveEntriesSet doomed_entries_; |
368 | 369 |
369 // The set of entries "under construction". | 370 // The set of entries "under construction". |
370 PendingOpsMap pending_ops_; | 371 PendingOpsMap pending_ops_; |
371 | 372 |
372 ScopedRunnableMethodFactory<HttpCache> task_factory_; | 373 ScopedRunnableMethodFactory<HttpCache> task_factory_; |
373 | 374 |
374 typedef base::hash_map<std::string, int> PlaybackCacheMap; | |
375 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 375 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
376 | 376 |
377 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 377 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
378 }; | 378 }; |
379 | 379 |
380 } // namespace net | 380 } // namespace net |
381 | 381 |
382 #endif // NET_HTTP_HTTP_CACHE_H_ | 382 #endif // NET_HTTP_HTTP_CACHE_H_ |
OLD | NEW |