Index: base/memory/shared_memory_tracker.h |
diff --git a/base/memory/shared_memory_tracker.h b/base/memory/shared_memory_tracker.h |
index 039e48d515fafc1fe2b49bcee9f743d485de3454..e0ff268320c5ffccd2bb1e1c83a264514767d4cc 100644 |
--- a/base/memory/shared_memory_tracker.h |
+++ b/base/memory/shared_memory_tracker.h |
@@ -14,6 +14,7 @@ |
namespace base { |
namespace trace_event { |
+class MemoryAllocatorDumpGuid; |
class ProcessMemoryDump; |
} |
@@ -24,6 +25,14 @@ class BASE_EXPORT SharedMemoryTracker |
// Returns a singleton instance. |
static SharedMemoryTracker* GetInstance(); |
+ // Adds two ownership edges between the given guid |source| and its global |
+ // shared memory dump. This helps to get accurate effective size of modules |
+ // that backend is shared memory. |
+ static bool AddOwnershipEdges( |
+ trace_event::ProcessMemoryDump* pmd, |
+ const trace_event::MemoryAllocatorDumpGuid& source, |
+ const SharedMemory& shared_memory); |
+ |
// Records shared memory usage on mapping. |
void IncrementMemoryUsage(const SharedMemory& shared_memory); |
@@ -31,24 +40,16 @@ class BASE_EXPORT SharedMemoryTracker |
void DecrementMemoryUsage(const SharedMemory& shared_memory); |
private: |
- struct Usage { |
- Usage(); |
- Usage(const Usage& rhs); |
- ~Usage(); |
- SharedMemory::UniqueId unique_id; |
- size_t size; |
- }; |
- |
SharedMemoryTracker(); |
~SharedMemoryTracker() override; |
// base::trace_event::MemoryDumpProvider implementation. |
- bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
- base::trace_event::ProcessMemoryDump* pmd) override; |
+ bool OnMemoryDump(const trace_event::MemoryDumpArgs& args, |
+ trace_event::ProcessMemoryDump* pmd) override; |
// Used to lock when |usages_| is modified or read. |
Lock usages_lock_; |
- std::unordered_map<const SharedMemory*, Usage> usages_; |
+ std::unordered_map<const SharedMemory*, size_t> usages_; |
DISALLOW_COPY_AND_ASSIGN(SharedMemoryTracker); |
}; |