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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // 3. Contexts belong to share groups within which resources can be shared. | 97 // 3. Contexts belong to share groups within which resources can be shared. |
98 // | 98 // |
99 // As such, the rule for categorizing contexts without a surface is: | 99 // As such, the rule for categorizing contexts without a surface is: |
100 // 1. Find the most visible context-with-a-surface within each | 100 // 1. Find the most visible context-with-a-surface within each |
101 // context-without-a-surface's share group, and inherit its visibilty. | 101 // context-without-a-surface's share group, and inherit its visibilty. |
102 void GpuMemoryManager::Manage() { | 102 void GpuMemoryManager::Manage() { |
103 // Set up three allocation values for the three possible stub states | 103 // Set up three allocation values for the three possible stub states |
104 const GpuMemoryAllocation all_buffers_allocation( | 104 const GpuMemoryAllocation all_buffers_allocation( |
105 kResourceSizeNonHibernatedTab, true, true); | 105 kResourceSizeNonHibernatedTab, true, true); |
106 const GpuMemoryAllocation front_buffers_allocation( | 106 const GpuMemoryAllocation front_buffers_allocation( |
107 kResourceSizeNonHibernatedTab, true, false); | 107 kResourceSizeNonHibernatedTab, false, true); |
108 const GpuMemoryAllocation no_buffers_allocation( | 108 const GpuMemoryAllocation no_buffers_allocation( |
109 kResourceSizeHibernatedTab, false, false); | 109 kResourceSizeHibernatedTab, false, false); |
110 | 110 |
111 manage_scheduled_ = false; | 111 manage_scheduled_ = false; |
112 | 112 |
113 // Create stub lists by separating out the two types received from client | 113 // Create stub lists by separating out the two types received from client |
114 std::vector<GpuCommandBufferStubBase*> stubs_with_surface; | 114 std::vector<GpuCommandBufferStubBase*> stubs_with_surface; |
115 std::vector<GpuCommandBufferStubBase*> stubs_without_surface; | 115 std::vector<GpuCommandBufferStubBase*> stubs_without_surface; |
116 { | 116 { |
117 std::vector<GpuCommandBufferStubBase*> stubs; | 117 std::vector<GpuCommandBufferStubBase*> stubs; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 stub->SetMemoryAllocation(all_buffers_allocation); | 163 stub->SetMemoryAllocation(all_buffers_allocation); |
164 } else if (IsInSameContextShareGroupAsAnyOf(stub, front_buffers)) { | 164 } else if (IsInSameContextShareGroupAsAnyOf(stub, front_buffers)) { |
165 stub->SetMemoryAllocation(front_buffers_allocation); | 165 stub->SetMemoryAllocation(front_buffers_allocation); |
166 } else { | 166 } else { |
167 stub->SetMemoryAllocation(no_buffers_allocation); | 167 stub->SetMemoryAllocation(no_buffers_allocation); |
168 } | 168 } |
169 } | 169 } |
170 } | 170 } |
171 | 171 |
172 #endif | 172 #endif |
OLD | NEW |