Index: content/common/gpu/gpu_channel.cc |
diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc |
index 3cd18db4c4f07816743f78481c09bb353d95e1f4..277bcddef5d59aee7cb92815538d3bf41db5c005 100644 |
--- a/content/common/gpu/gpu_channel.cc |
+++ b/content/common/gpu/gpu_channel.cc |
@@ -833,11 +833,20 @@ void GpuChannel::RemoveFilter(IPC::MessageFilter* filter) { |
} |
uint64 GpuChannel::GetMemoryUsage() { |
- uint64 size = 0; |
+ // Collect the unique memory trackers in use by the |stubs_|. |
+ std::set<gpu::gles2::MemoryTracker*> unique_memory_trackers; |
for (StubMap::Iterator<GpuCommandBufferStub> it(&stubs_); |
!it.IsAtEnd(); it.Advance()) { |
- size += it.GetCurrentValue()->GetMemoryUsage(); |
+ unique_memory_trackers.insert(it.GetCurrentValue()->GetMemoryTracker()); |
} |
+ |
+ // Sum the memory usage for all unique memory trackers. |
+ uint64 size = 0; |
+ for (auto* tracker : unique_memory_trackers) { |
+ size += gpu_channel_manager()->gpu_memory_manager()->GetTrackerMemoryUsage( |
+ tracker); |
+ } |
+ |
return size; |
} |