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