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