Index: ui/gfx/gl/gl_implementation_linux.cc |
diff --git a/ui/gfx/gl/gl_implementation_linux.cc b/ui/gfx/gl/gl_implementation_linux.cc |
index 97e30877bc4ad49fe35958f56c8a366dc0975a42..bf79b1bc19ead5fae529e26418778da477383601 100644 |
--- a/ui/gfx/gl/gl_implementation_linux.cc |
+++ b/ui/gfx/gl/gl_implementation_linux.cc |
@@ -10,6 +10,7 @@ |
#include "base/logging.h" |
#include "base/native_library.h" |
#include "base/path_service.h" |
+#include "base/synchronization/lock.h" |
#include "ui/gfx/gl/gl_bindings.h" |
#include "ui/gfx/gl/gl_implementation.h" |
@@ -43,9 +44,18 @@ base::NativeLibrary LoadLibrary(const char* filename) { |
return LoadLibrary(FilePath(filename)); |
} |
+// TODO(backer): Find a more principled (less heavy handed) way to prevent a |
+// race in the bindings initialization. |
+#if (defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)) || defined(TOUCH_UI) |
+base::Lock g_lock; |
jam
2011/08/25 20:23:33
this goes against the chromium/google style guide:
|
+#endif |
+ |
} // namespace anonymous |
bool InitializeGLBindings(GLImplementation implementation) { |
+#if (defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)) || defined(TOUCH_UI) |
+ base::AutoLock locked(g_lock); |
+#endif |
// Prevent reinitialization with a different implementation. Once the gpu |
// unit tests have initialized with kGLImplementationMock, we don't want to |
// later switch to another GL implementation. |