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 "webkit/common/gpu/context_provider_in_process.h" | 5 #include "webkit/common/gpu/context_provider_in_process.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 swap_buffers_complete_callback_proxy_.reset( | 118 swap_buffers_complete_callback_proxy_.reset( |
119 new SwapBuffersCompleteCallbackProxy(this)); | 119 new SwapBuffersCompleteCallbackProxy(this)); |
120 return true; | 120 return true; |
121 } | 121 } |
122 | 122 |
123 cc::ContextProvider::Capabilities | 123 cc::ContextProvider::Capabilities |
124 ContextProviderInProcess::ContextCapabilities() { | 124 ContextProviderInProcess::ContextCapabilities() { |
125 // We always use a WebGraphicsContext3DInProcessCommandBufferImpl which | 125 // We always use a WebGraphicsContext3DInProcessCommandBufferImpl which |
126 // provides the following capabilities: | 126 // provides the following capabilities: |
127 Capabilities caps; | 127 Capabilities caps; |
128 caps.bind_uniform_location = true; | |
129 caps.discard_backbuffer = true; | 128 caps.discard_backbuffer = true; |
130 caps.map_image = true; | 129 caps.map_image = true; |
131 caps.map_sub = true; | 130 caps.map_sub = true; |
132 caps.set_visibility = true; | 131 caps.set_visibility = true; |
133 caps.shallow_flush = true; | 132 caps.shallow_flush = true; |
134 caps.texture_format_bgra8888 = true; | 133 caps.texture_format_bgra8888 = true; |
135 caps.texture_rectangle = true; | 134 caps.texture_rectangle = true; |
136 | 135 |
137 WebKit::WebString extensions = | 136 WebKit::WebString extensions = |
138 context3d_->getString(0x1F03 /* GL_EXTENSIONS */); | 137 context3d_->getString(0x1F03 /* GL_EXTENSIONS */); |
(...skipping 28 matching lines...) Expand all Loading... |
167 DCHECK(context_thread_checker_.CalledOnValidThread()); | 166 DCHECK(context_thread_checker_.CalledOnValidThread()); |
168 | 167 |
169 if (gr_context_) | 168 if (gr_context_) |
170 return gr_context_->get(); | 169 return gr_context_->get(); |
171 | 170 |
172 gr_context_.reset( | 171 gr_context_.reset( |
173 new webkit::gpu::GrContextForWebGraphicsContext3D(context3d_.get())); | 172 new webkit::gpu::GrContextForWebGraphicsContext3D(context3d_.get())); |
174 return gr_context_->get(); | 173 return gr_context_->get(); |
175 } | 174 } |
176 | 175 |
| 176 bool ContextProviderInProcess::IsContextLost() { |
| 177 DCHECK(context3d_); |
| 178 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
| 179 DCHECK(context_thread_checker_.CalledOnValidThread()); |
| 180 |
| 181 return context3d_->isContextLost(); |
| 182 } |
| 183 |
177 void ContextProviderInProcess::VerifyContexts() { | 184 void ContextProviderInProcess::VerifyContexts() { |
178 DCHECK(context3d_); | 185 DCHECK(context3d_); |
179 DCHECK(lost_context_callback_proxy_); // Is bound to thread. | 186 DCHECK(lost_context_callback_proxy_); // Is bound to thread. |
180 DCHECK(context_thread_checker_.CalledOnValidThread()); | 187 DCHECK(context_thread_checker_.CalledOnValidThread()); |
181 | 188 |
182 if (context3d_->isContextLost()) | 189 if (context3d_->isContextLost()) |
183 OnLostContext(); | 190 OnLostContext(); |
184 } | 191 } |
185 | 192 |
186 void ContextProviderInProcess::OnLostContext() { | 193 void ContextProviderInProcess::OnLostContext() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 swap_buffers_complete_callback_ = swap_buffers_complete_callback; | 231 swap_buffers_complete_callback_ = swap_buffers_complete_callback; |
225 } | 232 } |
226 | 233 |
227 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( | 234 void ContextProviderInProcess::SetMemoryPolicyChangedCallback( |
228 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { | 235 const MemoryPolicyChangedCallback& memory_policy_changed_callback) { |
229 // There's no memory manager for the in-process implementation. | 236 // There's no memory manager for the in-process implementation. |
230 } | 237 } |
231 | 238 |
232 } // namespace gpu | 239 } // namespace gpu |
233 } // namespace webkit | 240 } // namespace webkit |
OLD | NEW |