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

Unified Diff: gpu/command_buffer/client/gles2_implementation.cc

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: (rebase) Created 3 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: gpu/command_buffer/client/gles2_implementation.cc
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 38975cc581b68133c8ad5d9f6b186e3015f6b89e..55d5357a81f2be3354f12dfc3a8d9397467b898b 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -20,6 +20,7 @@
#include "base/atomic_sequence_num.h"
#include "base/bits.h"
#include "base/compiler_specific.h"
+#include "base/memory/shared_memory_tracker.h"
#include "base/numerics/safe_math.h"
#include "base/strings/string_split.h"
#include "base/strings/stringprintf.h"
@@ -452,10 +453,6 @@ bool GLES2Implementation::OnMemoryDump(
if (!transfer_buffer_->HaveBuffer())
return true;
- const uint64_t tracing_process_id =
- base::trace_event::MemoryDumpManager::GetInstance()
- ->GetTracingProcessId();
-
MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf(
"gpu/transfer_buffer_memory/buffer_%d", transfer_buffer_->GetShmId()));
dump->AddScalar(MemoryAllocatorDump::kNameSize,
@@ -465,11 +462,20 @@ bool GLES2Implementation::OnMemoryDump(
if (args.level_of_detail != MemoryDumpLevelOfDetail::BACKGROUND) {
dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes,
transfer_buffer_->GetFreeSize());
- auto guid = GetBufferGUIDForTracing(tracing_process_id,
- transfer_buffer_->GetShmId());
- const int kImportance = 2;
- pmd->CreateSharedGlobalAllocatorDump(guid);
- pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
+ auto* shared_memory = transfer_buffer_->GetSharedMemory();
+ 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,
+ transfer_buffer_->GetShmId());
+ const int kImportance = 2;
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
+ }
}
return true;
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper.cc ('k') | gpu/command_buffer/client/gles2_implementation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698