| 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> |
| 11 #include <map> | 11 #include <map> |
| 12 | 12 |
| 13 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/public/common/gpu_memory_stats.h" |
| 19 #include "gpu/command_buffer/common/gpu_memory_allocation.h" | 20 #include "gpu/command_buffer/common/gpu_memory_allocation.h" |
| 20 #include "gpu/command_buffer/service/memory_tracking.h" | 21 #include "gpu/command_buffer/service/memory_tracking.h" |
| 21 | 22 |
| 22 namespace gpu { | |
| 23 struct VideoMemoryUsageStats; | |
| 24 } | |
| 25 | |
| 26 namespace content { | 23 namespace content { |
| 27 | 24 |
| 28 class GpuChannelManager; | 25 class GpuChannelManager; |
| 29 class GpuMemoryTrackingGroup; | 26 class GpuMemoryTrackingGroup; |
| 30 | 27 |
| 31 class CONTENT_EXPORT GpuMemoryManager : | 28 class CONTENT_EXPORT GpuMemoryManager : |
| 32 public base::SupportsWeakPtr<GpuMemoryManager> { | 29 public base::SupportsWeakPtr<GpuMemoryManager> { |
| 33 public: | 30 public: |
| 34 explicit GpuMemoryManager(GpuChannelManager* channel_manager); | 31 explicit GpuMemoryManager(GpuChannelManager* channel_manager); |
| 35 ~GpuMemoryManager(); | 32 ~GpuMemoryManager(); |
| 36 | 33 |
| 37 // Retrieve GPU Resource consumption statistics for the task manager | 34 // Retrieve GPU Resource consumption statistics for the task manager |
| 38 void GetVideoMemoryUsageStats( | 35 void GetVideoMemoryUsageStats( |
| 39 gpu::VideoMemoryUsageStats* video_memory_usage_stats) const; | 36 content::GPUVideoMemoryUsageStats* video_memory_usage_stats) const; |
| 40 | 37 |
| 41 GpuMemoryTrackingGroup* CreateTrackingGroup( | 38 GpuMemoryTrackingGroup* CreateTrackingGroup( |
| 42 base::ProcessId pid, gpu::gles2::MemoryTracker* memory_tracker); | 39 base::ProcessId pid, gpu::gles2::MemoryTracker* memory_tracker); |
| 43 | 40 |
| 44 uint64_t GetTrackerMemoryUsage(gpu::gles2::MemoryTracker* tracker) const; | 41 uint64_t GetTrackerMemoryUsage(gpu::gles2::MemoryTracker* tracker) const; |
| 45 | 42 |
| 46 private: | 43 private: |
| 47 friend class GpuMemoryManagerTest; | 44 friend class GpuMemoryManagerTest; |
| 48 friend class GpuMemoryTrackingGroup; | 45 friend class GpuMemoryTrackingGroup; |
| 49 friend class GpuMemoryManagerClientState; | 46 friend class GpuMemoryManagerClientState; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 72 // The current total memory usage, and historical maximum memory usage | 69 // The current total memory usage, and historical maximum memory usage |
| 73 uint64_t bytes_allocated_current_; | 70 uint64_t bytes_allocated_current_; |
| 74 uint64_t bytes_allocated_historical_max_; | 71 uint64_t bytes_allocated_historical_max_; |
| 75 | 72 |
| 76 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); | 73 DISALLOW_COPY_AND_ASSIGN(GpuMemoryManager); |
| 77 }; | 74 }; |
| 78 | 75 |
| 79 } // namespace content | 76 } // namespace content |
| 80 | 77 |
| 81 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ | 78 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_MANAGER_H_ |
| OLD | NEW |