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