OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_COMMAND_BUFFER_COMMON_GPU_MEMORY_ALLOCATION_H_ | 5 #ifndef GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_ALLOCATION_H_ |
6 #define GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_ALLOCATION_H_ | 6 #define GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_ALLOCATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include <stdint.h> |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
11 | 11 |
12 // These are per context memory allocation limits set by the GpuMemoryManager | 12 // These are per context memory allocation limits set by the GpuMemoryManager |
13 // and assigned to the browser and renderer context. | 13 // and assigned to the browser and renderer context. |
14 // They will change over time, given memory availability, and browser state. | 14 // They will change over time, given memory availability, and browser state. |
15 struct MemoryAllocation { | 15 struct MemoryAllocation { |
16 enum PriorityCutoff { | 16 enum PriorityCutoff { |
17 // Allow no allocations. | 17 // Allow no allocations. |
18 CUTOFF_ALLOW_NOTHING, | 18 CUTOFF_ALLOW_NOTHING, |
19 // Allow only allocations that are strictly required for correct rendering. | 19 // Allow only allocations that are strictly required for correct rendering. |
20 // For compositors, this is what is visible. | 20 // For compositors, this is what is visible. |
21 CUTOFF_ALLOW_REQUIRED_ONLY, | 21 CUTOFF_ALLOW_REQUIRED_ONLY, |
22 // Allow allocations that are not strictly needed for correct rendering, but | 22 // Allow allocations that are not strictly needed for correct rendering, but |
23 // are nice to have for performance. For compositors, this includes textures | 23 // are nice to have for performance. For compositors, this includes textures |
24 // that are a few screens away from being visible. | 24 // that are a few screens away from being visible. |
25 CUTOFF_ALLOW_NICE_TO_HAVE, | 25 CUTOFF_ALLOW_NICE_TO_HAVE, |
26 // Allow all allocations. | 26 // Allow all allocations. |
27 CUTOFF_ALLOW_EVERYTHING, | 27 CUTOFF_ALLOW_EVERYTHING, |
28 CUTOFF_LAST = CUTOFF_ALLOW_EVERYTHING | 28 CUTOFF_LAST = CUTOFF_ALLOW_EVERYTHING |
29 }; | 29 }; |
30 | 30 |
31 // Limits when this renderer is visible. | 31 // Limits when this renderer is visible. |
32 uint64 bytes_limit_when_visible; | 32 uint64_t bytes_limit_when_visible; |
33 PriorityCutoff priority_cutoff_when_visible; | 33 PriorityCutoff priority_cutoff_when_visible; |
34 | 34 |
35 MemoryAllocation() | 35 MemoryAllocation() |
36 : bytes_limit_when_visible(0), | 36 : bytes_limit_when_visible(0), |
37 priority_cutoff_when_visible(CUTOFF_ALLOW_NOTHING) { | 37 priority_cutoff_when_visible(CUTOFF_ALLOW_NOTHING) { |
38 } | 38 } |
39 | 39 |
40 MemoryAllocation(uint64 bytes_limit_when_visible) | 40 MemoryAllocation(uint64_t bytes_limit_when_visible) |
41 : bytes_limit_when_visible(bytes_limit_when_visible), | 41 : bytes_limit_when_visible(bytes_limit_when_visible), |
42 priority_cutoff_when_visible(CUTOFF_ALLOW_EVERYTHING) { | 42 priority_cutoff_when_visible(CUTOFF_ALLOW_EVERYTHING) {} |
43 } | |
44 | 43 |
45 bool Equals(const MemoryAllocation& other) const { | 44 bool Equals(const MemoryAllocation& other) const { |
46 return bytes_limit_when_visible == | 45 return bytes_limit_when_visible == |
47 other.bytes_limit_when_visible && | 46 other.bytes_limit_when_visible && |
48 priority_cutoff_when_visible == other.priority_cutoff_when_visible; | 47 priority_cutoff_when_visible == other.priority_cutoff_when_visible; |
49 } | 48 } |
50 }; | 49 }; |
51 | 50 |
52 } // namespace content | 51 } // namespace content |
53 | 52 |
54 #endif // GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_ALLOCATION_H_ | 53 #endif // GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_ALLOCATION_H_ |
OLD | NEW |