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 "base/basictypes.h" |
9 | 9 |
10 namespace gpu { | 10 namespace gpu { |
(...skipping 13 matching lines...) Expand all Loading... |
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 }; | 28 }; |
29 | 29 |
30 // Limits when this renderer is visible. | 30 // Limits when this renderer is visible. |
31 uint64 bytes_limit_when_visible; | 31 uint64 bytes_limit_when_visible; |
32 PriorityCutoff priority_cutoff_when_visible; | 32 PriorityCutoff priority_cutoff_when_visible; |
33 | 33 |
34 // Limits when this renderer is not visible. | |
35 uint64 bytes_limit_when_not_visible; | |
36 PriorityCutoff priority_cutoff_when_not_visible; | |
37 bool have_backbuffer_when_not_visible; | |
38 | |
39 MemoryAllocation() | 34 MemoryAllocation() |
40 : bytes_limit_when_visible(0), | 35 : bytes_limit_when_visible(0), |
41 priority_cutoff_when_visible(CUTOFF_ALLOW_NOTHING), | 36 priority_cutoff_when_visible(CUTOFF_ALLOW_NOTHING) { |
42 bytes_limit_when_not_visible(0), | |
43 priority_cutoff_when_not_visible(CUTOFF_ALLOW_NOTHING), | |
44 have_backbuffer_when_not_visible(false) { | |
45 } | 37 } |
46 | 38 |
47 MemoryAllocation(uint64 bytes_limit_when_visible) | 39 MemoryAllocation(uint64 bytes_limit_when_visible) |
48 : bytes_limit_when_visible(bytes_limit_when_visible), | 40 : bytes_limit_when_visible(bytes_limit_when_visible), |
49 priority_cutoff_when_visible(CUTOFF_ALLOW_EVERYTHING), | 41 priority_cutoff_when_visible(CUTOFF_ALLOW_EVERYTHING) { |
50 bytes_limit_when_not_visible(0), | |
51 priority_cutoff_when_not_visible(CUTOFF_ALLOW_NOTHING), | |
52 have_backbuffer_when_not_visible(false) { | |
53 } | 42 } |
54 | 43 |
55 bool Equals(const MemoryAllocation& other) const { | 44 bool Equals(const MemoryAllocation& other) const { |
56 return bytes_limit_when_visible == | 45 return bytes_limit_when_visible == |
57 other.bytes_limit_when_visible && | 46 other.bytes_limit_when_visible && |
58 priority_cutoff_when_visible == other.priority_cutoff_when_visible && | 47 priority_cutoff_when_visible == other.priority_cutoff_when_visible; |
59 bytes_limit_when_not_visible == other.bytes_limit_when_not_visible && | |
60 priority_cutoff_when_not_visible == | |
61 other.priority_cutoff_when_not_visible && | |
62 have_backbuffer_when_not_visible == | |
63 other.have_backbuffer_when_not_visible; | |
64 } | 48 } |
65 }; | 49 }; |
66 | 50 |
67 // Memory Allocation request which is sent by a client, to help GpuMemoryManager | 51 // Memory Allocation request which is sent by a client, to help GpuMemoryManager |
68 // more ideally split memory allocations across clients. | 52 // more ideally split memory allocations across clients. |
69 struct ManagedMemoryStats { | 53 struct ManagedMemoryStats { |
70 // Bytes required for correct rendering. | 54 // Bytes required for correct rendering. |
71 uint64 bytes_required; | 55 uint64 bytes_required; |
72 | 56 |
73 // Bytes that are not strictly required for correctness, but, if allocated, | 57 // Bytes that are not strictly required for correctness, but, if allocated, |
(...skipping 28 matching lines...) Expand all Loading... |
102 return bytes_required == other.bytes_required && | 86 return bytes_required == other.bytes_required && |
103 bytes_nice_to_have == other.bytes_nice_to_have && | 87 bytes_nice_to_have == other.bytes_nice_to_have && |
104 bytes_allocated == other.bytes_allocated && | 88 bytes_allocated == other.bytes_allocated && |
105 backbuffer_requested == other.backbuffer_requested; | 89 backbuffer_requested == other.backbuffer_requested; |
106 } | 90 } |
107 }; | 91 }; |
108 | 92 |
109 } // namespace content | 93 } // namespace content |
110 | 94 |
111 #endif // GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_ALLOCATION_H_ | 95 #endif // GPU_COMMAND_BUFFER_COMMON_GPU_MEMORY_ALLOCATION_H_ |
OLD | NEW |