Index: gpu/command_buffer/service/texture_manager.cc |
diff --git a/gpu/command_buffer/service/texture_manager.cc b/gpu/command_buffer/service/texture_manager.cc |
index dbe95db5b0987cc247aae5d060983263bef23dea..7944b5151dddcd4536dc9e9bc2105cfdc711ad8a 100644 |
--- a/gpu/command_buffer/service/texture_manager.cc |
+++ b/gpu/command_buffer/service/texture_manager.cc |
@@ -34,6 +34,9 @@ |
#include "ui/gl/gl_version_info.h" |
#include "ui/gl/trace_util.h" |
+using base::trace_event::MemoryAllocatorDump; |
+using base::trace_event::MemoryDumpLevelOfDetail; |
+ |
namespace gpu { |
namespace gles2 { |
@@ -1681,12 +1684,10 @@ void Texture::DumpLevelMemory(base::trace_event::ProcessMemoryDump* pmd, |
// texture allocation also as the storage is not provided by the |
// GLImage in that case. |
if (level_infos[level_index].image_state != BOUND) { |
- base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( |
- base::StringPrintf("%s/face_%d/level_%d", dump_name.c_str(), |
- face_index, level_index)); |
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(base::StringPrintf( |
+ "%s/face_%d/level_%d", dump_name.c_str(), face_index, level_index)); |
dump->AddScalar( |
- base::trace_event::MemoryAllocatorDump::kNameSize, |
- base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
+ MemoryAllocatorDump::kNameSize, MemoryAllocatorDump::kUnitsBytes, |
static_cast<uint64_t>(level_infos[level_index].estimated_size)); |
} |
} |
@@ -3131,8 +3132,21 @@ ScopedTextureUploadTimer::~ScopedTextureUploadTimer() { |
bool TextureManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
base::trace_event::ProcessMemoryDump* pmd) { |
+ if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) { |
+ std::string dump_name = |
+ base::StringPrintf("gpu/gl/textures/share_group_%" PRIu64 "", |
+ memory_tracker_->ShareGroupTracingGUID()); |
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
+ dump->AddScalar(MemoryAllocatorDump::kNameSize, |
+ MemoryAllocatorDump::kUnitsBytes, mem_represented()); |
+ |
+ // Early out, no need for more detail in a BACKGROUND dump. |
+ return true; |
+ } |
+ |
for (const auto& resource : textures_) { |
- // Only dump memory info for textures actually owned by this TextureManager. |
+ // Only dump memory info for textures actually owned by this |
+ // TextureManager. |
DumpTextureRef(pmd, resource.second.get()); |
} |
@@ -3158,10 +3172,9 @@ void TextureManager::DumpTextureRef(base::trace_event::ProcessMemoryDump* pmd, |
"gpu/gl/textures/share_group_%" PRIu64 "/texture_%d", |
memory_tracker_->ShareGroupTracingGUID(), ref->client_id()); |
- base::trace_event::MemoryAllocatorDump* dump = |
- pmd->CreateAllocatorDump(dump_name); |
- dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
- base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name); |
+ dump->AddScalar(MemoryAllocatorDump::kNameSize, |
+ MemoryAllocatorDump::kUnitsBytes, |
static_cast<uint64_t>(size)); |
// Add the |client_guid| which expresses shared ownership with the client |