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

Unified Diff: ui/gl/gl_image_shared_memory.cc

Issue 1299713003: GLImage::OnMemoryDump Stubs + Some Impls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@images1.3
Patch Set: Created 5 years, 4 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: 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 469a6f98d1c242a89e71792eb2c240ceb3d318c8..da85075fe652cf1e6ead4e537572c33f865812c3 100644
--- a/ui/gl/gl_image_shared_memory.cc
+++ b/ui/gl/gl_image_shared_memory.cc
@@ -33,8 +33,7 @@ bool SizeInBytes(const gfx::Size& size,
GLImageSharedMemory::GLImageSharedMemory(const gfx::Size& size,
unsigned internalformat)
- : GLImageMemory(size, internalformat) {
-}
+ : GLImageMemory(size, internalformat) {}
GLImageSharedMemory::~GLImageSharedMemory() {
DCHECK(!shared_memory_);
@@ -73,6 +72,7 @@ bool GLImageSharedMemory::Initialize(const gfx::GpuMemoryBufferHandle& handle,
DCHECK(!shared_memory_);
shared_memory_ = duped_shared_memory.Pass();
+ shared_memory_id_ = handle.id;
return true;
}
@@ -81,4 +81,23 @@ void GLImageSharedMemory::Destroy(bool have_context) {
shared_memory_.reset();
}
+void GLImageSharedMemory::OnMemoryDump(
+ base::trace_event::ProcessMemoryDump* pmd,
+ uint64_t process_tracing_id,
+ const std::string& dump_name) {
reveman 2015/08/18 08:32:52 This function should report 0 size or early out af
ericrk 2015/08/18 09:00:47 Switched both to report 0.
+ size_t size_bytes;
+ SizeInBytes(GetSize(), format(), &size_bytes);
+
+ base::trace_event::MemoryAllocatorDump* dump =
+ pmd->CreateAllocatorDump(dump_name);
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ static_cast<uint64_t>(size_bytes));
+
+ auto guid = gfx::GetGenericSharedMemoryGUIDForTracing(process_tracing_id,
+ shared_memory_id_);
+ pmd->CreateSharedGlobalAllocatorDump(guid);
+ pmd->AddOwnershipEdge(dump->guid(), guid);
+}
+
} // namespace gfx

Powered by Google App Engine
This is Rietveld 408576698