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 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 3 * client_state->managed_memory_stats_.bytes_nice_to_have / 4; | 758 3 * client_state->managed_memory_stats_.bytes_nice_to_have / 4; |
759 | 759 |
760 // Populate and send the allocation to the client | 760 // Populate and send the allocation to the client |
761 GpuMemoryAllocation allocation; | 761 GpuMemoryAllocation allocation; |
762 | 762 |
763 allocation.browser_allocation.suggest_have_frontbuffer = | 763 allocation.browser_allocation.suggest_have_frontbuffer = |
764 !client_state->hibernated_; | 764 !client_state->hibernated_; |
765 | 765 |
766 allocation.renderer_allocation.bytes_limit_when_visible = | 766 allocation.renderer_allocation.bytes_limit_when_visible = |
767 client_state->bytes_allocation_when_visible_; | 767 client_state->bytes_allocation_when_visible_; |
| 768 // Use a more conservative memory allocation policy on Mac because the |
| 769 // platform is unstable when under memory pressure. |
| 770 // http://crbug.com/141377 |
768 allocation.renderer_allocation.priority_cutoff_when_visible = | 771 allocation.renderer_allocation.priority_cutoff_when_visible = |
769 #if defined(OS_MACOSX) | 772 #if defined(OS_MACOSX) |
770 GpuMemoryAllocationForRenderer::kPriorityCutoffAllowNiceToHave; | 773 GpuMemoryAllocationForRenderer::kPriorityCutoffAllowNiceToHave; |
771 #else | 774 #else |
772 GpuMemoryAllocationForRenderer::kPriorityCutoffAllowEverything; | 775 GpuMemoryAllocationForRenderer::kPriorityCutoffAllowEverything; |
773 #endif | 776 #endif |
774 | 777 |
775 allocation.renderer_allocation.bytes_limit_when_not_visible = | 778 allocation.renderer_allocation.bytes_limit_when_not_visible = |
776 client_state->bytes_allocation_when_nonvisible_; | 779 client_state->bytes_allocation_when_nonvisible_; |
777 allocation.renderer_allocation.priority_cutoff_when_not_visible = | 780 allocation.renderer_allocation.priority_cutoff_when_not_visible = |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
877 | 880 |
878 void GpuMemoryManager::RemoveClientFromList( | 881 void GpuMemoryManager::RemoveClientFromList( |
879 GpuMemoryManagerClientState* client_state) { | 882 GpuMemoryManagerClientState* client_state) { |
880 DCHECK(client_state->list_iterator_valid_); | 883 DCHECK(client_state->list_iterator_valid_); |
881 ClientStateList* client_list = GetClientList(client_state); | 884 ClientStateList* client_list = GetClientList(client_state); |
882 client_list->erase(client_state->list_iterator_); | 885 client_list->erase(client_state->list_iterator_); |
883 client_state->list_iterator_valid_ = false; | 886 client_state->list_iterator_valid_ = false; |
884 } | 887 } |
885 | 888 |
886 } // namespace content | 889 } // namespace content |
OLD | NEW |