Changeset 211673 in webkit


Ignore:
Timestamp:
Feb 4, 2017, 1:40:33 PM (9 years ago)
Author:
yoav@yoav.ws
Message:

Fix memory issues related to preload eviction.
https://bugs.webkit.org/show_bug.cgi?id=167838

Reviewed by Andreas Kling.

This avoids removing resources from m_preloads during the iteration
by creating a second HashSetList containing the remaining link preloads.

No new tests but this will fix crashes on the leak bots.

  • loader/cache/CachedResourceLoader.cpp:

(WebCore::CachedResourceLoader::clearPreloads):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r211671 r211673  
     12017-02-04  Yoav Weiss  <yoav@yoav.ws>
     2
     3        Fix memory issues related to preload eviction.
     4        https://bugs.webkit.org/show_bug.cgi?id=167838
     5
     6        Reviewed by Andreas Kling.
     7
     8        This avoids removing resources from m_preloads during the iteration
     9        by creating a second HashSetList containing the remaining link preloads.
     10
     11        No new tests but this will fix crashes on the leak bots.
     12
     13        * loader/cache/CachedResourceLoader.cpp:
     14        (WebCore::CachedResourceLoader::clearPreloads):
     15
    1162017-02-04  Zalan Bujtas  <zalan@apple.com>
    217
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r211665 r211673  
    12551255        return;
    12561256
     1257    std::unique_ptr<ListHashSet<CachedResource*>> remainingLinkPreloads;
    12571258    for (auto* resource : *m_preloads) {
    1258         if (mode == ClearPreloadsMode::ClearSpeculativePreloads && resource->isLinkPreload())
     1259        ASSERT(resource);
     1260        if (mode == ClearPreloadsMode::ClearSpeculativePreloads && resource->isLinkPreload()) {
     1261            if (!remainingLinkPreloads)
     1262                remainingLinkPreloads = std::make_unique<ListHashSet<CachedResource*>>();
     1263            remainingLinkPreloads->add(resource);
    12591264            continue;
     1265        }
    12601266        resource->decreasePreloadCount();
    12611267        bool deleted = resource->deleteIfPossible();
    12621268        if (!deleted && resource->preloadResult() == CachedResource::PreloadNotReferenced)
    12631269            MemoryCache::singleton().remove(*resource);
    1264         m_preloads->remove(resource);
    1265     }
    1266     if (!m_preloads->size())
    1267         m_preloads = nullptr;
     1270    }
     1271    m_preloads = WTFMove(remainingLinkPreloads);
    12681272}
    12691273
Note: See TracChangeset for help on using the changeset viewer.