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

Unified Diff: base/trace_event/process_memory_dump.h

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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 df6cc827ff4cb051ba2a1aed5dc925154198323f..bd9c5434ddabfc624b0a804c1c5744104a180f5d 100644
--- a/base/trace_event/process_memory_dump.h
+++ b/base/trace_event/process_memory_dump.h
@@ -8,8 +8,10 @@
#include "base/base_export.h"
#include "base/containers/hash_tables.h"
#include "base/containers/small_map.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_vector.h"
#include "base/trace_event/memory_allocator_dump.h"
+#include "base/trace_event/memory_dump_session_state.h"
#include "base/trace_event/process_memory_maps.h"
#include "base/trace_event/process_memory_totals.h"
@@ -18,19 +20,22 @@ namespace trace_event {
class ConvertableToTraceFormat;
class MemoryDumpManager;
+class MemoryDumpSessionState;
// ProcessMemoryDump is as a strongly typed container which enforces the data
-// model for each memory dump point and holds the dumps produced by the
+// model for each memory dump and holds the dumps produced by the
// MemoryDumpProvider(s) for a specific process.
// At trace generation time (i.e. when AsValue() is called), ProcessMemoryDump
// will compose a key-value dictionary of the various dumps obtained at trace
// dump point time.
class BASE_EXPORT ProcessMemoryDump {
public:
+ // Maps allocator dumps absolute names (allocator_name/heap/subheap) to
+ // MemoryAllocatorDump instances.
using AllocatorDumpsMap =
SmallMap<hash_map<std::string, MemoryAllocatorDump*>>;
- ProcessMemoryDump();
+ ProcessMemoryDump(const scoped_refptr<MemoryDumpSessionState>& session_state);
~ProcessMemoryDump();
// Called at trace generation time to populate the TracedValue.
@@ -45,20 +50,34 @@ class BASE_EXPORT ProcessMemoryDump {
void set_has_process_mmaps() { has_process_mmaps_ = true; }
// Creates a new MemoryAllocatorDump with the given name and returns the
- // empty object back to the caller. The |name| must be unique in the dump.
- // ProcessMemoryDump handles the memory ownership of the created object.
- // |parent| can be used to specify a hierarchical relationship of the
- // allocator dumps.
- MemoryAllocatorDump* CreateAllocatorDump(const std::string& name);
- MemoryAllocatorDump* CreateAllocatorDump(const std::string& name,
- MemoryAllocatorDump* parent);
-
- // Returns a MemoryAllocatorDump given its name or nullptr if not found.
- MemoryAllocatorDump* GetAllocatorDump(const std::string& name) const;
+ // empty object back to the caller.
+ // Arguments:
+ // allocator_name: a name that univocally identifies allocator dumps
+ // produced by this provider. It acts as a type w.r.t. the allocator
+ // attributes, in the sense that all the MAD with the same allocator_name
+ // are expected to have the same attributes.
+ // heap_name, either:
+ // - kRootHeap: if the allocator has only one default heap.
+ // - a string identifing a heap name (e.g., isolate1, isolate2 ...). It is
+ // possible to specify nesting by using a path-like string (e.g.,
+ // isolate1/heap_spaceX, isolate1/heap_spaceY, isolate2/heap_spaceX).
+ // The tuple (|allocator_name|, |heap_name|) is unique inside a PMD.
+ // ProcessMemoryDump handles the memory ownership of its MemoryAllocatorDumps.
+ MemoryAllocatorDump* CreateAllocatorDump(const std::string& allocator_name,
+ const std::string& heap_name);
+
+ // Looks up a MemoryAllocatorDump given its allocator and heap names, or
+ // nullptr if not found.
+ MemoryAllocatorDump* GetAllocatorDump(const std::string& allocator_name,
+ const std::string& heap_name) const;
// Returns the map of the MemoryAllocatorDumps added to this dump.
const AllocatorDumpsMap& allocator_dumps() const { return allocator_dumps_; }
+ const scoped_refptr<MemoryDumpSessionState>& session_state() const {
+ return session_state_;
+ }
+
private:
ProcessMemoryTotals process_totals_;
bool has_process_totals_;
@@ -66,13 +85,14 @@ class BASE_EXPORT ProcessMemoryDump {
ProcessMemoryMaps process_mmaps_;
bool has_process_mmaps_;
- // A maps of "allocator_name" -> MemoryAllocatorDump populated by
- // allocator dump providers.
AllocatorDumpsMap allocator_dumps_;
// ProcessMemoryDump handles the memory ownership of all its belongings.
ScopedVector<MemoryAllocatorDump> allocator_dumps_storage_;
+ // State shared among all PMDs instances created in a given trace session.
+ scoped_refptr<MemoryDumpSessionState> session_state_;
+
DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump);
};

Powered by Google App Engine
This is Rietveld 408576698