• Josh Karlin's avatar
    [CacheStorage] Doom entries before closing if they're mid-write · aaa7db01
    Josh Karlin authored
    CacheStorageCache dooms entries before closing them if their write operations
    fail. This prevents them from being used in the future. In the event that
    a ScopedEntry is held by a callback and the callback never gets to run, but
    does get deleted, a partially written entry would be closed and will be
    reusable.
    
    This is a hypothetical problem. We're not actually sure this can happen since
    the CacheStorageCache is kept alive by its manager during async operations. But
    for safety, I've made a new smart pointer for disk_cache::Entry*'s that will
    by default doom an entry before closing it unless WritingCompleted() has been
    called on its deleter. This new smart pointer is used anywhere that Entry*
    writing occurs in CacheStorage.
    
    Bug: 617683
    Change-Id: Ia5b83bd87b4997fea08cba013fc4701441db6f42
    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1600267
    Commit-Queue: Josh Karlin <jkarlin@chromium.org>
    Reviewed-by: default avatarBen Kelly <wanderview@chromium.org>
    Reviewed-by: default avatarMaks Orlovich <morlovich@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#659210}
    aaa7db01
disk_cache.h 23.2 KB