Index: content/common/gpu/gpu_memory_allocation.h |
diff --git a/content/common/gpu/gpu_memory_allocation.h b/content/common/gpu/gpu_memory_allocation.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a3403b4a1fc7d15c919c4e22631873638497fd6e |
--- /dev/null |
+++ b/content/common/gpu/gpu_memory_allocation.h |
@@ -0,0 +1,56 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ |
+#define CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ |
+#pragma once |
+ |
+#include "base/basictypes.h" |
+ |
+// These are memory allocation limits assigned to a context. |
+// They will change over time, given memory availability, and browser state |
+// Exceeding these limits for an unreasonable amount of time will cause context |
+// to be lost. |
+class GpuMemoryAllocation { |
+ public: |
+ int gpuResourceSizeInBytes; |
+ bool hasFrontbuffer; |
+ bool hasBackbuffer; |
+ |
+ GpuMemoryAllocation() |
+ : gpuResourceSizeInBytes(0), |
+ hasFrontbuffer(false), |
+ hasBackbuffer(false) { |
+ } |
+ |
+ GpuMemoryAllocation(int gpuResourceSizeInBytes, |
+ bool hasFrontbuffer, |
+ bool hasBackbuffer) |
+ : gpuResourceSizeInBytes(gpuResourceSizeInBytes), |
+ hasFrontbuffer(hasFrontbuffer), |
+ hasBackbuffer(hasBackbuffer) { |
+ } |
+}; |
+ |
+inline bool operator==(const GpuMemoryAllocation& lhs, |
+ const GpuMemoryAllocation& rhs) { |
+ return lhs.gpuResourceSizeInBytes == rhs.gpuResourceSizeInBytes && |
+ lhs.hasFrontbuffer == rhs.hasFrontbuffer && |
+ lhs.hasBackbuffer == rhs.hasBackbuffer; |
+} |
+ |
+inline bool operator!=(const GpuMemoryAllocation& lhs, |
+ const GpuMemoryAllocation& rhs) { |
+ return !(lhs == rhs); |
+} |
nduca
2012/02/01 00:01:17
What's the oeprator overloading being used for? Se
mmocny
2012/02/01 15:29:42
For now, during testing.
I could have defined the
|
+ |
+// Contexts should give ideal memory allocation hints to the GpuMemoryManager |
+// so that it can make better decisions on how to split resources. |
+// If memory is constrained and/or a context has lower priority than others, |
+// the allocated values may be lower than the requested amounts (see above). |
+class GpuIdealMemoryAllocation { |
+ public: |
+}; |
+ |
+#endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ |