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 | 9 |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
11 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" | 11 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" |
12 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" | 12 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" |
| 13 #include "base/trace_event/trace_config.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 namespace trace_event { | 16 namespace trace_event { |
16 | 17 |
17 // Container for state variables that should be shared across all the memory | 18 // Container for state variables that should be shared across all the memory |
18 // dumps in a tracing session. | 19 // dumps in a tracing session. |
19 class BASE_EXPORT MemoryDumpSessionState | 20 class BASE_EXPORT MemoryDumpSessionState |
20 : public RefCountedThreadSafe<MemoryDumpSessionState> { | 21 : public RefCountedThreadSafe<MemoryDumpSessionState> { |
21 public: | 22 public: |
22 MemoryDumpSessionState(); | 23 MemoryDumpSessionState(); |
23 | 24 |
24 // Returns the stack frame deduplicator that should be used by memory dump | 25 // Returns the stack frame deduplicator that should be used by memory dump |
25 // providers when doing a heap dump. | 26 // providers when doing a heap dump. |
26 StackFrameDeduplicator* stack_frame_deduplicator() const { | 27 StackFrameDeduplicator* stack_frame_deduplicator() const { |
27 return stack_frame_deduplicator_.get(); | 28 return stack_frame_deduplicator_.get(); |
28 } | 29 } |
29 | 30 |
30 void SetStackFrameDeduplicator( | 31 void SetStackFrameDeduplicator( |
31 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator); | 32 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator); |
32 | 33 |
33 // Returns the type name deduplicator that should be used by memory dump | 34 // Returns the type name deduplicator that should be used by memory dump |
34 // providers when doing a heap dump. | 35 // providers when doing a heap dump. |
35 TypeNameDeduplicator* type_name_deduplicator() const { | 36 TypeNameDeduplicator* type_name_deduplicator() const { |
36 return type_name_deduplicator_.get(); | 37 return type_name_deduplicator_.get(); |
37 } | 38 } |
38 | 39 |
39 void SetTypeNameDeduplicator( | 40 void SetTypeNameDeduplicator( |
40 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator); | 41 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator); |
41 | 42 |
| 43 const TraceConfig::MemoryDumpConfig& memory_dump_config() const { |
| 44 return memory_dump_config_; |
| 45 } |
| 46 |
| 47 void SetMemoryDumpConfig(const TraceConfig::MemoryDumpConfig& config); |
| 48 |
42 private: | 49 private: |
43 friend class RefCountedThreadSafe<MemoryDumpSessionState>; | 50 friend class RefCountedThreadSafe<MemoryDumpSessionState>; |
44 ~MemoryDumpSessionState(); | 51 ~MemoryDumpSessionState(); |
45 | 52 |
46 // Deduplicates backtraces in heap dumps so they can be written once when the | 53 // Deduplicates backtraces in heap dumps so they can be written once when the |
47 // trace is finalized. | 54 // trace is finalized. |
48 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator_; | 55 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator_; |
49 | 56 |
50 // Deduplicates type names in heap dumps so they can be written once when the | 57 // Deduplicates type names in heap dumps so they can be written once when the |
51 // trace is finalized. | 58 // trace is finalized. |
52 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator_; | 59 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator_; |
| 60 |
| 61 // The memory dump config, copied at the time when the tracing session was |
| 62 // started. |
| 63 TraceConfig::MemoryDumpConfig memory_dump_config_; |
53 }; | 64 }; |
54 | 65 |
55 } // namespace trace_event | 66 } // namespace trace_event |
56 } // namespace base | 67 } // namespace base |
57 | 68 |
58 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ | 69 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ |
OLD | NEW |