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

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

Issue 2336043004: Android: Free GLHelper context ashmem when it makes sense (Closed)
Patch Set: address comments Created 4 years, 2 months 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 uint32_t ContextProviderCommandBuffer::GetCopyTextureInternalFormat() { 113 uint32_t ContextProviderCommandBuffer::GetCopyTextureInternalFormat() {
114 if (attributes_.alpha_size > 0) 114 if (attributes_.alpha_size > 0)
115 return GL_RGBA; 115 return GL_RGBA;
116 DCHECK_NE(attributes_.red_size, 0); 116 DCHECK_NE(attributes_.red_size, 0);
117 DCHECK_NE(attributes_.green_size, 0); 117 DCHECK_NE(attributes_.green_size, 0);
118 DCHECK_NE(attributes_.blue_size, 0); 118 DCHECK_NE(attributes_.blue_size, 0);
119 return GL_RGB; 119 return GL_RGB;
120 } 120 }
121 121
122 void ContextProviderCommandBuffer::FreeUnusedSharedMemory() {
123 if (bind_succeeded_)
124 gles2_impl_->FreeUnusedSharedMemory();
125 }
126
122 bool ContextProviderCommandBuffer::BindToCurrentThread() { 127 bool ContextProviderCommandBuffer::BindToCurrentThread() {
123 // This is called on the thread the context will be used. 128 // This is called on the thread the context will be used.
124 DCHECK(context_thread_checker_.CalledOnValidThread()); 129 DCHECK(context_thread_checker_.CalledOnValidThread());
125 130
126 if (bind_failed_) 131 if (bind_failed_)
127 return false; 132 return false;
128 if (bind_succeeded_) 133 if (bind_succeeded_)
129 return true; 134 return true;
130 135
131 // Early outs should report failure. 136 // Early outs should report failure.
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 339
335 void ContextProviderCommandBuffer::SetLostContextCallback( 340 void ContextProviderCommandBuffer::SetLostContextCallback(
336 const LostContextCallback& lost_context_callback) { 341 const LostContextCallback& lost_context_callback) {
337 DCHECK(context_thread_checker_.CalledOnValidThread()); 342 DCHECK(context_thread_checker_.CalledOnValidThread());
338 DCHECK(lost_context_callback_.is_null() || 343 DCHECK(lost_context_callback_.is_null() ||
339 lost_context_callback.is_null()); 344 lost_context_callback.is_null());
340 lost_context_callback_ = lost_context_callback; 345 lost_context_callback_ = lost_context_callback;
341 } 346 }
342 347
343 } // namespace content 348 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698