Thanks for the review. You uncovered a major issue.
PTAnL
run_loop.Run();Patrick MonetteThis method is named as being async no longer async if it's running a loop to wait for the task to have finished
Good point. The name is mostly to mean that it's to be used for async memory pressure listeners, but I agree that it doesn't feel right. I ended up with another version in https://chromium-review.googlesource.com/c/chromium/src/+/7229564 where the function is truly async, but you can pass the QuitClosure as a parameter so the synchronous part is done by the calling code.
cache_.UpdateMaxSize(0);Patrick MonetteDoes this actually work? The unittest does not actually test what happens when you try to insert an element after setting the max to zero. lru_cache special cases 0 as NO_AUTO_EVICT, meaning it no longer manages the size at all. (And if it didn't special case 0, it would cause an overflow at the line it does ` ShrinkToSize(max_size_ - 1);`)
Yeah I missed a big issue here. Thanks!
I needed more changes to LRUCache which I did in this CL: https://chromium-review.googlesource.com/c/chromium/src/+/7228584.
I also added a test to ensure inserting an element fails when the max is zero.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |
Unfortunately a bad rebase added a bunch of bots that keep failing, but the CQ passes.
| Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. |