OLD | NEW |
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 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <list> | 10 #include <list> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 private: | 46 private: |
47 friend class GpuMemoryManagerTest; | 47 friend class GpuMemoryManagerTest; |
48 friend class GpuMemoryTrackingGroup; | 48 friend class GpuMemoryTrackingGroup; |
49 friend class GpuMemoryManagerClientState; | 49 friend class GpuMemoryManagerClientState; |
50 | 50 |
51 typedef std::map<gpu::gles2::MemoryTracker*, GpuMemoryTrackingGroup*> | 51 typedef std::map<gpu::gles2::MemoryTracker*, GpuMemoryTrackingGroup*> |
52 TrackingGroupMap; | 52 TrackingGroupMap; |
53 | 53 |
54 // Send memory usage stats to the browser process. | 54 // Send memory usage stats to the browser process. |
55 void SendUmaStatsToBrowser(); | 55 void SendUmaStatsToHost(); |
56 | 56 |
57 // Get the current number of bytes allocated. | 57 // Get the current number of bytes allocated. |
58 uint64_t GetCurrentUsage() const { return bytes_allocated_current_; } | 58 uint64_t GetCurrentUsage() const { return bytes_allocated_current_; } |
59 | 59 |
60 // GpuMemoryTrackingGroup interface | 60 // GpuMemoryTrackingGroup interface |
61 void TrackMemoryAllocatedChange(GpuMemoryTrackingGroup* tracking_group, | 61 void TrackMemoryAllocatedChange(GpuMemoryTrackingGroup* tracking_group, |
62 uint64_t old_size, | 62 uint64_t old_size, |
63 uint64_t new_size); | 63 uint64_t new_size); |
64 void OnDestroyTrackingGroup(GpuMemoryTrackingGroup* tracking_group); | 64 void OnDestroyTrackingGroup(GpuMemoryTrackingGroup* tracking_group); |
65 bool EnsureGPUMemoryAvailable(uint64_t size_needed); | 65 bool EnsureGPUMemoryAvailable(uint64_t size_needed); |
66 | 66 |
67 GpuChannelManager* channel_manager_; | 67 GpuChannelManager* channel_manager_; |
68 | 68 |
69 // All context groups' tracking structures | 69 // All context groups' tracking structures |
70 TrackingGroupMap tracking_groups_; | 70 TrackingGroupMap tracking_groups_; |
71 | 71 |
72 // The current total memory usage, and historical maximum memory usage | 72 // The current total memory usage, and historical maximum memory usage |
73 uint64_t bytes_allocated_current_; | 73 uint64_t bytes_allocated_current_; |
74 uint64_t bytes_allocated_historical_max_; | 74 uint64_t bytes_allocated_historical_max_; |
75 | 75 |
76 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | 76 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
77 }; | 77 }; |
78 | 78 |
79 } // namespace content | 79 } // namespace content |
80 | 80 |
81 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 81 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
OLD | NEW |