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

Side by Side Diff: content/common/gpu/gpu_memory_manager.cc

Issue 1726343003: Revert of Mustash: move content::GPUVideoMemoryUsageStats to gpu::VideoMemoryUsageStats (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « content/common/gpu/gpu_memory_manager.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/gpu/gpu_memory_manager.h" 5 #include "content/common/gpu/gpu_memory_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/process/process_handle.h" 12 #include "base/process/process_handle.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "content/common/gpu/gpu_channel_manager.h" 15 #include "content/common/gpu/gpu_channel_manager.h"
16 #include "content/common/gpu/gpu_memory_tracking.h" 16 #include "content/common/gpu/gpu_memory_tracking.h"
17 #include "content/common/gpu/gpu_memory_uma_stats.h" 17 #include "content/common/gpu/gpu_memory_uma_stats.h"
18 #include "content/common/gpu/gpu_messages.h" 18 #include "content/common/gpu/gpu_messages.h"
19 #include "gpu/command_buffer/common/gpu_memory_allocation.h" 19 #include "gpu/command_buffer/common/gpu_memory_allocation.h"
20 #include "gpu/command_buffer/service/gpu_switches.h" 20 #include "gpu/command_buffer/service/gpu_switches.h"
21 #include "gpu/ipc/common/memory_stats.h"
22 21
23 using gpu::MemoryAllocation; 22 using gpu::MemoryAllocation;
24 23
25 namespace content { 24 namespace content {
26 namespace { 25 namespace {
27 26
28 const uint64_t kBytesAllocatedStep = 16 * 1024 * 1024; 27 const uint64_t kBytesAllocatedStep = 16 * 1024 * 1024;
29 28
30 void TrackValueChanged(uint64_t old_size, 29 void TrackValueChanged(uint64_t old_size,
31 uint64_t new_size, 30 uint64_t new_size,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 return tracking_group; 84 return tracking_group;
86 } 85 }
87 86
88 void GpuMemoryManager::OnDestroyTrackingGroup( 87 void GpuMemoryManager::OnDestroyTrackingGroup(
89 GpuMemoryTrackingGroup* tracking_group) { 88 GpuMemoryTrackingGroup* tracking_group) {
90 DCHECK(tracking_groups_.count(tracking_group->GetMemoryTracker())); 89 DCHECK(tracking_groups_.count(tracking_group->GetMemoryTracker()));
91 tracking_groups_.erase(tracking_group->GetMemoryTracker()); 90 tracking_groups_.erase(tracking_group->GetMemoryTracker());
92 } 91 }
93 92
94 void GpuMemoryManager::GetVideoMemoryUsageStats( 93 void GpuMemoryManager::GetVideoMemoryUsageStats(
95 gpu::VideoMemoryUsageStats* video_memory_usage_stats) const { 94 GPUVideoMemoryUsageStats* video_memory_usage_stats) const {
96 // For each context group, assign its memory usage to its PID 95 // For each context group, assign its memory usage to its PID
97 video_memory_usage_stats->process_map.clear(); 96 video_memory_usage_stats->process_map.clear();
98 for (TrackingGroupMap::const_iterator i = 97 for (TrackingGroupMap::const_iterator i =
99 tracking_groups_.begin(); i != tracking_groups_.end(); ++i) { 98 tracking_groups_.begin(); i != tracking_groups_.end(); ++i) {
100 const GpuMemoryTrackingGroup* tracking_group = i->second; 99 const GpuMemoryTrackingGroup* tracking_group = i->second;
101 video_memory_usage_stats->process_map[ 100 video_memory_usage_stats->process_map[
102 tracking_group->GetPid()].video_memory += tracking_group->GetSize(); 101 tracking_group->GetPid()].video_memory += tracking_group->GetSize();
103 } 102 }
104 103
105 // Assign the total across all processes in the GPU process 104 // Assign the total across all processes in the GPU process
(...skipping 10 matching lines...) Expand all
116 void GpuMemoryManager::SendUmaStatsToBrowser() { 115 void GpuMemoryManager::SendUmaStatsToBrowser() {
117 if (!channel_manager_) 116 if (!channel_manager_)
118 return; 117 return;
119 GPUMemoryUmaStats params; 118 GPUMemoryUmaStats params;
120 params.bytes_allocated_current = GetCurrentUsage(); 119 params.bytes_allocated_current = GetCurrentUsage();
121 params.bytes_allocated_max = bytes_allocated_historical_max_; 120 params.bytes_allocated_max = bytes_allocated_historical_max_;
122 params.context_group_count = static_cast<uint32_t>(tracking_groups_.size()); 121 params.context_group_count = static_cast<uint32_t>(tracking_groups_.size());
123 channel_manager_->Send(new GpuHostMsg_GpuMemoryUmaStats(params)); 122 channel_manager_->Send(new GpuHostMsg_GpuMemoryUmaStats(params));
124 } 123 }
125 } // namespace content 124 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_manager.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698