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