| 692 | } |
| 693 | |
| 694 | void LIRSCacheShard::ProtectedToUnprotected(LIRSThreadState* tstate, LIRSHandle* e) { |
| 695 | DCHECK(!e->unprotected_tombstone_list_hook_.is_linked()); |
| 696 | DCHECK(e->recency_list_hook_.is_linked()); |
| 697 | // Must be the oldest on the recency list |
| 698 | DCHECK(&recency_list_.front() == e); |
| 699 | recency_list_.erase(recency_list_.iterator_to(*e)); |
| 700 | // Trim the recency list after the removal |
| 701 | TrimRecencyList(tstate); |
| 702 | e->set_state(PROTECTED, UNPROTECTED); |
| 703 | // Add to unprotected list as the newest entry |
| 704 | AddToUnprotectedList(e); |
| 705 | // List operations happen before changes to the counts/usage |
| 706 | --num_protected_; |
| 707 | ++num_unprotected_; |
| 708 | // Transfer the usage |
| 709 | protected_usage_ -= e->charge(); |
| 710 | unprotected_usage_ += e->charge(); |
| 711 | // If necessary, evict an entry from the unprotected list |
| 712 | EnforceUnprotectedCapacity(tstate); |
| 713 | } |
| 714 | |
| 715 | void LIRSCacheShard::UnprotectedToTombstone(LIRSThreadState* tstate, LIRSHandle* e) { |
| 716 | // Decrement unprotected usage |