| Index: gpu/command_buffer/client/mapped_memory.cc
|
| diff --git a/gpu/command_buffer/client/mapped_memory.cc b/gpu/command_buffer/client/mapped_memory.cc
|
| index 708e121f39c0c24a9593b0714bb14f3b28b5c210..ad1809cdc6d4fb01d6fba4280e2a2bf1373a0c1c 100644
|
| --- a/gpu/command_buffer/client/mapped_memory.cc
|
| +++ b/gpu/command_buffer/client/mapped_memory.cc
|
| @@ -13,6 +13,7 @@
|
| #include "base/atomic_sequence_num.h"
|
| #include "base/logging.h"
|
| #include "base/memory/ptr_util.h"
|
| +#include "base/memory/shared_memory_tracker.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/threading/thread_task_runner_handle.h"
|
| #include "base/trace_event/memory_dump_manager.h"
|
| @@ -173,9 +174,6 @@ bool MappedMemoryManager::OnMemoryDump(
|
| return true;
|
| }
|
|
|
| - const uint64_t tracing_process_id =
|
| - base::trace_event::MemoryDumpManager::GetInstance()
|
| - ->GetTracingProcessId();
|
| for (const auto& chunk : chunks_) {
|
| std::string dump_name = base::StringPrintf(
|
| "gpu/mapped_memory/manager_%d/chunk_%d", tracing_id_, chunk->shm_id());
|
| @@ -186,11 +184,19 @@ bool MappedMemoryManager::OnMemoryDump(
|
| dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes,
|
| chunk->GetFreeSize());
|
|
|
| - auto guid = GetBufferGUIDForTracing(tracing_process_id, chunk->shm_id());
|
| -
|
| - const int kImportance = 2;
|
| - pmd->CreateSharedGlobalAllocatorDump(guid);
|
| - pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
|
| + auto* shared_memory = chunk->buffer()->backing()->shared_memory();
|
| + if (shared_memory) {
|
| + base::SharedMemoryTracker::AddOwnershipEdges(pmd, dump->guid(),
|
| + *shared_memory);
|
| + } else {
|
| + const uint64_t tracing_process_id =
|
| + base::trace_event::MemoryDumpManager::GetInstance()
|
| + ->GetTracingProcessId();
|
| + auto guid = GetBufferGUIDForTracing(tracing_process_id, chunk->shm_id());
|
| + const int kImportance = 2;
|
| + pmd->CreateSharedGlobalAllocatorDump(guid);
|
| + pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
|
| + }
|
| }
|
|
|
| return true;
|
|
|