summaryrefslogtreecommitdiff
path: root/content/common/gpu/gpu_memory_manager.cc
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@google.com>2013-08-23 16:39:15 +0100
committerTorne (Richard Coles) <torne@google.com>2013-08-23 16:39:15 +0100
commit3551c9c881056c480085172ff9840cab31610854 (patch)
tree23660320f5f4c279966609cf9da7491b96d10ca8 /content/common/gpu/gpu_memory_manager.cc
parent4e9d9adbbb6cf287125ca44a0823791a570472f5 (diff)
downloadchromium_org-3551c9c881056c480085172ff9840cab31610854.tar.gz
Merge from Chromium at DEPS revision r219274
This commit was generated by merge_to_master.py. Change-Id: Ibb7f41396cadf4071e89153e1913c986d126f65d
Diffstat (limited to 'content/common/gpu/gpu_memory_manager.cc')
-rw-r--r--content/common/gpu/gpu_memory_manager.cc25
1 files changed, 14 insertions, 11 deletions
diff --git a/content/common/gpu/gpu_memory_manager.cc b/content/common/gpu/gpu_memory_manager.cc
index 21d51630c3..88d7861e7d 100644
--- a/content/common/gpu/gpu_memory_manager.cc
+++ b/content/common/gpu/gpu_memory_manager.cc
@@ -79,8 +79,12 @@ GpuMemoryManager::GpuMemoryManager(
#endif
// On Android, always discard everything that is nonvisible.
- // On Mac, use as little memory as possible to avoid stability issues.
-#if defined(OS_ANDROID) || defined(OS_MACOSX)
+ // On Linux and Mac, use as little memory as possible to avoid stability
+ // issues.
+ // http://crbug.com/145600 (Linux)
+ // http://crbug.com/141377 (Mac)
+#if defined(OS_ANDROID) || defined(OS_MACOSX) || \
+ (defined(OS_LINUX) && !defined(OS_CHROMEOS))
allow_nonvisible_memory_ = false;
#else
allow_nonvisible_memory_ = true;
@@ -496,10 +500,12 @@ uint64 GpuMemoryManager::ComputeClientAllocationWhenVisible(
uint64 GpuMemoryManager::ComputeClientAllocationWhenNonvisible(
GpuMemoryManagerClientState* client_state) {
-
if (!client_state->managed_memory_stats_received_)
return 0;
+ if (!allow_nonvisible_memory_)
+ return 0;
+
return 9 * client_state->managed_memory_stats_.bytes_required / 8;
}
@@ -644,10 +650,6 @@ void GpuMemoryManager::ComputeNonvisibleSurfacesAllocations() {
bytes_available_total - bytes_allocated_visible);
}
- // Clamp the amount of memory available to non-visible clients.
- if (!allow_nonvisible_memory_)
- bytes_available_nonvisible = 0;
-
// Determine which now-visible clients should keep their contents when
// they are made nonvisible.
for (ClientStateList::const_iterator it = clients_visible_mru_.begin();
@@ -774,11 +776,12 @@ void GpuMemoryManager::AssignSurfacesAllocations() {
allocation.renderer_allocation.bytes_limit_when_visible =
client_state->bytes_allocation_when_visible_;
- // Use a more conservative memory allocation policy on Mac because the
- // platform is unstable when under memory pressure.
- // http://crbug.com/141377
+ // Use a more conservative memory allocation policy on Linux and Mac
+ // because the platform is unstable when under memory pressure.
+ // http://crbug.com/145600 (Linux)
+ // http://crbug.com/141377 (Mac)
allocation.renderer_allocation.priority_cutoff_when_visible =
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS))
GpuMemoryAllocationForRenderer::kPriorityCutoffAllowNiceToHave;
#else
GpuMemoryAllocationForRenderer::kPriorityCutoffAllowEverything;