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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); | 100 base::StringPrintf("%s-%p", debug_name_.c_str(), context3d_.get()); |
101 context3d_->traceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str()); | 101 context3d_->traceBeginCHROMIUM("gpu_toplevel", unique_context_name.c_str()); |
102 | 102 |
103 lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); | 103 lost_context_callback_proxy_.reset(new LostContextCallbackProxy(this)); |
104 context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( | 104 context3d_->GetCommandBufferProxy()->SetMemoryAllocationChangedCallback( |
105 base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged, | 105 base::Bind(&ContextProviderCommandBuffer::OnMemoryAllocationChanged, |
106 base::Unretained(this))); | 106 base::Unretained(this))); |
107 return true; | 107 return true; |
108 } | 108 } |
109 | 109 |
| 110 void ContextProviderCommandBuffer::DetachFromThread() { |
| 111 context_thread_checker_.DetachFromThread(); |
| 112 } |
| 113 |
110 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { | 114 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { |
111 DCHECK(context3d_); | 115 DCHECK(context3d_); |
112 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 116 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
113 DCHECK(context_thread_checker_.CalledOnValidThread()); | 117 DCHECK(context_thread_checker_.CalledOnValidThread()); |
114 | 118 |
115 return context3d_->GetImplementation(); | 119 return context3d_->GetImplementation(); |
116 } | 120 } |
117 | 121 |
118 gpu::ContextSupport* ContextProviderCommandBuffer::ContextSupport() { | 122 gpu::ContextSupport* ContextProviderCommandBuffer::ContextSupport() { |
119 return context3d_->GetContextSupport(); | 123 return context3d_->GetContextSupport(); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 218 |
215 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( | 219 void ContextProviderCommandBuffer::SetMemoryPolicyChangedCallback( |
216 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 220 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
217 DCHECK(context_thread_checker_.CalledOnValidThread()); | 221 DCHECK(context_thread_checker_.CalledOnValidThread()); |
218 DCHECK(memory_policy_changed_callback_.is_null() || | 222 DCHECK(memory_policy_changed_callback_.is_null() || |
219 memory_policy_changed_callback.is_null()); | 223 memory_policy_changed_callback.is_null()); |
220 memory_policy_changed_callback_ = memory_policy_changed_callback; | 224 memory_policy_changed_callback_ = memory_policy_changed_callback; |
221 } | 225 } |
222 | 226 |
223 } // namespace content | 227 } // namespace content |
OLD | NEW |