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

Unified Diff: gpu/command_buffer/client/cmd_buffer_helper.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/cmd_buffer_helper.cc
diff --git a/gpu/command_buffer/client/cmd_buffer_helper.cc b/gpu/command_buffer/client/cmd_buffer_helper.cc
index 42cb4165a8484722521ce04bfa8bd615eefe3ea4..192105111dd24cb14d2071beab19815995923bc2 100644
--- a/gpu/command_buffer/client/cmd_buffer_helper.cc
+++ b/gpu/command_buffer/client/cmd_buffer_helper.cc
@@ -10,6 +10,7 @@
#include <algorithm>
#include "base/logging.h"
+#include "base/memory/shared_memory_tracker.h"
#include "base/strings/stringprintf.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
@@ -375,10 +376,6 @@ bool CommandBufferHelper::OnMemoryDump(
if (!HaveRingBuffer())
return true;
- const uint64_t tracing_process_id =
- base::trace_event::MemoryDumpManager::GetInstance()
- ->GetTracingProcessId();
-
MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf(
"gpu/command_buffer_memory/buffer_%d", ring_buffer_id_));
dump->AddScalar(MemoryAllocatorDump::kNameSize,
@@ -388,10 +385,19 @@ bool CommandBufferHelper::OnMemoryDump(
dump->AddScalar(
"free_size", MemoryAllocatorDump::kUnitsBytes,
GetTotalFreeEntriesNoWaiting() * sizeof(CommandBufferEntry));
- auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_);
- const int kImportance = 2;
- pmd->CreateSharedGlobalAllocatorDump(guid);
- pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
+ auto* shared_memory = ring_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, ring_buffer_id_);
+ const int kImportance = 2;
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
+ }
}
return true;
« no previous file with comments | « content/browser/gpu/browser_gpu_memory_buffer_manager.cc ('k') | gpu/command_buffer/client/gles2_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698