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 CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_ | |
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include "base/process/process.h" | |
11 #include "content/common/content_export.h" | |
12 #include "gpu/command_buffer/service/memory_tracking.h" | |
13 | |
14 namespace content { | |
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 CONTENT_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 gpu::gles2::MemoryTracker* GetMemoryTracker() const { | |
30 return memory_tracker_; | |
31 } | |
32 | |
33 private: | |
34 friend class GpuMemoryManager; | |
35 | |
36 GpuMemoryTrackingGroup(base::ProcessId pid, | |
37 gpu::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 gpu::gles2::MemoryTracker* memory_tracker_; | |
48 GpuMemoryManager* memory_manager_; | |
49 }; | |
50 | |
51 } // namespace content | |
52 | |
53 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_TRACKING_H_ | |
OLD | NEW |