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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 context_thread_checker_.CalledOnValidThread()); | 61 context_thread_checker_.CalledOnValidThread()); |
62 | 62 |
63 // Destroy references to the context3d_ before leaking it. | 63 // Destroy references to the context3d_ before leaking it. |
64 if (WebContext3DNoChecks()->GetCommandBufferProxy()) | 64 if (WebContext3DNoChecks()->GetCommandBufferProxy()) |
65 WebContext3DNoChecks()->GetCommandBufferProxy()->SetLock(nullptr); | 65 WebContext3DNoChecks()->GetCommandBufferProxy()->SetLock(nullptr); |
66 lost_context_callback_proxy_.reset(); | 66 lost_context_callback_proxy_.reset(); |
67 } | 67 } |
68 | 68 |
69 | 69 |
70 CommandBufferProxyImpl* ContextProviderCommandBuffer::GetCommandBufferProxy() { | 70 CommandBufferProxyImpl* ContextProviderCommandBuffer::GetCommandBufferProxy() { |
71 return WebContext3D()->GetCommandBufferProxy(); | 71 return WebContext3DNoChecks()->GetCommandBufferProxy(); |
72 } | 72 } |
73 | 73 |
74 WebGraphicsContext3DCommandBufferImpl* | 74 WebGraphicsContext3DCommandBufferImpl* |
75 ContextProviderCommandBuffer::WebContext3D() { | 75 ContextProviderCommandBuffer::WebContext3D() { |
76 DCHECK(gr_interface_); | 76 DCHECK(gr_interface_); |
77 DCHECK(gr_interface_->WebContext3D()); | 77 DCHECK(gr_interface_->WebContext3D()); |
78 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 78 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
79 DCHECK(context_thread_checker_.CalledOnValidThread()); | 79 DCHECK(context_thread_checker_.CalledOnValidThread()); |
80 | 80 |
81 return WebContext3DNoChecks(); | 81 return WebContext3DNoChecks(); |
(...skipping 30 matching lines...) Expand all Loading... |
112 return true; | 112 return true; |
113 } | 113 } |
114 | 114 |
115 void ContextProviderCommandBuffer::DetachFromThread() { | 115 void ContextProviderCommandBuffer::DetachFromThread() { |
116 context_thread_checker_.DetachFromThread(); | 116 context_thread_checker_.DetachFromThread(); |
117 } | 117 } |
118 | 118 |
119 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { | 119 gpu::gles2::GLES2Interface* ContextProviderCommandBuffer::ContextGL() { |
120 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 120 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
121 | 121 |
122 return WebContext3DNoChecks()->GetImplementation(); | 122 return WebContext3D()->GetImplementation(); |
123 } | 123 } |
124 | 124 |
125 gpu::ContextSupport* ContextProviderCommandBuffer::ContextSupport() { | 125 gpu::ContextSupport* ContextProviderCommandBuffer::ContextSupport() { |
126 return WebContext3D()->GetContextSupport(); | 126 return WebContext3DNoChecks()->GetContextSupport(); |
127 } | 127 } |
128 | 128 |
129 class GrContext* ContextProviderCommandBuffer::GrContext() { | 129 class GrContext* ContextProviderCommandBuffer::GrContext() { |
130 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 130 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
131 DCHECK(context_thread_checker_.CalledOnValidThread()); | 131 DCHECK(context_thread_checker_.CalledOnValidThread()); |
132 | 132 |
133 if (gr_context_) | 133 if (gr_context_) |
134 return gr_context_->get(); | 134 return gr_context_->get(); |
135 | 135 |
136 gr_context_.reset(new GrContextForWebGraphicsContext3D(gr_interface_)); | 136 gr_context_.reset(new GrContextForWebGraphicsContext3D(gr_interface_)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 void ContextProviderCommandBuffer::SetLostContextCallback( | 198 void ContextProviderCommandBuffer::SetLostContextCallback( |
199 const LostContextCallback& lost_context_callback) { | 199 const LostContextCallback& lost_context_callback) { |
200 DCHECK(context_thread_checker_.CalledOnValidThread()); | 200 DCHECK(context_thread_checker_.CalledOnValidThread()); |
201 DCHECK(lost_context_callback_.is_null() || | 201 DCHECK(lost_context_callback_.is_null() || |
202 lost_context_callback.is_null()); | 202 lost_context_callback.is_null()); |
203 lost_context_callback_ = lost_context_callback; | 203 lost_context_callback_ = lost_context_callback; |
204 } | 204 } |
205 | 205 |
206 } // namespace content | 206 } // namespace content |
OLD | NEW |