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

Unified Diff: base/trace_event/process_memory_dump.h

Issue 2911263003: [memory-infra] Add method to override importance of ownership edges (Closed)
Patch Set: Make it public. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: base/trace_event/process_memory_dump.h
diff --git a/base/trace_event/process_memory_dump.h b/base/trace_event/process_memory_dump.h
index 45a973964231fa7d794b2be72d3175871970720b..d632d45a7ce5bb2eb509bbbc42b8080b7c574c27 100644
--- a/base/trace_event/process_memory_dump.h
+++ b/base/trace_event/process_memory_dump.h
@@ -7,6 +7,7 @@
#include <stddef.h>
+#include <map>
#include <unordered_map>
#include <vector>
@@ -43,6 +44,7 @@ class BASE_EXPORT ProcessMemoryDump {
MemoryAllocatorDumpGuid target;
int importance;
const char* type;
+ bool overridable;
};
// Maps allocator dumps absolute names (allocator_name/heap/subheap) to
@@ -53,6 +55,10 @@ class BASE_EXPORT ProcessMemoryDump {
using HeapDumpsMap =
std::unordered_map<std::string, std::unique_ptr<TracedValue>>;
+ // Stores allocator dump edges indexed by source allocator dump GUID.
+ using AllocatorDumpEdgesMap =
+ std::map<MemoryAllocatorDumpGuid, MemoryAllocatorDumpEdge>;
+
#if defined(COUNT_RESIDENT_BYTES_SUPPORTED)
// Returns the number of bytes in a kernel memory page. Some platforms may
// have a different value for kernel page sizes from user page sizes. It is
@@ -135,7 +141,14 @@ class BASE_EXPORT ProcessMemoryDump {
void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source,
const MemoryAllocatorDumpGuid& target);
- const std::vector<MemoryAllocatorDumpEdge>& allocator_dumps_edges() const {
+ // Adds edges that can be overriden by a later or earlier call to
+ // AddOwnershipEdge() with the same source and target with a different
+ // |importance| value.
+ void AddOverridableOwnershipEdge(const MemoryAllocatorDumpGuid& source,
+ const MemoryAllocatorDumpGuid& target,
+ int importance);
+
+ const AllocatorDumpEdgesMap& allocator_dumps_edges_for_testing() const {
return allocator_dumps_edges_;
}
@@ -200,7 +213,7 @@ class BASE_EXPORT ProcessMemoryDump {
scoped_refptr<MemoryDumpSessionState> session_state_;
// Keeps track of relationships between MemoryAllocatorDump(s).
- std::vector<MemoryAllocatorDumpEdge> allocator_dumps_edges_;
+ AllocatorDumpEdgesMap allocator_dumps_edges_;
// Level of detail of the current dump.
const MemoryDumpArgs dump_args_;

Powered by Google App Engine
This is Rietveld 408576698