OLD | NEW |
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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 158 |
159 cc::ContextProvider::Capabilities | 159 cc::ContextProvider::Capabilities |
160 ContextProviderCommandBuffer::ContextCapabilities() { | 160 ContextProviderCommandBuffer::ContextCapabilities() { |
161 DCHECK(context3d_); | 161 DCHECK(context3d_); |
162 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 162 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
163 DCHECK(context_thread_checker_.CalledOnValidThread()); | 163 DCHECK(context_thread_checker_.CalledOnValidThread()); |
164 | 164 |
165 return capabilities_; | 165 return capabilities_; |
166 } | 166 } |
167 | 167 |
| 168 bool ContextProviderCommandBuffer::IsContextLost() { |
| 169 DCHECK(context3d_); |
| 170 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
| 171 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 172 |
| 173 return context3d_->isContextLost(); |
| 174 } |
| 175 |
168 void ContextProviderCommandBuffer::VerifyContexts() { | 176 void ContextProviderCommandBuffer::VerifyContexts() { |
169 DCHECK(context3d_); | 177 DCHECK(context3d_); |
170 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 178 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
171 DCHECK(context_thread_checker_.CalledOnValidThread()); | 179 DCHECK(context_thread_checker_.CalledOnValidThread()); |
172 | 180 |
173 if (context3d_->isContextLost()) | 181 if (context3d_->isContextLost()) |
174 OnLostContext(); | 182 OnLostContext(); |
175 } | 183 } |
176 | 184 |
177 void ContextProviderCommandBuffer::OnLostContext() { | 185 void ContextProviderCommandBuffer::OnLostContext() { |
(...skipping 27 matching lines...) Expand all Loading... |
205 return; | 213 return; |
206 | 214 |
207 memory_policy_changed_callback_.Run(cc::ManagedMemoryPolicy(allocation)); | 215 memory_policy_changed_callback_.Run(cc::ManagedMemoryPolicy(allocation)); |
208 } | 216 } |
209 | 217 |
210 bool ContextProviderCommandBuffer::InitializeCapabilities() { | 218 bool ContextProviderCommandBuffer::InitializeCapabilities() { |
211 // The command buffer provides the following capabilities always. | 219 // The command buffer provides the following capabilities always. |
212 // TODO(jamesr): This information is duplicated with | 220 // TODO(jamesr): This information is duplicated with |
213 // gpu::gles2::FeatureInfo::AddFeatures(). | 221 // gpu::gles2::FeatureInfo::AddFeatures(). |
214 Capabilities caps; | 222 Capabilities caps; |
215 caps.bind_uniform_location = true; | |
216 caps.discard_backbuffer = true; | 223 caps.discard_backbuffer = true; |
217 caps.set_visibility = true; | 224 caps.set_visibility = true; |
218 | 225 |
219 // TODO(jamesr): These are also added in | 226 // TODO(jamesr): These are also added in |
220 // gpu::gles2::GLES2Implementation::GetStringHelper() on the client side. | 227 // gpu::gles2::GLES2Implementation::GetStringHelper() on the client side. |
221 caps.map_sub = true; | 228 caps.map_sub = true; |
222 caps.shallow_flush = true; | 229 caps.shallow_flush = true; |
223 | 230 |
224 // The swapbuffers complete callback is always supported by multi-process | 231 // The swapbuffers complete callback is always supported by multi-process |
225 // command buffer implementations. | 232 // command buffer implementations. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 | 310 |
304 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 311 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
305 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 312 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
306 DCHECK(context_thread_checker_.CalledOnValidThread()); | 313 DCHECK(context_thread_checker_.CalledOnValidThread()); |
307 DCHECK(memory_policy_changed_callback_.is_null() || | 314 DCHECK(memory_policy_changed_callback_.is_null() || |
308 memory_policy_changed_callback.is_null()); | 315 memory_policy_changed_callback.is_null()); |
309 memory_policy_changed_callback_ = memory_policy_changed_callback; | 316 memory_policy_changed_callback_ = memory_policy_changed_callback; |
310 } | 317 } |
311 | 318 |
312 } // namespace content | 319 } // namespace content |
OLD | NEW |