Index: gpu/command_buffer/client/gles2_lib.cc |
=================================================================== |
--- gpu/command_buffer/client/gles2_lib.cc (revision 37133) |
+++ gpu/command_buffer/client/gles2_lib.cc (working copy) |
@@ -3,11 +3,29 @@ |
// found in the LICENSE file. |
#include "gpu/command_buffer/client/gles2_lib.h" |
+#include "gpu/command_buffer/common/thread_local.h" |
namespace gles2 { |
+namespace { |
+gpu::ThreadLocalKey g_gl_context_key; |
+} // namespace anonymous |
-THREAD_LOCAL ::gpu::gles2::GLES2Implementation* g_gl_impl; |
+void Initialize() { |
+ g_gl_context_key = gpu::ThreadLocalAlloc(); |
+} |
+void Terminate() { |
+ gpu::ThreadLocalFree(g_gl_context_key); |
+} |
+ |
+gpu::gles2::GLES2Implementation* GetGLContext() { |
+ return static_cast<gpu::gles2::GLES2Implementation*>( |
+ gpu::ThreadLocalGetValue(g_gl_context_key)); |
+} |
+ |
+void SetGLContext(gpu::gles2::GLES2Implementation* context) { |
+ gpu::ThreadLocalSetValue(g_gl_context_key, context); |
+} |
} // namespace gles2 |