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