| 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 10 matching lines...) Expand all Loading... |
| 21 #include "base/basictypes.h" | 21 #include "base/basictypes.h" |
| 22 #include "base/file_path.h" | 22 #include "base/file_path.h" |
| 23 #include "base/hash_tables.h" | 23 #include "base/hash_tables.h" |
| 24 #include "base/message_loop_proxy.h" | 24 #include "base/message_loop_proxy.h" |
| 25 #include "base/non_thread_safe.h" | 25 #include "base/non_thread_safe.h" |
| 26 #include "base/scoped_ptr.h" | 26 #include "base/scoped_ptr.h" |
| 27 #include "base/task.h" | 27 #include "base/task.h" |
| 28 #include "base/weak_ptr.h" | 28 #include "base/weak_ptr.h" |
| 29 #include "net/base/cache_type.h" | 29 #include "net/base/cache_type.h" |
| 30 #include "net/base/completion_callback.h" | 30 #include "net/base/completion_callback.h" |
| 31 #include "net/base/load_states.h" | |
| 32 #include "net/http/http_transaction_factory.h" | 31 #include "net/http/http_transaction_factory.h" |
| 33 | 32 |
| 34 class GURL; | 33 class GURL; |
| 35 | 34 |
| 36 namespace disk_cache { | 35 namespace disk_cache { |
| 37 class Backend; | 36 class Backend; |
| 38 class Entry; | 37 class Entry; |
| 39 } | 38 } |
| 40 | 39 |
| 41 namespace net { | 40 namespace net { |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // is false if the cache entry should be deleted. | 303 // is false if the cache entry should be deleted. |
| 305 void DoneWritingToEntry(ActiveEntry* entry, bool success); | 304 void DoneWritingToEntry(ActiveEntry* entry, bool success); |
| 306 | 305 |
| 307 // Called when the transaction has finished reading from this entry. | 306 // Called when the transaction has finished reading from this entry. |
| 308 void DoneReadingFromEntry(ActiveEntry* entry, Transaction* trans); | 307 void DoneReadingFromEntry(ActiveEntry* entry, Transaction* trans); |
| 309 | 308 |
| 310 // Convers the active writter transaction to a reader so that other | 309 // Convers the active writter transaction to a reader so that other |
| 311 // transactions can start reading from this entry. | 310 // transactions can start reading from this entry. |
| 312 void ConvertWriterToReader(ActiveEntry* entry); | 311 void ConvertWriterToReader(ActiveEntry* entry); |
| 313 | 312 |
| 314 // Returns the LoadState of the provided pending transaction. | |
| 315 LoadState GetLoadStateForPendingTransaction(const Transaction* trans); | |
| 316 | |
| 317 // Removes the transaction |trans|, from the pending list of an entry | 313 // Removes the transaction |trans|, from the pending list of an entry |
| 318 // (PendingOp, active or doomed entry). | 314 // (PendingOp, active or doomed entry). |
| 319 void RemovePendingTransaction(Transaction* trans); | 315 void RemovePendingTransaction(Transaction* trans); |
| 320 | 316 |
| 321 // Removes the transaction |trans|, from the pending list of |entry|. | 317 // Removes the transaction |trans|, from the pending list of |entry|. |
| 322 bool RemovePendingTransactionFromEntry(ActiveEntry* entry, | 318 bool RemovePendingTransactionFromEntry(ActiveEntry* entry, |
| 323 Transaction* trans); | 319 Transaction* trans); |
| 324 | 320 |
| 325 // Removes the transaction |trans|, from the pending list of |pending_op|. | 321 // Removes the transaction |trans|, from the pending list of |pending_op|. |
| 326 bool RemovePendingTransactionFromPendingOp(PendingOp* pending_op, | 322 bool RemovePendingTransactionFromPendingOp(PendingOp* pending_op, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 365 |
| 370 typedef base::hash_map<std::string, int> PlaybackCacheMap; | 366 typedef base::hash_map<std::string, int> PlaybackCacheMap; |
| 371 scoped_ptr<PlaybackCacheMap> playback_cache_map_; | 367 scoped_ptr<PlaybackCacheMap> playback_cache_map_; |
| 372 | 368 |
| 373 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 369 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 374 }; | 370 }; |
| 375 | 371 |
| 376 } // namespace net | 372 } // namespace net |
| 377 | 373 |
| 378 #endif // NET_HTTP_HTTP_CACHE_H_ | 374 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |