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..c11fdd3ab4b6727305bc0bce829523309359cfc6 |
--- /dev/null |
+++ b/content/common/gpu/gpu_memory_allocation.h |
@@ -0,0 +1,46 @@ |
+// 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, browser state, and |
+// GpuIdealMemoryAllocation values (see below). |
nduca
2012/01/31 06:53:47
I think the ", and ... values " doesn't really add
mmocny
2012/01/31 18:54:57
Done.
|
+// Exceeding these limits for an unreasonable amount of time will cause kill. |
nduca
2012/01/31 06:53:47
will cause the context to be lost.
mmocny
2012/01/31 18:54:57
Done.
|
+struct GpuMemoryAllocation { |
+ static const int kResourceSizeForegroundTab = 100 * 1024 * 1024; |
nduca
2012/01/31 06:53:47
Confused why this is in the header. I would have e
mmocny
2012/01/31 18:54:57
Done.
|
+ static const int kResourceSizeBackgroundTab = 50 * 1024 * 1024; |
+ static const int kResourceSizeHibernatedTab = 0; |
+ |
+ 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) { |
+ } |
+}; |
+ |
+// Contexts should give ideal memory allocation hints to the GpuMemoryManager |
nduca
2012/01/31 06:53:47
Do we like "ideal" or do we want to try on "goal"
mmocny
2012/01/31 18:54:57
I find goal confusing, since I think of the goal t
|
+// so that it can make better decisions on how to split resources. |
+// If memory is constrained and/or this context has lower priority than others, |
nduca
2012/01/31 06:53:47
this context -> a context.
mmocny
2012/01/31 18:54:57
Done.
|
+// these requests will be overruled (see actual allocation limits above). |
nduca
2012/01/31 06:53:47
these requests will be overruled -> the allocated
mmocny
2012/01/31 18:54:57
Done.
|
+struct GpuIdealMemoryAllocation { |
+}; |
+ |
+#endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ |