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

Unified Diff: ui/gl/gl_image_shared_memory.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
« base/memory/shared_memory_win.cc ('K') | « ui/gl/gl_image_io_surface.mm ('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 83c8e5eba5388c0585072fa87a2c80f51699f499..71c8e2d4f14d7cb09ec38c23b64f6e141d6d91a7 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"
@@ -87,10 +88,14 @@ void GLImageSharedMemory::OnMemoryDump(
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
static_cast<uint64_t>(size_in_bytes));
- auto guid = GetGenericSharedMemoryGUIDForTracing(process_tracing_id,
- shared_memory_id_);
- pmd->CreateSharedGlobalAllocatorDump(guid);
- pmd->AddOwnershipEdge(dump->guid(), guid);
+ if (shared_memory_) {
+ auto guid = GetGenericSharedMemoryGUIDForTracing(process_tracing_id,
+ shared_memory_id_);
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid);
+ base::SharedMemoryTracker::AddOwnershipEdgeToSharedGlobalDump(
+ pmd, guid, shared_memory_->handle(), shared_memory_->mapped_size());
+ }
}
} // namespace gl
« base/memory/shared_memory_win.cc ('K') | « ui/gl/gl_image_io_surface.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698