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, browser state, and |
| 13 // GpuIdealMemoryAllocation values (see below). |
| 14 // Exceeding these limits for an unreasonable amount of time will cause kill. |
| 15 struct GpuMemoryAllocation { |
| 16 static const int kResourceSizeForegroundTab = 100 * 1024 * 1024; |
| 17 static const int kResourceSizeBackgroundTab = 50 * 1024 * 1024; |
| 18 static const int kResourceSizeHibernatedTab = 0; |
| 19 |
| 20 int gpuResourceSizeInBytes; |
| 21 bool hasFrontbuffer; |
| 22 bool hasBackbuffer; |
| 23 |
| 24 GpuMemoryAllocation() |
| 25 : gpuResourceSizeInBytes(0) |
| 26 , hasFrontbuffer(false) |
| 27 , hasBackbuffer(false) { |
| 28 } |
| 29 |
| 30 GpuMemoryAllocation(int gpuResourceSizeInBytes, |
| 31 bool hasFrontbuffer, |
| 32 bool hasBackbuffer) |
| 33 : gpuResourceSizeInBytes(gpuResourceSizeInBytes) |
| 34 , hasFrontbuffer(hasFrontbuffer) |
| 35 , hasBackbuffer(hasBackbuffer) { |
| 36 } |
| 37 }; |
| 38 |
| 39 // Contexts should give ideal memory allocation hints to the GpuMemoryManager |
| 40 // so that it can make better decisions on how to split resources. |
| 41 // If memory is constrained and/or this context has lower priority than others, |
| 42 // these requests will be overruled (see actual allocation limits above). |
| 43 struct GpuIdealMemoryAllocation { |
| 44 }; |
| 45 |
| 46 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_ALLOCATION_H_ |
OLD | NEW |