| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_STACK_FRAME_DEDUPLICATOR_H_ | 5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_STACK_FRAME_DEDUPLICATOR_H_ |
| 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_STACK_FRAME_DEDUPLICATOR_H_ | 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_STACK_FRAME_DEDUPLICATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // lookup of a backtrace for deduplication, and a tree for compact storage in | 27 // lookup of a backtrace for deduplication, and a tree for compact storage in |
| 28 // the trace log. | 28 // the trace log. |
| 29 class BASE_EXPORT StackFrameDeduplicator : public ConvertableToTraceFormat { | 29 class BASE_EXPORT StackFrameDeduplicator : public ConvertableToTraceFormat { |
| 30 public: | 30 public: |
| 31 // A node in the call tree. | 31 // A node in the call tree. |
| 32 struct FrameNode { | 32 struct FrameNode { |
| 33 FrameNode(StackFrame frame, int parent_frame_index); | 33 FrameNode(StackFrame frame, int parent_frame_index); |
| 34 FrameNode(const FrameNode& other); | 34 FrameNode(const FrameNode& other); |
| 35 ~FrameNode(); | 35 ~FrameNode(); |
| 36 | 36 |
| 37 size_t EstimateMemoryUsage() const; |
| 38 |
| 37 StackFrame frame; | 39 StackFrame frame; |
| 38 | 40 |
| 39 // The index of the parent stack frame in |frames_|, or -1 if there is no | 41 // The index of the parent stack frame in |frames_|, or -1 if there is no |
| 40 // parent frame (when it is at the bottom of the call stack). | 42 // parent frame (when it is at the bottom of the call stack). |
| 41 int parent_frame_index; | 43 int parent_frame_index; |
| 42 | 44 |
| 43 // Indices into |frames_| of frames called from the current frame. | 45 // Indices into |frames_| of frames called from the current frame. |
| 44 std::map<StackFrame, int> children; | 46 std::map<StackFrame, int> children; |
| 45 }; | 47 }; |
| 46 | 48 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 70 std::map<StackFrame, int> roots_; | 72 std::map<StackFrame, int> roots_; |
| 71 std::vector<FrameNode> frames_; | 73 std::vector<FrameNode> frames_; |
| 72 | 74 |
| 73 DISALLOW_COPY_AND_ASSIGN(StackFrameDeduplicator); | 75 DISALLOW_COPY_AND_ASSIGN(StackFrameDeduplicator); |
| 74 }; | 76 }; |
| 75 | 77 |
| 76 } // namespace trace_event | 78 } // namespace trace_event |
| 77 } // namespace base | 79 } // namespace base |
| 78 | 80 |
| 79 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_STACK_FRAME_DEDUPLICATOR_H_ | 81 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_STACK_FRAME_DEDUPLICATOR_H_ |
| OLD | NEW |