Add a lambda-based map for Vectors
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Sep 2017 17:50:48 +0000 (17:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 13 Sep 2017 17:50:48 +0000 (17:50 +0000)
commite0cf176e716ddd6bf192f24ecd5813b47f40928a
tree294e7da3c53fae8b3e12c5e7a27255df9b1e02b4
parentc6267539579e6114c13d028b8cba0d3391eeef2d
Add a lambda-based map for Vectors
https://bugs.webkit.org/show_bug.cgi?id=176487

Patch by Youenn Fablet <youenn@apple.com> on 2017-09-13
Reviewed by Darin Adler.

Source/WebKit:

* NetworkProcess/cache/CacheStorageEngineCaches.cpp:
(WebKit::CacheStorage::Caches::readCachesFromDisk):

Source/WTF:

This helper routine allows refactoring the reserveInitialCapacity/uncheckedAppend pattern, the mapper between source and destination item being a lambda.

* wtf/Vector.h:
(WTF::Mapper::transform):
(WTF::Mapper::map):
(WTF::map):

Tools:

* TestWebKitAPI/Tests/WTF/Vector.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221977 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Vector.h
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/cache/CacheStorageEngineCaches.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/Vector.cpp