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

Unified Diff: content/common/gpu/gpu_channel.cc

Issue 1244843004: Avoid double-counting in GpuChannel memory tracking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 | « no previous file | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | content/common/gpu/gpu_command_buffer_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698