| 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // Destroys an ActiveEntry (active or doomed). | 340 // Destroys an ActiveEntry (active or doomed). |
| 341 void DestroyEntry(ActiveEntry* entry); | 341 void DestroyEntry(ActiveEntry* entry); |
| 342 | 342 |
| 343 // Adds a transaction to an ActiveEntry. If this method returns ERR_IO_PENDING | 343 // Adds a transaction to an ActiveEntry. If this method returns ERR_IO_PENDING |
| 344 // the transaction will be notified about completion via its IO callback. This | 344 // the transaction will be notified about completion via its IO callback. This |
| 345 // method returns ERR_CACHE_RACE to signal the transaction that it cannot be | 345 // method returns ERR_CACHE_RACE to signal the transaction that it cannot be |
| 346 // added to the provided entry, and it should retry the process with another | 346 // added to the provided entry, and it should retry the process with another |
| 347 // one (in this case, the entry is no longer valid). | 347 // one (in this case, the entry is no longer valid). |
| 348 int AddTransactionToEntry(ActiveEntry* entry, Transaction* trans); | 348 int AddTransactionToEntry(ActiveEntry* entry, Transaction* trans); |
| 349 | 349 |
| 350 // Called when the transaction has finished working with this entry. |cancel| | |
| 351 // is true if the operation was cancelled by the caller instead of running | |
| 352 // to completion. | |
| 353 void DoneWithEntry(ActiveEntry* entry, Transaction* trans, bool cancel); | |
| 354 | |
| 355 // Called when the transaction has finished writing to this entry. |success| | 350 // Called when the transaction has finished writing to this entry. |success| |
| 356 // is false if the cache entry should be deleted. | 351 // is false if the cache entry should be deleted. |
| 357 void DoneWritingToEntry(ActiveEntry* entry, bool success); | 352 void DoneWritingToEntry(ActiveEntry* entry, bool success); |
| 358 | 353 |
| 359 // Called when the transaction has finished reading from this entry. | 354 // Called when the transaction has finished reading from this entry. |
| 360 void DoneReadingFromEntry(ActiveEntry* entry, Transaction* trans); | 355 void DoneReadingFromEntry(ActiveEntry* entry, Transaction* trans); |
| 361 | 356 |
| 362 // Converts the active writer transaction to a reader so that other | 357 // Converts the active writer transaction to a reader so that other |
| 363 // transactions can start reading from this entry. | 358 // transactions can start reading from this entry. |
| 364 void ConvertWriterToReader(ActiveEntry* entry); | 359 void ConvertWriterToReader(ActiveEntry* entry); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 scoped_ptr<base::Clock> clock_; | 436 scoped_ptr<base::Clock> clock_; |
| 442 | 437 |
| 443 base::WeakPtrFactory<HttpCache> weak_factory_; | 438 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 444 | 439 |
| 445 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 440 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 446 }; | 441 }; |
| 447 | 442 |
| 448 } // namespace net | 443 } // namespace net |
| 449 | 444 |
| 450 #endif // NET_HTTP_HTTP_CACHE_H_ | 445 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |