Index: gpu/command_buffer/client/program_info_manager.cc |
diff --git a/gpu/command_buffer/client/program_info_manager.cc b/gpu/command_buffer/client/program_info_manager.cc |
index 57a037d3256f4420196bb939fc8d196adac03407..63c4a181527811a42e2df2bd7dab525a79660449 100644 |
--- a/gpu/command_buffer/client/program_info_manager.cc |
+++ b/gpu/command_buffer/client/program_info_manager.cc |
@@ -3,6 +3,7 @@ |
// found in the LICENSE file. |
#include "../client/program_info_manager.h" |
+#include "../client/atomicops.h" |
#include "../client/gles2_implementation.h" |
#include <map> |
@@ -193,6 +194,8 @@ class CachedProgramInfoManager : public ProgramInfoManager { |
typedef std::map<GLuint, ProgramInfo> ProgramInfoMap; |
ProgramInfoMap program_infos_; |
+ |
+ mutable Lock lock_; |
}; |
CachedProgramInfoManager::ProgramInfo::UniformInfo::UniformInfo( |
@@ -372,6 +375,7 @@ CachedProgramInfoManager::ProgramInfo* |
} |
void CachedProgramInfoManager::CreateInfo(GLuint program) { |
+ AutoLock auto_lock(lock_); |
DeleteInfo(program); |
std::pair<ProgramInfoMap::iterator, bool> result = |
program_infos_.insert(std::make_pair(program, ProgramInfo())); |
@@ -385,6 +389,7 @@ void CachedProgramInfoManager::DeleteInfo(GLuint program) { |
bool CachedProgramInfoManager::GetProgramiv( |
GLES2Implementation* gl, GLuint program, GLenum pname, GLint* params) { |
+ AutoLock auto_lock(lock_); |
ProgramInfo* info = GetProgramInfo(gl, program); |
if (!info) { |
return false; |
@@ -394,6 +399,7 @@ bool CachedProgramInfoManager::GetProgramiv( |
GLint CachedProgramInfoManager::GetAttribLocation( |
GLES2Implementation* gl, GLuint program, const char* name) { |
+ AutoLock auto_lock(lock_); |
ProgramInfo* info = GetProgramInfo(gl, program); |
if (info) { |
return info->GetAttribLocation(name); |
@@ -403,6 +409,7 @@ GLint CachedProgramInfoManager::GetAttribLocation( |
GLint CachedProgramInfoManager::GetUniformLocation( |
GLES2Implementation* gl, GLuint program, const char* name) { |
+ AutoLock auto_lock(lock_); |
ProgramInfo* info = GetProgramInfo(gl, program); |
if (info) { |
return info->GetUniformLocation(name); |
@@ -414,6 +421,7 @@ bool CachedProgramInfoManager::GetActiveAttrib( |
GLES2Implementation* gl, |
GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, |
GLint* size, GLenum* type, char* name) { |
+ AutoLock auto_lock(lock_); |
ProgramInfo* info = GetProgramInfo(gl, program); |
if (info) { |
const ProgramInfo::VertexAttribInfo* attrib_info = |
@@ -448,6 +456,7 @@ bool CachedProgramInfoManager::GetActiveUniform( |
GLES2Implementation* gl, |
GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, |
GLint* size, GLenum* type, char* name) { |
+ AutoLock auto_lock(lock_); |
ProgramInfo* info = GetProgramInfo(gl, program); |
if (info) { |
const ProgramInfo::UniformInfo* uniform_info = info->GetUniformInfo(index); |