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_MEMORY_DUMP_SESSION_STATE_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ |
6 #define BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 : public RefCountedThreadSafe<MemoryDumpSessionState> { | 22 : public RefCountedThreadSafe<MemoryDumpSessionState> { |
23 public: | 23 public: |
24 MemoryDumpSessionState(); | 24 MemoryDumpSessionState(); |
25 | 25 |
26 // Returns the stack frame deduplicator that should be used by memory dump | 26 // Returns the stack frame deduplicator that should be used by memory dump |
27 // providers when doing a heap dump. | 27 // providers when doing a heap dump. |
28 StackFrameDeduplicator* stack_frame_deduplicator() const { | 28 StackFrameDeduplicator* stack_frame_deduplicator() const { |
29 return stack_frame_deduplicator_.get(); | 29 return stack_frame_deduplicator_.get(); |
30 } | 30 } |
31 | 31 |
32 void SetStackFrameDeduplicator( | |
33 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator); | |
34 | |
35 // Returns the type name deduplicator that should be used by memory dump | 32 // Returns the type name deduplicator that should be used by memory dump |
36 // providers when doing a heap dump. | 33 // providers when doing a heap dump. |
37 TypeNameDeduplicator* type_name_deduplicator() const { | 34 TypeNameDeduplicator* type_name_deduplicator() const { |
38 return type_name_deduplicator_.get(); | 35 return type_name_deduplicator_.get(); |
39 } | 36 } |
40 | 37 |
41 void SetTypeNameDeduplicator( | 38 // Returns generic string deduplicator used by other deduplicators. |
42 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator); | 39 StringDeduplicator* string_deduplicator() const { |
| 40 return string_deduplicator_.get(); |
| 41 } |
| 42 |
| 43 void CreateDeduplicators(); |
43 | 44 |
44 void SetAllowedDumpModes( | 45 void SetAllowedDumpModes( |
45 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes); | 46 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes); |
46 | 47 |
47 bool IsDumpModeAllowed(MemoryDumpLevelOfDetail dump_mode) const; | 48 bool IsDumpModeAllowed(MemoryDumpLevelOfDetail dump_mode) const; |
48 | 49 |
49 void set_heap_profiler_breakdown_threshold_bytes(uint32_t value) { | 50 void set_heap_profiler_breakdown_threshold_bytes(uint32_t value) { |
50 heap_profiler_breakdown_threshold_bytes_ = value; | 51 heap_profiler_breakdown_threshold_bytes_ = value; |
51 } | 52 } |
52 | 53 |
53 uint32_t heap_profiler_breakdown_threshold_bytes() const { | 54 uint32_t heap_profiler_breakdown_threshold_bytes() const { |
54 return heap_profiler_breakdown_threshold_bytes_; | 55 return heap_profiler_breakdown_threshold_bytes_; |
55 } | 56 } |
56 | 57 |
57 private: | 58 private: |
58 friend class RefCountedThreadSafe<MemoryDumpSessionState>; | 59 friend class RefCountedThreadSafe<MemoryDumpSessionState>; |
59 ~MemoryDumpSessionState(); | 60 ~MemoryDumpSessionState(); |
60 | 61 |
61 // Deduplicates backtraces in heap dumps so they can be written once when the | 62 // Deduplicates backtraces in heap dumps so they can be written once when the |
62 // trace is finalized. | 63 // trace is finalized. |
63 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator_; | 64 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator_; |
64 | 65 |
65 // Deduplicates type names in heap dumps so they can be written once when the | 66 // Deduplicates type names in heap dumps so they can be written once when the |
66 // trace is finalized. | 67 // trace is finalized. |
67 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator_; | 68 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator_; |
68 | 69 |
| 70 // Generic string deduplicator, used by other deduplicators. |
| 71 std::unique_ptr<StringDeduplicator> string_deduplicator_; |
| 72 |
69 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes_; | 73 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes_; |
70 | 74 |
71 uint32_t heap_profiler_breakdown_threshold_bytes_; | 75 uint32_t heap_profiler_breakdown_threshold_bytes_; |
72 }; | 76 }; |
73 | 77 |
74 } // namespace trace_event | 78 } // namespace trace_event |
75 } // namespace base | 79 } // namespace base |
76 | 80 |
77 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ | 81 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ |
OLD | NEW |