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