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

Unified Diff: media/video/gpu_memory_buffer_video_frame_pool.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: media/video/gpu_memory_buffer_video_frame_pool.cc
diff --git a/media/video/gpu_memory_buffer_video_frame_pool.cc b/media/video/gpu_memory_buffer_video_frame_pool.cc
index 04021f520ca85059efc44e044d7b6e6da6f32839..cc2d05a9a032b6137785d5ef7a163be247106f9e 100644
--- a/media/video/gpu_memory_buffer_video_frame_pool.cc
+++ b/media/video/gpu_memory_buffer_video_frame_pool.cc
@@ -19,6 +19,8 @@
#include "base/containers/stack_container.h"
#include "base/location.h"
#include "base/macros.h"
+#include "base/memory/shared_memory.h"
+#include "base/memory/shared_memory_tracker.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/memory_dump_provider.h"
@@ -29,7 +31,6 @@
#include "media/renderers/gpu_video_accelerator_factories.h"
#include "third_party/libyuv/include/libyuv.h"
#include "ui/gfx/buffer_format_util.h"
-#include "ui/gfx/gpu_memory_buffer_tracing.h"
#include "ui/gl/trace_util.h"
namespace media {
@@ -472,11 +473,19 @@ bool GpuMemoryBufferVideoFramePool::PoolImpl::OnMemoryDump(
dump->AddScalar("free_size",
base::trace_event::MemoryAllocatorDump::kUnitsBytes,
frame_resources->IsInUse() ? 0 : buffer_size_in_bytes);
- auto shared_buffer_guid =
- plane_resource.gpu_memory_buffer->GetGUIDForTracing(
- tracing_process_id);
- pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid);
- pmd->AddOwnershipEdge(dump->guid(), shared_buffer_guid, kImportance);
+
+ base::SharedMemory* shared_memory =
+ plane_resource.gpu_memory_buffer->GetSharedMemory();
+ if (shared_memory) {
+ base::SharedMemoryTracker::AddOwnershipEdges(pmd, dump->guid(),
+ *shared_memory);
+ } else {
+ auto shared_buffer_guid =
+ plane_resource.gpu_memory_buffer->GetGUIDForTracing(
+ tracing_process_id);
+ pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid);
+ pmd->AddOwnershipEdge(dump->guid(), shared_buffer_guid, kImportance);
+ }
}
}
}
« no previous file with comments | « gpu/ipc/service/gpu_command_buffer_stub.cc ('k') | services/ui/public/cpp/bitmap/child_shared_bitmap_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698