Chromium Code Reviews| Index: base/trace_event/heap_profiler_stack_frame_deduplicator.h |
| diff --git a/base/trace_event/heap_profiler_stack_frame_deduplicator.h b/base/trace_event/heap_profiler_stack_frame_deduplicator.h |
| index 04b35675557552a669b25e784ceded574f671730..8667dcc95127b3dad2ff68ac9a83ff39c4863061 100644 |
| --- a/base/trace_event/heap_profiler_stack_frame_deduplicator.h |
| +++ b/base/trace_event/heap_profiler_stack_frame_deduplicator.h |
| @@ -5,11 +5,12 @@ |
| #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_STACK_FRAME_DEDUPLICATOR_H_ |
| #define BASE_TRACE_EVENT_HEAP_PROFILER_STACK_FRAME_DEDUPLICATOR_H_ |
| -#include <map> |
| +#include <deque> |
| #include <string> |
| -#include <vector> |
| +#include <unordered_map> |
| #include "base/base_export.h" |
| +#include "base/containers/flat_map.h" |
| #include "base/macros.h" |
| #include "base/trace_event/heap_profiler_allocation_context.h" |
| @@ -45,10 +46,10 @@ class BASE_EXPORT StackFrameDeduplicator { |
| constexpr static int kInvalidFrameIndex = -1; |
| // Indices into |frames_| of frames called from the current frame. |
| - std::map<StackFrame, int> children; |
| + base::flat_map<StackFrame, int> children; |
| }; |
| - using ConstIterator = std::vector<FrameNode>::const_iterator; |
| + using ConstIterator = std::deque<FrameNode>::const_iterator; |
| // |string_deduplication| is used during serialization, and is expected |
| // to outlive instances of this class. |
| @@ -73,12 +74,18 @@ class BASE_EXPORT StackFrameDeduplicator { |
| void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead); |
| private: |
| + bool Match(int frame_index, |
|
Primiano Tucci (use gerrit)
2017/07/12 15:31:14
I have no idea what this function does. Matches wh
|
| + const StackFrame* begin_frame, |
| + const StackFrame* end_frame) const; |
| + |
| StringDeduplicator* string_deduplicator_; |
| - std::map<StackFrame, int> roots_; |
| - std::vector<FrameNode> frames_; |
| + base::flat_map<StackFrame, int> roots_; |
| + std::deque<FrameNode> frames_; |
| size_t last_exported_index_; |
| + std::unordered_map<size_t, int> lookup_table_; |
|
Primiano Tucci (use gerrit)
2017/07/12 15:31:14
can yuou add a comment and call this in a more sig
|
| + |
| DISALLOW_COPY_AND_ASSIGN(StackFrameDeduplicator); |
| }; |