| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return false; | 149 return false; |
| 150 | 150 |
| 151 TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::MaybeInitializeGL"); | 151 TRACE_EVENT0("gpu", "WebGfxCtx3DCmdBfrImpl::MaybeInitializeGL"); |
| 152 | 152 |
| 153 if (!CreateContext(surface_id_ != 0)) { | 153 if (!CreateContext(surface_id_ != 0)) { |
| 154 Destroy(); | 154 Destroy(); |
| 155 initialize_failed_ = true; | 155 initialize_failed_ = true; |
| 156 return false; | 156 return false; |
| 157 } | 157 } |
| 158 | 158 |
| 159 // TODO(twiz): This code is too fragile in that it assumes that only WebGL | 159 if (gl_ && attributes_.webGL) |
| 160 // contexts will request noExtensions. | |
| 161 if (gl_ && attributes_.noExtensions) | |
| 162 gl_->EnableFeatureCHROMIUM("webgl_enable_glsl_webgl_validation"); | 160 gl_->EnableFeatureCHROMIUM("webgl_enable_glsl_webgl_validation"); |
| 163 | 161 |
| 164 command_buffer_->SetChannelErrorCallback( | 162 command_buffer_->SetChannelErrorCallback( |
| 165 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnGpuChannelLost, | 163 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnGpuChannelLost, |
| 166 weak_ptr_factory_.GetWeakPtr())); | 164 weak_ptr_factory_.GetWeakPtr())); |
| 167 | 165 |
| 168 command_buffer_->SetOnConsoleMessageCallback( | 166 command_buffer_->SetOnConsoleMessageCallback( |
| 169 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnErrorMessage, | 167 base::Bind(&WebGraphicsContext3DCommandBufferImpl::OnErrorMessage, |
| 170 weak_ptr_factory_.GetWeakPtr())); | 168 weak_ptr_factory_.GetWeakPtr())); |
| 171 | 169 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 share_group_->RemoveAllContexts(); | 433 share_group_->RemoveAllContexts(); |
| 436 | 434 |
| 437 DCHECK(host_.get()); | 435 DCHECK(host_.get()); |
| 438 { | 436 { |
| 439 base::AutoLock lock(g_default_share_groups_lock.Get()); | 437 base::AutoLock lock(g_default_share_groups_lock.Get()); |
| 440 g_default_share_groups.Get().erase(host_.get()); | 438 g_default_share_groups.Get().erase(host_.get()); |
| 441 } | 439 } |
| 442 } | 440 } |
| 443 | 441 |
| 444 } // namespace content | 442 } // namespace content |
| OLD | NEW |