Commit 09774812 authored by Jeremy Roman's avatar Jeremy Roman Committed by Chromium LUCI CQ

extensions: Move RecordRequestHeader and RecordResponseHeader to fixed_flat_map.

Rather than copy to the heap to make a dynamically modifiable flat_map,
we can build the map into .data.rel.ro at compile time.

To support current static_assert, base::flat_tree::size is made
constexpr if the underlying collection is, as it is for fixed_flat_map
and fixed_flat_set (specifically, std::array).
For consistency, max_size and empty are similarly updated.

Bug: None
Change-Id: Ia21850b48e928e328f9cb85702b561925cca2d3e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2566034Reviewed-by: default avatarJan Wilken Dörrie <jdoerrie@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Jeremy Roman <jbroman@chromium.org>
Auto-Submit: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832358}
parent a8cac9ec
...@@ -254,9 +254,9 @@ class flat_tree { ...@@ -254,9 +254,9 @@ class flat_tree {
void clear(); void clear();
size_type size() const; constexpr size_type size() const;
size_type max_size() const; constexpr size_type max_size() const;
bool empty() const; constexpr bool empty() const;
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
// Iterators. // Iterators.
...@@ -681,19 +681,21 @@ void flat_tree<Key, GetKeyFromValue, KeyCompare, Container>::clear() { ...@@ -681,19 +681,21 @@ void flat_tree<Key, GetKeyFromValue, KeyCompare, Container>::clear() {
} }
template <class Key, class GetKeyFromValue, class KeyCompare, class Container> template <class Key, class GetKeyFromValue, class KeyCompare, class Container>
auto flat_tree<Key, GetKeyFromValue, KeyCompare, Container>::size() const constexpr auto flat_tree<Key, GetKeyFromValue, KeyCompare, Container>::size()
-> size_type { const -> size_type {
return body_.size(); return body_.size();
} }
template <class Key, class GetKeyFromValue, class KeyCompare, class Container> template <class Key, class GetKeyFromValue, class KeyCompare, class Container>
auto flat_tree<Key, GetKeyFromValue, KeyCompare, Container>::max_size() const constexpr auto
flat_tree<Key, GetKeyFromValue, KeyCompare, Container>::max_size() const
-> size_type { -> size_type {
return body_.max_size(); return body_.max_size();
} }
template <class Key, class GetKeyFromValue, class KeyCompare, class Container> template <class Key, class GetKeyFromValue, class KeyCompare, class Container>
bool flat_tree<Key, GetKeyFromValue, KeyCompare, Container>::empty() const { constexpr bool flat_tree<Key, GetKeyFromValue, KeyCompare, Container>::empty()
const {
return body_.empty(); return body_.empty();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment