Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: content/common/gpu/client/context_provider_command_buffer.cc

Issue 53633003: Do not give GPU memory to backgrounded compositors. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove test Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/trees/layer_tree_host_unittest_damage.cc ('k') | content/common/gpu/gpu_memory_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/client/context_provider_command_buffer.h" 5 #include "content/common/gpu/client/context_provider_command_buffer.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 DCHECK(context_thread_checker_.CalledOnValidThread()); 197 DCHECK(context_thread_checker_.CalledOnValidThread());
198 198
199 if (gr_context_) { 199 if (gr_context_) {
200 bool nonzero_allocation = !!allocation.bytes_limit_when_visible; 200 bool nonzero_allocation = !!allocation.bytes_limit_when_visible;
201 gr_context_->SetMemoryLimit(nonzero_allocation); 201 gr_context_->SetMemoryLimit(nonzero_allocation);
202 } 202 }
203 203
204 if (memory_policy_changed_callback_.is_null()) 204 if (memory_policy_changed_callback_.is_null())
205 return; 205 return;
206 206
207 bool discard_backbuffer_when_not_visible = 207 memory_policy_changed_callback_.Run(cc::ManagedMemoryPolicy(allocation));
208 !allocation.have_backbuffer_when_not_visible;
209
210 memory_policy_changed_callback_.Run(
211 cc::ManagedMemoryPolicy(allocation), discard_backbuffer_when_not_visible);
212 } 208 }
213 209
214 bool ContextProviderCommandBuffer::InitializeCapabilities() { 210 bool ContextProviderCommandBuffer::InitializeCapabilities() {
215 // The command buffer provides the following capabilities always. 211 // The command buffer provides the following capabilities always.
216 // TODO(jamesr): This information is duplicated with 212 // TODO(jamesr): This information is duplicated with
217 // gpu::gles2::FeatureInfo::AddFeatures(). 213 // gpu::gles2::FeatureInfo::AddFeatures().
218 Capabilities caps; 214 Capabilities caps;
219 caps.bind_uniform_location = true; 215 caps.bind_uniform_location = true;
220 caps.discard_backbuffer = true; 216 caps.discard_backbuffer = true;
221 caps.set_visibility = true; 217 caps.set_visibility = true;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 303
308 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( 304 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback(
309 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { 305 const MemoryPolicyChangedCallback& memory_policy_changed_callback) {
310 DCHECK(context_thread_checker_.CalledOnValidThread()); 306 DCHECK(context_thread_checker_.CalledOnValidThread());
311 DCHECK(memory_policy_changed_callback_.is_null() || 307 DCHECK(memory_policy_changed_callback_.is_null() ||
312 memory_policy_changed_callback.is_null()); 308 memory_policy_changed_callback.is_null());
313 memory_policy_changed_callback_ = memory_policy_changed_callback; 309 memory_policy_changed_callback_ = memory_policy_changed_callback;
314 } 310 }
315 311
316 } // namespace content 312 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_damage.cc ('k') | content/common/gpu/gpu_memory_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698