| Index: base/trace_event/memory_usage_estimator.h
|
| diff --git a/base/trace_event/memory_usage_estimator.h b/base/trace_event/memory_usage_estimator.h
|
| index 174429fa975a54b5a804bff9792448c5fbe3dfb6..90c94aba931f445f402809a9d1f73623f8952712 100644
|
| --- a/base/trace_event/memory_usage_estimator.h
|
| +++ b/base/trace_event/memory_usage_estimator.h
|
| @@ -22,6 +22,8 @@
|
| #include <vector>
|
|
|
| #include "base/base_export.h"
|
| +#include "base/containers/flat_map.h"
|
| +#include "base/containers/flat_set.h"
|
| #include "base/containers/linked_list.h"
|
| #include "base/strings/string16.h"
|
|
|
| @@ -150,6 +152,12 @@ size_t EstimateMemoryUsage(const std::priority_queue<T, C>& queue);
|
| template <class T, class C>
|
| size_t EstimateMemoryUsage(const std::stack<T, C>& stack);
|
|
|
| +template <class T, class C>
|
| +size_t EstimateMemoryUsage(const base::flat_set<T, C>& set);
|
| +
|
| +template <class K, class V, class C>
|
| +size_t EstimateMemoryUsage(const base::flat_map<K, V, C>& map);
|
| +
|
| // TODO(dskiba):
|
| // std::forward_list
|
|
|
| @@ -542,6 +550,20 @@ size_t EstimateMemoryUsage(const std::stack<T, C>& stack) {
|
| return EstimateMemoryUsage(internal::GetUnderlyingContainer(stack));
|
| }
|
|
|
| +// Flat containers
|
| +
|
| +template <class T, class C>
|
| +size_t EstimateMemoryUsage(const base::flat_set<T, C>& set) {
|
| + using value_type = typename base::flat_set<T, C>::value_type;
|
| + return sizeof(value_type) * set.capacity() + EstimateIterableMemoryUsage(set);
|
| +}
|
| +
|
| +template <class K, class V, class C>
|
| +size_t EstimateMemoryUsage(const base::flat_map<K, V, C>& map) {
|
| + using value_type = typename base::flat_map<K, V, C>::value_type;
|
| + return sizeof(value_type) * map.capacity() + EstimateIterableMemoryUsage(map);
|
| +}
|
| +
|
| } // namespace trace_event
|
| } // namespace base
|
|
|
|
|