Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 41655c489e18c93c2bf0614173c3ac942fbf35fe
https://github.com/WebKit/WebKit/commit/41655c489e18c93c2bf0614173c3ac942fbf35fe
Author: David Kilzer <[email protected]>
Date: 2026-07-26 (Sun, 26 Jul 2026)
Changed paths:
M Source/WebCore/PAL/pal/text/TextEncodingRegistry.cpp
M Source/WebCore/platform/graphics/SystemFallbackFontCache.cpp
M Source/WebCore/platform/graphics/cg/CGSubimageCacheWithTimer.cpp
M Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp
M Source/WebCore/platform/ios/LegacyTileGrid.mm
M Source/WebCore/platform/network/CredentialStorage.cpp
M Source/WebCore/rendering/TextAutoSizing.cpp
M Source/WebKit/UIProcess/API/glib/IconDatabase.cpp
M Source/WebKit/UIProcess/WebNavigationState.cpp
M Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm
Log Message:
-----------
Simplify remove-matching-entries loops by using WTF container removeIf()
<https://bugs.webkit.org/show_bug.cgi?id=320290>
<rdar://183222655>
Reviewed by Abrar Rahman Protyasha.
Several call sites delete matching entries from a `HashMap`, `HashSet`,
or `ListHashSet` by first collecting the matching elements or keys into
a temporary `Vector`, then looping over that `Vector` to remove each one
from the container. The temporary storage and the second traversal are
unnecessary: WTF containers provide `removeIf(predicate)`, which removes
every matching entry in a single pass.
Collapse each such loop into a `removeIf()` call. In every converted
case the predicate depends only on the individual element, uses
loop-invariant captures, and does not mutate the container
mid-iteration, so the result is identical to the collect-then-remove
form.
No new tests since no change in behavior.
* Source/WebCore/PAL/pal/text/TextEncodingRegistry.cpp:
(PAL::pruneBlocklistedCodecs):
* Source/WebCore/platform/graphics/SystemFallbackFontCache.cpp:
(WebCore::SystemFallbackFontCache::remove):
* Source/WebCore/platform/graphics/cg/CGSubimageCacheWithTimer.cpp:
(WebCore::CGSubimageCacheWithTimer::clearImageAndSubimages):
* Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontCache::platformPurgeInactiveFontData):
* Source/WebCore/platform/ios/LegacyTileGrid.mm:
(WebCore::LegacyTileGrid::dropTilesBetweenRects):
(WebCore::LegacyTileGrid::dropInvalidTiles):
* Source/WebCore/platform/network/CredentialStorage.cpp:
(WebCore::CredentialStorage::removeCredentialsWithOrigin):
* Source/WebCore/rendering/TextAutoSizing.cpp:
(WebCore::TextAutoSizingValue::adjustTextNodeSizes):
* Source/WebKit/UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::clearLoadedIconsTimerFired):
* Source/WebKit/UIProcess/WebNavigationState.cpp:
(WebKit::WebNavigationState::clearNavigationsFromProcess):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/AsyncPDFRenderer.mm:
(WebKit::AsyncPDFRenderer::willRemoveGrid):
Canonical link: https://commits.webkit.org/317934@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications