Replace the origin trials hash map with a static const array.
Instead of producing vectors at runtime, produce spans which view constexpr data directly, which avoids thread safety issues and unnecessary runtime memory allocation. In practice the number of trials which exist is not so large that a hashtable is likely to significant outperform accessing packed static data. The present implementation uses a HashMap which has two potential issues: - the initialization is not inside the atomically protected critical section, but after it (so it is possible for two threads to race to initialize the map) - it stores WTF::String internally, but WTF::String is not intended to be used across threads and it's difficult to prove that the HashMap never does any operations which could race on StringImpl internals Change-Id: Ie946c24fe22b17b6a02e2918917595a01b096e17 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2110677Reviewed-by:Ian Clelland <iclelland@chromium.org> Commit-Queue: Jeremy Roman <jbroman@chromium.org> Cr-Commit-Position: refs/heads/master@{#752832}
Showing
Please register or sign in to comment