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

Unified Diff: ui/gl/gl_image_memory.cc

Issue 1323593003: Log both GL and cpu-side memory in GLImage*Memory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
« no previous file with comments | « ui/gl/gl_image_memory.h ('k') | ui/gl/gl_image_ref_counted_memory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/gl/gl_image_memory.h ('k') | ui/gl/gl_image_ref_counted_memory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698