#include "base/memory/shared_memory_tracker.h"
#include "base/check.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/trace_event/base_tracing.h"
#include "base/tracing_buildflags.h"
#if BUILDFLAG(ENABLE_BASE_TRACING)
#include <optional>
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/process_memory_dump.h"
#endif
namespace base {
const char SharedMemoryTracker::kDumpRootName[] = …;
SharedMemoryTracker* SharedMemoryTracker::GetInstance() { … }
std::string SharedMemoryTracker::GetDumpNameForTracing(
const UnguessableToken& id) { … }
trace_event::MemoryAllocatorDumpGuid
SharedMemoryTracker::GetGlobalDumpIdForTracing(const UnguessableToken& id) { … }
const trace_event::MemoryAllocatorDump*
SharedMemoryTracker::GetOrCreateSharedMemoryDump(
const SharedMemoryMapping& shared_memory,
trace_event::ProcessMemoryDump* pmd) { … }
void SharedMemoryTracker::IncrementMemoryUsage(
const SharedMemoryMapping& mapping) { … }
void SharedMemoryTracker::DecrementMemoryUsage(
const SharedMemoryMapping& mapping) { … }
SharedMemoryTracker::SharedMemoryTracker() { … }
SharedMemoryTracker::~SharedMemoryTracker() = default;
bool SharedMemoryTracker::OnMemoryDump(const trace_event::MemoryDumpArgs& args,
trace_event::ProcessMemoryDump* pmd) { … }
const trace_event::MemoryAllocatorDump*
SharedMemoryTracker::GetOrCreateSharedMemoryDumpInternal(
void* mapped_memory,
size_t mapped_size,
const UnguessableToken& mapped_id,
trace_event::ProcessMemoryDump* pmd) { … }
}