Chromium Code Reviews| 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_ALLOCATION_H_ | |
| 6 #define CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/basictypes.h" | |
| 10 | |
| 11 // These are memory allocation limits assigned to a context. | |
| 12 // They will change over time, given memory availability, and browser state | |
| 13 // Exceeding these limits for an unreasonable amount of time will cause context | |
| 14 // to be lost. | |
| 15 class GpuMemoryAllocation { | |
| 16 public: | |
| 17 uint64 gpuResourceSizeInBytes; | |
| 18 bool hasFrontbuffer; | |
| 19 bool hasBackbuffer; | |
| 20 | |
| 21 GpuMemoryAllocation() | |
| 22 : gpuResourceSizeInBytes(0), | |
| 23 hasFrontbuffer(false), | |
| 24 hasBackbuffer(false) { | |
| 25 } | |
| 26 | |
| 27 GpuMemoryAllocation(uint64 gpuResourceSizeInBytes, | |
| 28 bool hasFrontbuffer, | |
| 29 bool hasBackbuffer) | |
| 30 : gpuResourceSizeInBytes(gpuResourceSizeInBytes), | |
| 31 hasFrontbuffer(hasFrontbuffer), | |
| 32 hasBackbuffer(hasBackbuffer) { | |
| 33 } | |
| 34 }; | |
| 35 | |
| 36 inline bool operator==(const GpuMemoryAllocation& lhs, | |
| 37 const GpuMemoryAllocation& rhs) { | |
| 38 return lhs.gpuResourceSizeInBytes == rhs.gpuResourceSizeInBytes && | |
| 39 lhs.hasFrontbuffer == rhs.hasFrontbuffer && | |
| 40 lhs.hasBackbuffer == rhs.hasBackbuffer; | |
| 41 } | |
| 42 | |
| 43 inline bool operator!=(const GpuMemoryAllocation& lhs, | |
| 44 const GpuMemoryAllocation& rhs) { | |
| 45 return !(lhs == rhs); | |
| 46 } | |
| 47 | |
| 48 // Contexts should give ideal memory allocation hints to the GpuMemoryManager | |
| 49 // so that it can make better decisions on how to split resources. | |
| 50 // If memory is constrained and/or a context has lower priority than others, | |
| 51 // the allocated values may be lower than the requested amounts (see above). | |
| 52 class GpuIdealMemoryAllocation { | |
| 53 public: | |
|
jonathan.backer
2012/02/01 19:43:17
empty?
mmocny
2012/02/01 20:44:19
This is not used, and can be removed until a subse
| |
| 54 }; | |
| 55 | |
| 56 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ | |
| OLD | NEW |