OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/gpu/gpu_memory_manager.h" | 5 #include "content/common/gpu/gpu_memory_manager.h" |
6 | 6 |
7 #if defined(ENABLE_GPU) | 7 #if defined(ENABLE_GPU) |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 ++it) { | 476 ++it) { |
477 ClientState* client_state = *it; | 477 ClientState* client_state = *it; |
478 GpuMemoryAllocation allocation; | 478 GpuMemoryAllocation allocation; |
479 if (client_state->has_surface) { | 479 if (client_state->has_surface) { |
480 allocation.browser_allocation.suggest_have_frontbuffer = | 480 allocation.browser_allocation.suggest_have_frontbuffer = |
481 !client_state->hibernated; | 481 !client_state->hibernated; |
482 | 482 |
483 // Set the state when visible. | 483 // Set the state when visible. |
484 allocation.renderer_allocation.bytes_limit_when_visible = | 484 allocation.renderer_allocation.bytes_limit_when_visible = |
485 bytes_limit_when_visible; | 485 bytes_limit_when_visible; |
| 486 // Experiment to determine if aggressively discarding tiles on OS X |
| 487 // results in greater stability. |
| 488 #if defined(OS_MACOSX) |
| 489 allocation.renderer_allocation.priority_cutoff_when_visible = |
| 490 GpuMemoryAllocationForRenderer::kPriorityCutoffAllowNiceToHave; |
| 491 #else |
486 allocation.renderer_allocation.priority_cutoff_when_visible = | 492 allocation.renderer_allocation.priority_cutoff_when_visible = |
487 GpuMemoryAllocationForRenderer::kPriorityCutoffAllowEverything; | 493 GpuMemoryAllocationForRenderer::kPriorityCutoffAllowEverything; |
| 494 #endif |
488 | 495 |
489 // Set the state when backgrounded. | 496 // Set the state when backgrounded. |
490 bool allow_allocation_when_backgrounded = false; | 497 bool allow_allocation_when_backgrounded = false; |
491 if (client_state->visible) { | 498 if (client_state->visible) { |
492 // If the client is visible, then allow it to keep its textures, should | 499 // If the client is visible, then allow it to keep its textures, should |
493 // it be backgrounded, but only if all textures required to draw will | 500 // it be backgrounded, but only if all textures required to draw will |
494 // fit in total backgrounded memory limit. | 501 // fit in total backgrounded memory limit. |
495 allow_allocation_when_backgrounded = | 502 allow_allocation_when_backgrounded = |
496 client_state->managed_memory_stats.bytes_required < | 503 client_state->managed_memory_stats.bytes_required < |
497 bytes_backgrounded_available_gpu_memory_; | 504 bytes_backgrounded_available_gpu_memory_; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 : client(client), | 636 : client(client), |
630 has_surface(has_surface), | 637 has_surface(has_surface), |
631 visible(visible), | 638 visible(visible), |
632 last_used_time(last_used_time), | 639 last_used_time(last_used_time), |
633 hibernated(false) { | 640 hibernated(false) { |
634 } | 641 } |
635 | 642 |
636 } // namespace content | 643 } // namespace content |
637 | 644 |
638 #endif | 645 #endif |
OLD | NEW |