Chromium Code Reviews| Index: ui/gl/gl_context.cc |
| diff --git a/ui/gl/gl_context.cc b/ui/gl/gl_context.cc |
| index e26f75943b6564db26bb153f370fe278012f9bfa..144abbef16186b7e9c021ca717ca5d028ea597d8 100644 |
| --- a/ui/gl/gl_context.cc |
| +++ b/ui/gl/gl_context.cc |
| @@ -20,6 +20,9 @@ namespace gfx { |
| namespace { |
| base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky |
| current_context_ = LAZY_INSTANCE_INITIALIZER; |
| + |
| +base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky |
| + current_real_context_ = LAZY_INSTANCE_INITIALIZER; |
| } // namespace |
| GLContext::GLContext(GLShareGroup* share_group) : share_group_(share_group) { |
| @@ -90,7 +93,15 @@ GLContext* GLContext::GetCurrent() { |
| return current_context_.Pointer()->Get(); |
| } |
| +GLContext* GLContext::GetRealCurrent() { |
| + return current_real_context_.Pointer()->Get(); |
| +} |
| + |
| void GLContext::SetCurrent(GLContext* context, GLSurface* surface) { |
| + if (!context || !context->IsVirtualContext()) { |
|
no sievers
2013/05/24 17:04:02
Do we allow SetCurrent(NULL, !NULL)?
Or should we
jonathan.backer
2013/05/24 20:36:40
Yeah. I just looked at the OSX code (which might h
jonathan.backer
2013/05/27 16:37:36
Done.
|
| + current_real_context_.Pointer()->Set(context); |
| + GLSurface::SetRealCurrent(surface); |
| + } |
| current_context_.Pointer()->Set(context); |
| GLSurface::SetCurrent(surface); |
| } |
| @@ -128,7 +139,10 @@ void GLContext::SetupForVirtualization() { |
| bool GLContext::MakeVirtuallyCurrent( |
| GLContext* virtual_context, GLSurface* surface) { |
| DCHECK(virtual_gl_api_); |
| - return virtual_gl_api_->MakeCurrent(virtual_context, surface); |
| + bool result = virtual_gl_api_->MakeCurrent(virtual_context, surface); |
| + if (result) |
| + SetCurrent(virtual_context, surface); |
|
jonathan.backer
2013/05/23 21:00:53
Maybe SetCurrent(NULL, NULL) otherwise?
|
| + return result; |
| } |
| void GLContext::OnDestroyVirtualContext(GLContext* virtual_context) { |
| @@ -140,4 +154,8 @@ void GLContext::SetRealGLApi() { |
| SetGLToRealGLApi(); |
| } |
| +bool GLContext::IsVirtualContext() { |
| + return false; |
| +} |
| + |
| } // namespace gfx |