Index: ui/gl/gl_image_memory.cc |
diff --git a/ui/gl/gl_image_memory.cc b/ui/gl/gl_image_memory.cc |
index e5160a6cbec3c4e5e59e43018b36d431209ac0c7..b1dcc777c88cfd2bb00440587d9005032974b2a7 100644 |
--- a/ui/gl/gl_image_memory.cc |
+++ b/ui/gl/gl_image_memory.cc |
@@ -446,14 +446,27 @@ void GLImageMemory::DoBindTexImage(unsigned target) { |
void GLImageMemory::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
uint64_t process_tracing_id, |
const std::string& dump_name) { |
- // Log size 0 if |ref_counted_memory_| has been released. |
- size_t size_in_bytes = memory_ ? SizeInBytes(size_, format_) : 0; |
+ // Note that the following calculation does not consider whether this GLImage |
+ // has been un-bound from a texture. It also relies on this GLImage only ever |
+ // being bound to a single texture. We could check these conditions more |
+ // thoroughly, but at the cost of extra GL queries. |
+ bool is_bound_to_texture = target_ && !need_do_bind_tex_image_; |
+ |
+#if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || \ |
+ defined(USE_OZONE) |
+ is_bound_to_texture |= !!egl_texture_id_; |
+#endif |
+ |
+ size_t size_in_bytes = is_bound_to_texture ? SizeInBytes(size_, format_) : 0; |
base::trace_event::MemoryAllocatorDump* dump = |
- pmd->CreateAllocatorDump(dump_name); |
+ pmd->CreateAllocatorDump(dump_name + "/texture_memory"); |
dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
static_cast<uint64_t>(size_in_bytes)); |
+ |
+ // No need for a global shared edge here. This object in the GPU process is |
+ // the sole owner of this texture id. |
} |
} // namespace gfx |