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_PROCESS_MEMORY_DUMP_H_ | 5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/containers/small_map.h" | 10 #include "base/containers/small_map.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // MemoryAllocatorDump instances. | 34 // MemoryAllocatorDump instances. |
35 using AllocatorDumpsMap = | 35 using AllocatorDumpsMap = |
36 SmallMap<hash_map<std::string, MemoryAllocatorDump*>>; | 36 SmallMap<hash_map<std::string, MemoryAllocatorDump*>>; |
37 | 37 |
38 ProcessMemoryDump(const scoped_refptr<MemoryDumpSessionState>& session_state); | 38 ProcessMemoryDump(const scoped_refptr<MemoryDumpSessionState>& session_state); |
39 ~ProcessMemoryDump(); | 39 ~ProcessMemoryDump(); |
40 | 40 |
41 // Called at trace generation time to populate the TracedValue. | 41 // Called at trace generation time to populate the TracedValue. |
42 void AsValueInto(TracedValue* value) const; | 42 void AsValueInto(TracedValue* value) const; |
43 | 43 |
| 44 // Merges all MemoryAllocatorDump(s) contained in |other| inside this |
| 45 // ProcessMemoryDump, transferring their ownership to this instance. |
| 46 // |other| will be an empty ProcessMemoryDump after this method returns. |
| 47 // This is to allow dump providers to pre-populate ProcessMemoryDump instances |
| 48 // and later move their contents into the ProcessMemoryDump passed as argument |
| 49 // of the MemoryDumpProvider::OnMemoryDump(ProcessMemoryDump*) callback. |
| 50 void TakeAllDumpsFrom(ProcessMemoryDump* other); |
| 51 |
44 ProcessMemoryTotals* process_totals() { return &process_totals_; } | 52 ProcessMemoryTotals* process_totals() { return &process_totals_; } |
45 bool has_process_totals() const { return has_process_totals_; } | 53 bool has_process_totals() const { return has_process_totals_; } |
46 void set_has_process_totals() { has_process_totals_ = true; } | 54 void set_has_process_totals() { has_process_totals_ = true; } |
47 | 55 |
48 ProcessMemoryMaps* process_mmaps() { return &process_mmaps_; } | 56 ProcessMemoryMaps* process_mmaps() { return &process_mmaps_; } |
49 bool has_process_mmaps() const { return has_process_mmaps_; } | 57 bool has_process_mmaps() const { return has_process_mmaps_; } |
50 void set_has_process_mmaps() { has_process_mmaps_ = true; } | 58 void set_has_process_mmaps() { has_process_mmaps_ = true; } |
51 | 59 |
52 // Creates a new MemoryAllocatorDump with the given name and returns the | 60 // Creates a new MemoryAllocatorDump with the given name and returns the |
53 // empty object back to the caller. | 61 // empty object back to the caller. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // State shared among all PMDs instances created in a given trace session. | 93 // State shared among all PMDs instances created in a given trace session. |
86 scoped_refptr<MemoryDumpSessionState> session_state_; | 94 scoped_refptr<MemoryDumpSessionState> session_state_; |
87 | 95 |
88 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); | 96 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); |
89 }; | 97 }; |
90 | 98 |
91 } // namespace trace_event | 99 } // namespace trace_event |
92 } // namespace base | 100 } // namespace base |
93 | 101 |
94 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 102 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
OLD | NEW |