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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 if (memory_policy_changed_callback_.is_null()) | 205 if (memory_policy_changed_callback_.is_null()) |
206 return; | 206 return; |
207 | 207 |
208 memory_policy_changed_callback_.Run(cc::ManagedMemoryPolicy(allocation)); | 208 memory_policy_changed_callback_.Run(cc::ManagedMemoryPolicy(allocation)); |
209 } | 209 } |
210 | 210 |
211 void ContextProviderCommandBuffer::InitializeCapabilities() { | 211 void ContextProviderCommandBuffer::InitializeCapabilities() { |
212 Capabilities caps; | 212 Capabilities caps; |
213 caps.gpu = context3d_->GetImplementation()->capabilities(); | 213 caps.gpu = context3d_->GetImplementation()->capabilities(); |
214 | |
215 size_t mapped_memory_limit = context3d_->GetMappedMemoryLimit(); | |
216 caps.max_transfer_buffer_usage_bytes = | |
217 mapped_memory_limit == WebGraphicsContext3DCommandBufferImpl::kNoLimit | |
218 ? std::numeric_limits<size_t>::max() : mapped_memory_limit; | |
219 | |
220 capabilities_ = caps; | 214 capabilities_ = caps; |
221 } | 215 } |
222 | 216 |
223 bool ContextProviderCommandBuffer::DestroyedOnMainThread() { | 217 bool ContextProviderCommandBuffer::DestroyedOnMainThread() { |
224 DCHECK(main_thread_checker_.CalledOnValidThread()); | 218 DCHECK(main_thread_checker_.CalledOnValidThread()); |
225 | 219 |
226 base::AutoLock lock(main_thread_lock_); | 220 base::AutoLock lock(main_thread_lock_); |
227 return destroyed_; | 221 return destroyed_; |
228 } | 222 } |
229 | 223 |
230 void ContextProviderCommandBuffer::SetLostContextCallback( | 224 void ContextProviderCommandBuffer::SetLostContextCallback( |
231 const LostContextCallback& lost_context_callback) { | 225 const LostContextCallback& lost_context_callback) { |
232 DCHECK(context_thread_checker_.CalledOnValidThread()); | 226 DCHECK(context_thread_checker_.CalledOnValidThread()); |
233 DCHECK(lost_context_callback_.is_null() || | 227 DCHECK(lost_context_callback_.is_null() || |
234 lost_context_callback.is_null()); | 228 lost_context_callback.is_null()); |
235 lost_context_callback_ = lost_context_callback; | 229 lost_context_callback_ = lost_context_callback; |
236 } | 230 } |
237 | 231 |
238 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 232 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
239 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 233 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
240 DCHECK(context_thread_checker_.CalledOnValidThread()); | 234 DCHECK(context_thread_checker_.CalledOnValidThread()); |
241 DCHECK(memory_policy_changed_callback_.is_null() || | 235 DCHECK(memory_policy_changed_callback_.is_null() || |
242 memory_policy_changed_callback.is_null()); | 236 memory_policy_changed_callback.is_null()); |
243 memory_policy_changed_callback_ = memory_policy_changed_callback; | 237 memory_policy_changed_callback_ = memory_policy_changed_callback; |
244 } | 238 } |
245 | 239 |
246 } // namespace content | 240 } // namespace content |
OLD | NEW |