| 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_TRACKING_H_ | 5 #ifndef GPU_IPC_SERVICE_GPU_MEMORY_TRACKING_H_ |
| 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_ | 6 #define GPU_IPC_SERVICE_GPU_MEMORY_TRACKING_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/process/process.h" | 10 #include "base/process/process.h" |
| 11 #include "content/common/content_export.h" | |
| 12 #include "gpu/command_buffer/service/memory_tracking.h" | 11 #include "gpu/command_buffer/service/memory_tracking.h" |
| 12 #include "gpu/gpu_export.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace gpu { |
| 15 | 15 |
| 16 class GpuMemoryManager; | 16 class GpuMemoryManager; |
| 17 | 17 |
| 18 // All decoders in a context group point to a single GpuMemoryTrackingGroup, | 18 // All decoders in a context group point to a single GpuMemoryTrackingGroup, |
| 19 // which tracks GPU resource consumption for the entire context group. | 19 // which tracks GPU resource consumption for the entire context group. |
| 20 class CONTENT_EXPORT GpuMemoryTrackingGroup { | 20 class GPU_EXPORT GpuMemoryTrackingGroup { |
| 21 public: | 21 public: |
| 22 ~GpuMemoryTrackingGroup(); | 22 ~GpuMemoryTrackingGroup(); |
| 23 void TrackMemoryAllocatedChange(uint64_t old_size, uint64_t new_size); | 23 void TrackMemoryAllocatedChange(uint64_t old_size, uint64_t new_size); |
| 24 bool EnsureGPUMemoryAvailable(uint64_t size_needed); | 24 bool EnsureGPUMemoryAvailable(uint64_t size_needed); |
| 25 base::ProcessId GetPid() const { | 25 base::ProcessId GetPid() const { |
| 26 return pid_; | 26 return pid_; |
| 27 } | 27 } |
| 28 uint64_t GetSize() const { return size_; } | 28 uint64_t GetSize() const { return size_; } |
| 29 gpu::gles2::MemoryTracker* GetMemoryTracker() const { | 29 gles2::MemoryTracker* GetMemoryTracker() const { |
| 30 return memory_tracker_; | 30 return memory_tracker_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 friend class GpuMemoryManager; | 34 friend class GpuMemoryManager; |
| 35 | 35 |
| 36 GpuMemoryTrackingGroup(base::ProcessId pid, | 36 GpuMemoryTrackingGroup(base::ProcessId pid, |
| 37 gpu::gles2::MemoryTracker* memory_tracker, | 37 gles2::MemoryTracker* memory_tracker, |
| 38 GpuMemoryManager* memory_manager); | 38 GpuMemoryManager* memory_manager); |
| 39 | 39 |
| 40 base::ProcessId pid_; | 40 base::ProcessId pid_; |
| 41 uint64_t size_; | 41 uint64_t size_; |
| 42 | 42 |
| 43 // Set and used only during the Manage function, to determine which | 43 // Set and used only during the Manage function, to determine which |
| 44 // non-surface clients should be hibernated. | 44 // non-surface clients should be hibernated. |
| 45 bool hibernated_; | 45 bool hibernated_; |
| 46 | 46 |
| 47 gpu::gles2::MemoryTracker* memory_tracker_; | 47 gles2::MemoryTracker* memory_tracker_; |
| 48 GpuMemoryManager* memory_manager_; | 48 GpuMemoryManager* memory_manager_; |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 } // namespace content | 51 } // namespace gpu |
| 52 | 52 |
| 53 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_ | 53 #endif // GPU_IPC_SERVICE_GPU_MEMORY_TRACKING_H_ |
| OLD | NEW |