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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Disconnect lost callbacks during destruction. | 83 // Disconnect lost callbacks during destruction. |
84 lost_context_callback_proxy_.reset(); | 84 lost_context_callback_proxy_.reset(); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 gpu::CommandBufferProxyImpl* | 88 gpu::CommandBufferProxyImpl* |
89 ContextProviderCommandBuffer::GetCommandBufferProxy() { | 89 ContextProviderCommandBuffer::GetCommandBufferProxy() { |
90 return context3d_->GetCommandBufferProxy(); | 90 return context3d_->GetCommandBufferProxy(); |
91 } | 91 } |
92 | 92 |
93 WebGraphicsContext3DCommandBufferImpl* | |
94 ContextProviderCommandBuffer::WebContext3D() { | |
95 DCHECK(context3d_); | |
96 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | |
97 DCHECK(context_thread_checker_.CalledOnValidThread()); | |
98 return context3d_.get(); | |
99 } | |
100 | |
101 bool ContextProviderCommandBuffer::BindToCurrentThread() { | 93 bool ContextProviderCommandBuffer::BindToCurrentThread() { |
102 // This is called on the thread the context will be used. | 94 // This is called on the thread the context will be used. |
103 DCHECK(context_thread_checker_.CalledOnValidThread()); | 95 DCHECK(context_thread_checker_.CalledOnValidThread()); |
104 | 96 |
105 if (lost_context_callback_proxy_) | 97 if (lost_context_callback_proxy_) |
106 return true; | 98 return true; |
107 | 99 |
108 context3d_->SetContextType(context_type_); | 100 context3d_->SetContextType(context_type_); |
109 | 101 |
110 // It's possible to be running BindToCurrentThread on two contexts | 102 // It's possible to be running BindToCurrentThread on two contexts |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 236 |
245 void ContextProviderCommandBuffer::SetLostContextCallback( | 237 void ContextProviderCommandBuffer::SetLostContextCallback( |
246 const LostContextCallback& lost_context_callback) { | 238 const LostContextCallback& lost_context_callback) { |
247 DCHECK(context_thread_checker_.CalledOnValidThread()); | 239 DCHECK(context_thread_checker_.CalledOnValidThread()); |
248 DCHECK(lost_context_callback_.is_null() || | 240 DCHECK(lost_context_callback_.is_null() || |
249 lost_context_callback.is_null()); | 241 lost_context_callback.is_null()); |
250 lost_context_callback_ = lost_context_callback; | 242 lost_context_callback_ = lost_context_callback; |
251 } | 243 } |
252 | 244 |
253 } // namespace content | 245 } // namespace content |
OLD | NEW |