| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "../client/gles2_lib.h" | 5 #include "../client/gles2_lib.h" |
| 6 #include "../common/thread_local.h" | 6 #include "../common/thread_local.h" |
| 7 | 7 |
| 8 namespace gles2 { | 8 namespace gles2 { |
| 9 namespace { | 9 // TODO(kbr): the use of this anonymous namespace core dumps the |
| 10 gpu::ThreadLocalKey g_gl_context_key; | 10 // linker on Mac OS X 10.6 when the symbol ordering file is used |
| 11 } // namespace anonymous | 11 // namespace { |
| 12 static gpu::ThreadLocalKey g_gl_context_key; |
| 13 // } // namespace anonymous |
| 12 | 14 |
| 13 void Initialize() { | 15 void Initialize() { |
| 14 g_gl_context_key = gpu::ThreadLocalAlloc(); | 16 g_gl_context_key = gpu::ThreadLocalAlloc(); |
| 15 } | 17 } |
| 16 | 18 |
| 17 void Terminate() { | 19 void Terminate() { |
| 18 gpu::ThreadLocalFree(g_gl_context_key); | 20 gpu::ThreadLocalFree(g_gl_context_key); |
| 19 g_gl_context_key = 0; | 21 g_gl_context_key = 0; |
| 20 } | 22 } |
| 21 | 23 |
| 22 gpu::gles2::GLES2Implementation* GetGLContext() { | 24 gpu::gles2::GLES2Implementation* GetGLContext() { |
| 23 return static_cast<gpu::gles2::GLES2Implementation*>( | 25 return static_cast<gpu::gles2::GLES2Implementation*>( |
| 24 gpu::ThreadLocalGetValue(g_gl_context_key)); | 26 gpu::ThreadLocalGetValue(g_gl_context_key)); |
| 25 } | 27 } |
| 26 | 28 |
| 27 void SetGLContext(gpu::gles2::GLES2Implementation* context) { | 29 void SetGLContext(gpu::gles2::GLES2Implementation* context) { |
| 28 gpu::ThreadLocalSetValue(g_gl_context_key, context); | 30 gpu::ThreadLocalSetValue(g_gl_context_key, context); |
| 29 } | 31 } |
| 30 } // namespace gles2 | 32 } // namespace gles2 |
| 31 | 33 |
| 32 | 34 |
| 33 | 35 |
| 34 | 36 |
| OLD | NEW |