Changeset 241565 in webkit


Ignore:
Timestamp:
Feb 14, 2019 2:55:24 PM (5 years ago)
Author:
youenn@apple.com
Message:
ASSERTION FAILED: m_caches.isEmpty()
!m_pendingInitializationCallbacks.isEmpty() in WebKit::CacheStorage::Caches::clearMemoryRepresentation()

https://bugs.webkit.org/show_bug.cgi?id=188393
<rdar://problem/43025665>

Reviewed by Alex Christensen.

In case Caches::dispose is called, clearMemoryRepresentation might be called if there is no active cache.
We also ensure to not clear the memory representation if there is any remaining removed cache.
Update the clearMemoryRepresentation assertion to take that into account.

In case a Caches is cleared twice, the clearMemoryRepresentation assertion will assert while it should not.
In that case m_storage is null the second time. Update the assertion accordingly.

  • NetworkProcess/cache/CacheStorageEngineCaches.cpp:

(WebKit::CacheStorage::Caches::hasActiveCache const):
(WebKit::CacheStorage::Caches::dispose):
(WebKit::CacheStorage::Caches::clearMemoryRepresentation):

  • NetworkProcess/cache/CacheStorageEngineCaches.h:
Location:
trunk/Source/WebKit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r241564 r241565  
     12019-02-14  Youenn Fablet  <youenn@apple.com>
     2
     3        ASSERTION FAILED: m_caches.isEmpty() || !m_pendingInitializationCallbacks.isEmpty() in WebKit::CacheStorage::Caches::clearMemoryRepresentation()
     4        https://bugs.webkit.org/show_bug.cgi?id=188393
     5        <rdar://problem/43025665>
     6
     7        Reviewed by Alex Christensen.
     8
     9        In case Caches::dispose is called, clearMemoryRepresentation might be called if there is no active cache.
     10        We also ensure to not clear the memory representation if there is any remaining removed cache.
     11        Update the clearMemoryRepresentation assertion to take that into account.
     12
     13        In case a Caches is cleared twice, the clearMemoryRepresentation assertion will assert while it should not.
     14        In that case m_storage is null the second time. Update the assertion accordingly.
     15
     16        * NetworkProcess/cache/CacheStorageEngineCaches.cpp:
     17        (WebKit::CacheStorage::Caches::hasActiveCache const):
     18        (WebKit::CacheStorage::Caches::dispose):
     19        (WebKit::CacheStorage::Caches::clearMemoryRepresentation):
     20        * NetworkProcess/cache/CacheStorageEngineCaches.h:
     21
    1222019-02-14  Brian Burg  <bburg@apple.com>
    223
  • trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp

    r240437 r241565  
    344344}
    345345
     346bool Caches::hasActiveCache() const
     347{
     348    if (m_removedCaches.size())
     349        return true;
     350    return m_caches.findMatching([](const auto& item) { return item.isActive(); }) != notFound;
     351}
     352
    346353void Caches::dispose(Cache& cache)
    347354{
     
    357364    cache.clearMemoryRepresentation();
    358365
    359     if (m_caches.findMatching([](const auto& item) { return item.isActive(); }) == notFound)
     366    if (!hasActiveCache())
    360367        clearMemoryRepresentation();
    361368}
     
    595602{
    596603    if (!m_isInitialized) {
    597         ASSERT(m_caches.isEmpty() || !m_pendingInitializationCallbacks.isEmpty());
     604        ASSERT(!m_storage || !hasActiveCache() || !m_pendingInitializationCallbacks.isEmpty());
    598605        // m_storage might not be null in case Caches is being initialized. This is fine as nullify it below is a memory optimization.
    599606        m_caches.clear();
  • trunk/Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.h

    r240099 r241565  
    9797    void notifyCachesOfRequestSpaceEnd();
    9898
     99    bool hasActiveCache() const;
     100
    99101    bool m_isInitialized { false };
    100102    bool m_isRequestingSpace { false };
Note: See TracChangeset for help on using the changeset viewer.