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

Unified Diff: ui/gl/gl_image_shared_memory.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
« no previous file with comments | « ui/gfx/gpu_memory_buffer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_shared_memory.cc
diff --git a/ui/gl/gl_image_shared_memory.cc b/ui/gl/gl_image_shared_memory.cc
index 03f5aa8700cd58d7f120014b976077fe331172a2..291ad9b2254b5f4b00bc1f9854be1f217cda5521 100644
--- a/ui/gl/gl_image_shared_memory.cc
+++ b/ui/gl/gl_image_shared_memory.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/memory/shared_memory.h"
+#include "base/memory/shared_memory_tracker.h"
#include "base/numerics/safe_math.h"
#include "base/process/process_handle.h"
#include "base/sys_info.h"
@@ -88,10 +89,19 @@ void GLImageSharedMemory::OnMemoryDump(
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
static_cast<uint64_t>(size_in_bytes));
- auto guid =
- gfx::GetSharedMemoryGUIDForTracing(process_tracing_id, shared_memory_id_);
- pmd->CreateSharedGlobalAllocatorDump(guid);
- pmd->AddOwnershipEdge(dump->guid(), guid);
+ if (shared_memory_) {
+ auto name = shared_memory_->handle().GetGUIDNameForTracing();
+ // The same dump name might be already created on single-process mode.
+ base::trace_event::MemoryAllocatorDump* local =
+ pmd->GetOrCreateAllocatorDump(name);
+ pmd->CreateSharedGlobalAllocatorDump(local->guid());
+ pmd->AddOwnershipEdge(dump->guid(), local->guid());
+ } else {
+ auto guid = gfx::GetSharedMemoryGUIDForTracing(process_tracing_id,
+ shared_memory_id_);
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid);
+ }
}
} // namespace gl
« no previous file with comments | « ui/gfx/gpu_memory_buffer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698