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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 // Do this last once the context is set up. | 240 // Do this last once the context is set up. |
241 std::string type_name = | 241 std::string type_name = |
242 command_buffer_metrics::ContextTypeToString(context_type_); | 242 command_buffer_metrics::ContextTypeToString(context_type_); |
243 std::string unique_context_name = | 243 std::string unique_context_name = |
244 base::StringPrintf("%s-%p", type_name.c_str(), gles2_impl_.get()); | 244 base::StringPrintf("%s-%p", type_name.c_str(), gles2_impl_.get()); |
245 ContextGL()->TraceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str()); | 245 ContextGL()->TraceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str()); |
246 // If support_locking_ is true, the context may be used from multiple | 246 // If support_locking_ is true, the context may be used from multiple |
247 // threads, and any async callstacks will need to hold the same lock, so | 247 // threads, and any async callstacks will need to hold the same lock, so |
248 // give it to the command buffer and cache controller. | 248 // give it to the command buffer. |
249 // We don't hold a lock here since there's no need, so set the lock very last | 249 // We don't hold a lock here since there's no need, so set the lock very last |
250 // to prevent asserts that we're not holding it. | 250 // to prevent asserts that we're not holding it. |
251 if (support_locking_) { | 251 if (support_locking_) |
252 command_buffer_->SetLock(&context_lock_); | 252 command_buffer_->SetLock(&context_lock_); |
253 cache_controller_->SetLock(&context_lock_); | |
254 } | |
255 return true; | 253 return true; |
256 } | 254 } |
257 | 255 |
258 void ContextProviderCommandBuffer::DetachFromThread() { | 256 void ContextProviderCommandBuffer::DetachFromThread() { |
259 context_thread_checker_.DetachFromThread(); | 257 context_thread_checker_.DetachFromThread(); |
260 } | 258 } |
261 | 259 |
262 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { | 260 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { |
263 DCHECK(bind_succeeded_); | 261 DCHECK(bind_succeeded_); |
264 DCHECK(context_thread_checker_.CalledOnValidThread()); | 262 DCHECK(context_thread_checker_.CalledOnValidThread()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 334 |
337 void ContextProviderCommandBuffer::SetLostContextCallback( | 335 void ContextProviderCommandBuffer::SetLostContextCallback( |
338 const LostContextCallback& lost_context_callback) { | 336 const LostContextCallback& lost_context_callback) { |
339 DCHECK(context_thread_checker_.CalledOnValidThread()); | 337 DCHECK(context_thread_checker_.CalledOnValidThread()); |
340 DCHECK(lost_context_callback_.is_null() || | 338 DCHECK(lost_context_callback_.is_null() || |
341 lost_context_callback.is_null()); | 339 lost_context_callback.is_null()); |
342 lost_context_callback_ = lost_context_callback; | 340 lost_context_callback_ = lost_context_callback; |
343 } | 341 } |
344 | 342 |
345 } // namespace content | 343 } // namespace content |
OLD | NEW |