Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2113)

Unified Diff: content/common/gpu/gpu_memory_allocation.h

Issue 9289052: Adding GpuMemoryManager to track GpuCommandBufferStub visibility and last_used_time and dictate mem… (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..54af7ba697f65ce45a69679c48fb73de7bf9040b
--- /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:
+ uint64 gpuResourceSizeInBytes;
+ bool hasFrontbuffer;
+ bool hasBackbuffer;
+
+ GpuMemoryAllocation()
+ : gpuResourceSizeInBytes(0),
+ hasFrontbuffer(false),
+ hasBackbuffer(false) {
+ }
+
+ GpuMemoryAllocation(uint64 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);
+}
+
+// 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:
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
+};
+
+#endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_

Powered by Google App Engine
This is Rietveld 408576698