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 54b2eafdcde9d4cdf75ca64988c4df0ee714b332..23ccd1359de2ff01a678707cf95ad47cd5ce54fe 100644 |
--- a/gpu/command_buffer/service/texture_manager.cc |
+++ b/gpu/command_buffer/service/texture_manager.cc |
@@ -33,6 +33,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 { |
@@ -1673,12 +1676,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)); |
} |
} |
@@ -3121,15 +3122,25 @@ ScopedTextureUploadTimer::~ScopedTextureUploadTimer() { |
bool TextureManager::OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
base::trace_event::ProcessMemoryDump* pmd) { |
- for (const auto& resource : textures_) { |
- // Only dump memory info for textures actually owned by this TextureManager. |
- DumpTextureRef(pmd, resource.second.get()); |
- } |
+ 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()); |
+ } else { |
+ for (const auto& resource : textures_) { |
+ // Only dump memory info for textures actually owned by this |
+ // TextureManager. |
+ DumpTextureRef(pmd, resource.second.get()); |
+ } |
- // Also dump TextureManager internal textures, if allocated. |
- for (int i = 0; i < kNumDefaultTextures; i++) { |
- if (default_textures_[i]) { |
- DumpTextureRef(pmd, default_textures_[i].get()); |
+ // Also dump TextureManager internal textures, if allocated. |
+ for (int i = 0; i < kNumDefaultTextures; i++) { |
+ if (default_textures_[i]) { |
+ DumpTextureRef(pmd, default_textures_[i].get()); |
+ } |
} |
} |
@@ -3148,10 +3159,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 |