0
Files
src/components/prefs
Jan Keitel f0eddf49f6 Use std::string_view in more PrefService methods.
This CL adds transparent hashing and transparent equality comparisons
to the std::unordered_map<std::string, Preference> that it keeps.

This should be a no-op for any interactions with the map that involve
a std::string:
- Comparisons just forward to std::string comparisons.
- Hashing for std::basic_string_view and std::basic_string is identical.

However, this CL allows to use a std::string_view when calling
std::unordered_map::find without requiring to convert the string_view
to a std::string first.

The CL takes advantage of that by replacing a few more const reference
to std::string by std::string_view. This avoids potential heap
allocations and reduces the binary size by ~3KB.

Bug: 349741884
Change-Id: Ifcfd7638ee27f641097ad3929bc7fa58c4260b3d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5658436
Code-Coverage: findit-for-me@appspot.gserviceaccount.com <findit-for-me@appspot.gserviceaccount.com>
Commit-Queue: Jan Keitel <jkeitel@google.com>
Reviewed-by: Dominic Battré <battre@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1320204}
2024-06-27 07:54:06 +00:00
..