diff options
author | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 04:51:26 +0000 |
---|---|---|
committer | sehr@google.com <sehr@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-05 04:51:26 +0000 |
commit | 5ce3da1ef045e25ef4c34cfc925fb8a48ad2e87c (patch) | |
tree | ccb5236c081167929e57ad6f31c2c2b99ef18cff /gpu | |
parent | 28375ae7d27179af48386d37e78ca47a2563e0d0 (diff) | |
download | chromium_src-5ce3da1ef045e25ef4c34cfc925fb8a48ad2e87c.zip chromium_src-5ce3da1ef045e25ef4c34cfc925fb8a48ad2e87c.tar.gz chromium_src-5ce3da1ef045e25ef4c34cfc925fb8a48ad2e87c.tar.bz2 |
PGL was relying on pthread_key_create not returning zero, which does not
seem to conform to the documented interface. I have added an allocated
flag. This is needed to fix NaCl PGL.
Review URL: http://codereview.chromium.org/576002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38186 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
-rw-r--r-- | gpu/pgl/pgl.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/gpu/pgl/pgl.cc b/gpu/pgl/pgl.cc index 68a074f..d357fe2 100644 --- a/gpu/pgl/pgl.cc +++ b/gpu/pgl/pgl.cc @@ -51,6 +51,7 @@ class PGLContextImpl { }; gpu::ThreadLocalKey g_pgl_context_key; +bool g_pgl_context_key_allocated = false; PGLContextImpl::PGLContextImpl(NPP npp, NPDevice* device, @@ -110,7 +111,7 @@ void PGLContextImpl::Destroy() { } PGLBoolean PGLContextImpl::MakeCurrent(PGLContextImpl* pgl_context) { - if (!g_pgl_context_key) + if (!g_pgl_context_key_allocated) return PGL_FALSE; gpu::ThreadLocalSetValue(g_pgl_context_key, pgl_context); @@ -157,19 +158,21 @@ PGLInt PGLContextImpl::GetError() { extern "C" { PGLBoolean pglInitialize() { - if (g_pgl_context_key) + if (g_pgl_context_key_allocated) return PGL_TRUE; gles2::Initialize(); g_pgl_context_key = gpu::ThreadLocalAlloc(); + g_pgl_context_key_allocated = true; return PGL_TRUE; } PGLBoolean pglTerminate() { - if (!g_pgl_context_key) + if (!g_pgl_context_key_allocated) return PGL_TRUE; gpu::ThreadLocalFree(g_pgl_context_key); + g_pgl_context_key_allocated = false; g_pgl_context_key = 0; gles2::Terminate(); @@ -179,7 +182,7 @@ PGLBoolean pglTerminate() { PGLContext pglCreateContext(NPP npp, NPDevice* device, NPDeviceContext3D* device_context) { - if (!g_pgl_context_key) + if (!g_pgl_context_key_allocated) return NULL; PGLContextImpl* pgl_context = new PGLContextImpl( @@ -197,7 +200,7 @@ PGLBoolean pglMakeCurrent(PGLContext pgl_context) { } PGLContext pglGetCurrentContext(void) { - if (!g_pgl_context_key) + if (!g_pgl_context_key_allocated) return NULL; return static_cast<PGLContext>(gpu::ThreadLocalGetValue(g_pgl_context_key)); @@ -213,7 +216,7 @@ PGLBoolean pglSwapBuffers(void) { } PGLBoolean pglDestroyContext(PGLContext pgl_context) { - if (!g_pgl_context_key) + if (!g_pgl_context_key_allocated) return PGL_FALSE; if (!pgl_context) |