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 66d430f2ee32572aa0732c4105de410a3ac4db27..712985dcddcdb43d03ef7cc94bf8d210e898fa90 100644 |
| --- a/base/trace_event/heap_profiler_stack_frame_deduplicator.h |
| +++ b/base/trace_event/heap_profiler_stack_frame_deduplicator.h |
| @@ -12,12 +12,13 @@ |
| #include "base/base_export.h" |
| #include "base/macros.h" |
| #include "base/trace_event/heap_profiler_allocation_context.h" |
| -#include "base/trace_event/trace_event_impl.h" |
| namespace base { |
| namespace trace_event { |
| +class StringDeduplicator; |
| class TraceEventMemoryOverhead; |
| +class TracedValue; |
| // A data structure that allows grouping a set of backtraces in a space- |
| // efficient manner by creating a call tree and writing it as a set of (node, |
| @@ -26,7 +27,7 @@ class TraceEventMemoryOverhead; |
| // of |StackFrame|s to index into |frames_|. So there is a trie for bottum-up |
| // lookup of a backtrace for deduplication, and a tree for compact storage in |
| // the trace log. |
| -class BASE_EXPORT StackFrameDeduplicator : public ConvertableToTraceFormat { |
| +class BASE_EXPORT StackFrameDeduplicator { |
| public: |
| // A node in the call tree. |
| struct FrameNode { |
| @@ -48,8 +49,8 @@ class BASE_EXPORT StackFrameDeduplicator : public ConvertableToTraceFormat { |
| using ConstIterator = std::vector<FrameNode>::const_iterator; |
| - StackFrameDeduplicator(); |
| - ~StackFrameDeduplicator() override; |
| + StackFrameDeduplicator(StringDeduplicator* string_deduplicator); |
|
Primiano Tucci (use gerrit)
2017/03/09 11:47:45
+explicit, otherwise this ctor will become too sup
DmitrySkiba
2017/03/14 22:12:47
Done.
|
| + ~StackFrameDeduplicator(); |
| // Inserts a backtrace where |beginFrame| is a pointer to the bottom frame |
| // (e.g. main) and |endFrame| is a pointer past the top frame (most recently |
| @@ -61,16 +62,19 @@ class BASE_EXPORT StackFrameDeduplicator : public ConvertableToTraceFormat { |
| ConstIterator begin() const { return frames_.begin(); } |
| ConstIterator end() const { return frames_.end(); } |
| - // Writes the |stackFrames| dictionary as defined in https://goo.gl/GerkV8 to |
| - // the trace log. |
| - void AppendAsTraceFormat(std::string* out) const override; |
| + // Appends new |stackFrames| dictionary items that were added after the |
| + // last call to this function. |
| + void ExportIncrementally(TracedValue* traced_value); |
| // Estimates memory overhead including |sizeof(StackFrameDeduplicator)|. |
| - void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead) override; |
| + void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead); |
| private: |
| + StringDeduplicator* string_deduplicator_; |
| + |
| std::map<StackFrame, int> roots_; |
| std::vector<FrameNode> frames_; |
| + size_t last_exported_index_; |
| DISALLOW_COPY_AND_ASSIGN(StackFrameDeduplicator); |
| }; |