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

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

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: Implement buckets Created 3 years, 11 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 7021fa399f4ccf7f887667ab73589d5753206b43..b1e6eade49cd2855a955c63859c0e97574bb619a 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"
@@ -377,10 +378,15 @@ 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) {
+ auto guid = GetBufferGUIDForTracing(tracing_process_id, ring_buffer_id_);
+ const int kImportance = 2;
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid, kImportance);
+ base::SharedMemoryTracker::AddOwnershipEdgeToSharedGlobalDump(pmd, guid,
+ shared_memory->handle(), shared_memory->mapped_size());
+ }
}
return true;

Powered by Google App Engine
This is Rietveld 408576698