| 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 411 |
| 412 // Called when the transaction has finished writing to this entry. |success| | 412 // Called when the transaction has finished writing to this entry. |success| |
| 413 // is false if the cache entry should be deleted. | 413 // is false if the cache entry should be deleted. |
| 414 void DoneWritingToEntry(ActiveEntry* entry, | 414 void DoneWritingToEntry(ActiveEntry* entry, |
| 415 bool success, | 415 bool success, |
| 416 Transaction* transaction); | 416 Transaction* transaction); |
| 417 | 417 |
| 418 // Called when the transaction has finished reading from this entry. | 418 // Called when the transaction has finished reading from this entry. |
| 419 void DoneReadingFromEntry(ActiveEntry* entry, Transaction* transaction); | 419 void DoneReadingFromEntry(ActiveEntry* entry, Transaction* transaction); |
| 420 | 420 |
| 421 // Called when the transaction has received a non-matching response to |
| 422 // validation and it's not the transaction responsible for writing the |
| 423 // response body. |
| 424 void DoomEntryValidationNoMatch(ActiveEntry* entry, Transaction* transaction); |
| 425 |
| 421 // Removes and returns all queued transactions in |entry| in FIFO order. This | 426 // Removes and returns all queued transactions in |entry| in FIFO order. This |
| 422 // includes transactions that have completed the headers phase and those that | 427 // includes transactions that have completed the headers phase and those that |
| 423 // have not been added to the entry yet in that order. |list| is the output | 428 // have not been added to the entry yet in that order. |list| is the output |
| 424 // argument. | 429 // argument. |
| 425 void RemoveAllQueuedTransactions(ActiveEntry* entry, TransactionList* list); | 430 void RemoveAllQueuedTransactions(ActiveEntry* entry, TransactionList* list); |
| 426 | 431 |
| 427 // Processes either writer's failure to write response body or | 432 // Processes either writer's failure to write response body or |
| 428 // headers_transactions's failure to write headers. Also invoked when headers | 433 // headers_transactions's failure to write headers. |
| 429 // transaction's validation result is not a match. | |
| 430 void ProcessEntryFailure(ActiveEntry* entry, Transaction* transaction); | 434 void ProcessEntryFailure(ActiveEntry* entry, Transaction* transaction); |
| 431 | 435 |
| 432 // Restarts headers_transaction and done_headers_queue transactions. | 436 // Restarts headers_transaction and done_headers_queue transactions. |
| 433 void RestartHeadersPhaseTransactions(ActiveEntry* entry, | 437 void RestartHeadersPhaseTransactions(ActiveEntry* entry, |
| 434 Transaction* transaction); | 438 Transaction* transaction); |
| 435 | 439 |
| 436 // Restarts the headers_transaction by setting its state. Since the | 440 // Restarts the headers_transaction by setting its state. Since the |
| 437 // headers_transaction is awaiting an asynchronous operation completion, | 441 // headers_transaction is awaiting an asynchronous operation completion, |
| 438 // it will be restarted when it's IO callback is invoked. | 442 // it will be restarted when it's IO callback is invoked. |
| 439 void RestartHeadersTransaction(ActiveEntry* entry, Transaction* transaction); | 443 void RestartHeadersTransaction(ActiveEntry* entry, Transaction* transaction); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 std::unique_ptr<base::Clock> clock_; | 541 std::unique_ptr<base::Clock> clock_; |
| 538 | 542 |
| 539 base::WeakPtrFactory<HttpCache> weak_factory_; | 543 base::WeakPtrFactory<HttpCache> weak_factory_; |
| 540 | 544 |
| 541 DISALLOW_COPY_AND_ASSIGN(HttpCache); | 545 DISALLOW_COPY_AND_ASSIGN(HttpCache); |
| 542 }; | 546 }; |
| 543 | 547 |
| 544 } // namespace net | 548 } // namespace net |
| 545 | 549 |
| 546 #endif // NET_HTTP_HTTP_CACHE_H_ | 550 #endif // NET_HTTP_HTTP_CACHE_H_ |
| OLD | NEW |