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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 share_group_->AddContextLocked(this); | 289 share_group_->AddContextLocked(this); |
290 | 290 |
291 if (CommandLine::ForCurrentProcess()->HasSwitch( | 291 if (CommandLine::ForCurrentProcess()->HasSwitch( |
292 switches::kEnableGpuClientTracing)) { | 292 switches::kEnableGpuClientTracing)) { |
293 trace_gl_.reset(new gpu::gles2::GLES2TraceImplementation(GetGLInterface())); | 293 trace_gl_.reset(new gpu::gles2::GLES2TraceImplementation(GetGLInterface())); |
294 setGLInterface(trace_gl_.get()); | 294 setGLInterface(trace_gl_.get()); |
295 } | 295 } |
296 return true; | 296 return true; |
297 } | 297 } |
298 | 298 |
299 bool WebGraphicsContext3DCommandBufferImpl::makeContextCurrent() { | 299 bool WebGraphicsContext3DCommandBufferImpl::BindToCurrentThread() { |
300 if (!MaybeInitializeGL()) { | 300 if (!MaybeInitializeGL()) { |
301 DLOG(ERROR) << "Failed to initialize context."; | 301 DLOG(ERROR) << "Failed to initialize context."; |
302 return false; | 302 return false; |
303 } | 303 } |
304 gles2::SetGLContext(GetGLInterface()); | |
305 if (gpu::error::IsError(command_buffer_->GetLastError())) { | 304 if (gpu::error::IsError(command_buffer_->GetLastError())) { |
306 LOG(ERROR) << "Context dead on arrival. Last error: " | 305 LOG(ERROR) << "Context dead on arrival. Last error: " |
307 << command_buffer_->GetLastError(); | 306 << command_buffer_->GetLastError(); |
308 return false; | 307 return false; |
309 } | 308 } |
310 | 309 |
311 return true; | 310 return true; |
312 } | 311 } |
313 | 312 |
314 void WebGraphicsContext3DCommandBufferImpl::Destroy() { | 313 void WebGraphicsContext3DCommandBufferImpl::Destroy() { |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 share_group_->RemoveAllContexts(); | 421 share_group_->RemoveAllContexts(); |
423 | 422 |
424 DCHECK(host_.get()); | 423 DCHECK(host_.get()); |
425 { | 424 { |
426 base::AutoLock lock(g_default_share_groups_lock.Get()); | 425 base::AutoLock lock(g_default_share_groups_lock.Get()); |
427 g_default_share_groups.Get().erase(host_.get()); | 426 g_default_share_groups.Get().erase(host_.get()); |
428 } | 427 } |
429 } | 428 } |
430 | 429 |
431 } // namespace content | 430 } // namespace content |
OLD | NEW |