Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: base/trace_event/process_memory_dump.h

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 8 #include <stddef.h>
9 9
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 MemoryAllocatorDumpGuid target; 46 MemoryAllocatorDumpGuid target;
47 int importance; 47 int importance;
48 const char* type; 48 const char* type;
49 }; 49 };
50 50
51 // Maps allocator dumps absolute names (allocator_name/heap/subheap) to 51 // Maps allocator dumps absolute names (allocator_name/heap/subheap) to
52 // MemoryAllocatorDump instances. 52 // MemoryAllocatorDump instances.
53 using AllocatorDumpsMap = 53 using AllocatorDumpsMap =
54 std::unordered_map<std::string, scoped_ptr<MemoryAllocatorDump>>; 54 std::unordered_map<std::string, scoped_ptr<MemoryAllocatorDump>>;
55 55
56 using HeapDumpsMap = 56 using HeapDumpsMap = std::unordered_map<std::string, scoped_ptr<TracedValue>>;
57 std::unordered_map<std::string, scoped_refptr<TracedValue>>;
58 57
59 #if defined(COUNT_RESIDENT_BYTES_SUPPORTED) 58 #if defined(COUNT_RESIDENT_BYTES_SUPPORTED)
60 // Returns the total bytes resident for a virtual address range, with given 59 // Returns the total bytes resident for a virtual address range, with given
61 // |start_address| and |mapped_size|. |mapped_size| is specified in bytes. The 60 // |start_address| and |mapped_size|. |mapped_size| is specified in bytes. The
62 // value returned is valid only if the given range is currently mmapped by the 61 // value returned is valid only if the given range is currently mmapped by the
63 // process. The |start_address| must be page-aligned. 62 // process. The |start_address| must be page-aligned.
64 static size_t CountResidentBytes(void* start_address, size_t mapped_size); 63 static size_t CountResidentBytes(void* start_address, size_t mapped_size);
65 #endif 64 #endif
66 65
67 ProcessMemoryDump(const scoped_refptr<MemoryDumpSessionState>& session_state); 66 ProcessMemoryDump(const scoped_refptr<MemoryDumpSessionState>& session_state);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 MemoryAllocatorDump* GetSharedGlobalAllocatorDump( 109 MemoryAllocatorDump* GetSharedGlobalAllocatorDump(
111 const MemoryAllocatorDumpGuid& guid) const; 110 const MemoryAllocatorDumpGuid& guid) const;
112 111
113 // Returns the map of the MemoryAllocatorDumps added to this dump. 112 // Returns the map of the MemoryAllocatorDumps added to this dump.
114 const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; } 113 const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; }
115 114
116 // Adds a heap dump for the allocator with |absolute_name|. The |TracedValue| 115 // Adds a heap dump for the allocator with |absolute_name|. The |TracedValue|
117 // must have the correct format. |trace_event::HeapDumper| will generate such 116 // must have the correct format. |trace_event::HeapDumper| will generate such
118 // a value from a |trace_event::AllocationRegister|. 117 // a value from a |trace_event::AllocationRegister|.
119 void AddHeapDump(const std::string& absolute_name, 118 void AddHeapDump(const std::string& absolute_name,
120 scoped_refptr<TracedValue> heap_dump); 119 scoped_ptr<TracedValue> heap_dump);
121 120
122 // Adds an ownership relationship between two MemoryAllocatorDump(s) with the 121 // Adds an ownership relationship between two MemoryAllocatorDump(s) with the
123 // semantics: |source| owns |target|, and has the effect of attributing 122 // semantics: |source| owns |target|, and has the effect of attributing
124 // the memory usage of |target| to |source|. |importance| is optional and 123 // the memory usage of |target| to |source|. |importance| is optional and
125 // relevant only for the cases of co-ownership, where it acts as a z-index: 124 // relevant only for the cases of co-ownership, where it acts as a z-index:
126 // the owner with the highest importance will be attributed |target|'s memory. 125 // the owner with the highest importance will be attributed |target|'s memory.
127 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, 126 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source,
128 const MemoryAllocatorDumpGuid& target, 127 const MemoryAllocatorDumpGuid& target,
129 int importance); 128 int importance);
130 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, 129 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // Keeps track of relationships between MemoryAllocatorDump(s). 189 // Keeps track of relationships between MemoryAllocatorDump(s).
191 std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_; 190 std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_;
192 191
193 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); 192 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump);
194 }; 193 };
195 194
196 } // namespace trace_event 195 } // namespace trace_event
197 } // namespace base 196 } // namespace base
198 197
199 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ 198 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698