• Rayan Kanso's avatar
    Fix WeakPtr bug when cache is created with a MemoryLoader. · 6afd9401
    Rayan Kanso authored
    I was writing a unittest where OpenCache is called with a MemoryLoader.
    It kept crashing, and it seems to me that this was due to WriteIndex
    running without callbacks. The CacheStorageCacheHandle was going out of
    scope, and when a new one was being created by NotifyCacheCreated, there
    was a crash due to some WeakPtr ref count internals.
    
    This fix makes sure that the ref count is non-zero until all callbacks
    consume the CacheStorageCacheHandle.
    
    Bug: 838908
    Change-Id: I610b2cad26d5608bacd18a4daa60edc976093fb4
    Reviewed-on: https://chromium-review.googlesource.com/1069350Reviewed-by: default avatarJoshua Bell <jsbell@chromium.org>
    Commit-Queue: Rayan Kanso <rayankans@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#561028}
    6afd9401
cache_storage.cc 45.4 KB