Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Unified Diff: gpu/command_buffer/client/program_info_manager.cc

Issue 9918027: Make ShareGroup thread safe (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add id==0 check Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_autogen.h ('k') | gpu/command_buffer/client/share_group.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation_autogen.h ('k') | gpu/command_buffer/client/share_group.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698