| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/webgraphicscontext3d_command_buffer_impl.h" | 5 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| 6 | 6 |
| 7 #include "third_party/khronos/GLES2/gl2.h" | 7 #include "third_party/khronos/GLES2/gl2.h" |
| 8 #ifndef GL_GLEXT_PROTOTYPES | 8 #ifndef GL_GLEXT_PROTOTYPES |
| 9 #define GL_GLEXT_PROTOTYPES 1 | 9 #define GL_GLEXT_PROTOTYPES 1 |
| 10 #endif | 10 #endif |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 | 164 |
| 165 { | 165 { |
| 166 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | 166 base::AutoLock lock(g_all_shared_contexts_lock.Get()); |
| 167 g_all_shared_contexts.Pointer()->erase(this); | 167 g_all_shared_contexts.Pointer()->erase(this); |
| 168 } | 168 } |
| 169 Destroy(); | 169 Destroy(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void WebGraphicsContext3DCommandBufferImpl::InitializeWithCommandBuffer( | 172 void WebGraphicsContext3DCommandBufferImpl::InitializeWithCommandBuffer( |
| 173 CommandBufferProxy* command_buffer, | 173 CommandBufferProxyImpl* command_buffer, |
| 174 const WebGraphicsContext3D::Attributes& attributes, | 174 const WebGraphicsContext3D::Attributes& attributes, |
| 175 bool bind_generates_resources) { | 175 bool bind_generates_resources) { |
| 176 DCHECK(command_buffer); | 176 DCHECK(command_buffer); |
| 177 command_buffer_ = command_buffer; | 177 command_buffer_ = command_buffer; |
| 178 attributes_ = attributes; | 178 attributes_ = attributes; |
| 179 bind_generates_resources_ = bind_generates_resources; | 179 bind_generates_resources_ = bind_generates_resources; |
| 180 } | 180 } |
| 181 | 181 |
| 182 bool WebGraphicsContext3DCommandBufferImpl::Initialize( | 182 bool WebGraphicsContext3DCommandBufferImpl::Initialize( |
| 183 const WebGraphicsContext3D::Attributes& attributes, | 183 const WebGraphicsContext3D::Attributes& attributes, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 | 271 |
| 272 bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( | 272 bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( |
| 273 bool onscreen, | 273 bool onscreen, |
| 274 const char* allowed_extensions) { | 274 const char* allowed_extensions) { |
| 275 if (!host_) | 275 if (!host_) |
| 276 return false; | 276 return false; |
| 277 // We need to lock g_all_shared_contexts to ensure that the context we picked | 277 // We need to lock g_all_shared_contexts to ensure that the context we picked |
| 278 // for our share group isn't deleted. | 278 // for our share group isn't deleted. |
| 279 // (There's also a lock in our destructor.) | 279 // (There's also a lock in our destructor.) |
| 280 base::AutoLock lock(g_all_shared_contexts_lock.Get()); | 280 base::AutoLock lock(g_all_shared_contexts_lock.Get()); |
| 281 CommandBufferProxy* share_group = NULL; | 281 CommandBufferProxyImpl* share_group = NULL; |
| 282 if (attributes_.shareResources) { | 282 if (attributes_.shareResources) { |
| 283 WebGraphicsContext3DCommandBufferImpl* share_group_context = | 283 WebGraphicsContext3DCommandBufferImpl* share_group_context = |
| 284 g_all_shared_contexts.Pointer()->empty() ? | 284 g_all_shared_contexts.Pointer()->empty() ? |
| 285 NULL : *g_all_shared_contexts.Pointer()->begin(); | 285 NULL : *g_all_shared_contexts.Pointer()->begin(); |
| 286 share_group = share_group_context ? | 286 share_group = share_group_context ? |
| 287 share_group_context->command_buffer_ : NULL; | 287 share_group_context->command_buffer_ : NULL; |
| 288 } | 288 } |
| 289 | 289 |
| 290 std::vector<int32> attribs; | 290 std::vector<int32> attribs; |
| 291 attribs.push_back(ALPHA_SIZE); | 291 attribs.push_back(ALPHA_SIZE); |
| (...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1599 | 1599 |
| 1600 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( | 1600 void WebGraphicsContext3DCommandBufferImpl::OnErrorMessage( |
| 1601 const std::string& message, int id) { | 1601 const std::string& message, int id) { |
| 1602 if (error_message_callback_) { | 1602 if (error_message_callback_) { |
| 1603 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); | 1603 WebKit::WebString str = WebKit::WebString::fromUTF8(message.c_str()); |
| 1604 error_message_callback_->onErrorMessage(str, id); | 1604 error_message_callback_->onErrorMessage(str, id); |
| 1605 } | 1605 } |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 } // namespace content | 1608 } // namespace content |
| OLD | NEW |