| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // race in the bindings initialization. | 50 // race in the bindings initialization. |
| 51 #if (defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)) || defined(TOUCH_UI) | 51 #if (defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)) || defined(TOUCH_UI) |
| 52 base::LazyInstance<base::Lock, | 52 base::LazyInstance<base::Lock, |
| 53 base::LeakyLazyInstanceTraits<base::Lock> > | 53 base::LeakyLazyInstanceTraits<base::Lock> > |
| 54 g_lock(base::LINKER_INITIALIZED); | 54 g_lock(base::LINKER_INITIALIZED); |
| 55 #endif | 55 #endif |
| 56 | 56 |
| 57 } // namespace anonymous | 57 } // namespace anonymous |
| 58 | 58 |
| 59 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { | 59 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { |
| 60 #if !defined(USE_WAYLAND) |
| 61 impls->push_back(kGLImplementationOSMesaGL); |
| 60 impls->push_back(kGLImplementationDesktopGL); | 62 impls->push_back(kGLImplementationDesktopGL); |
| 63 #endif |
| 61 impls->push_back(kGLImplementationEGLGLES2); | 64 impls->push_back(kGLImplementationEGLGLES2); |
| 62 impls->push_back(kGLImplementationOSMesaGL); | |
| 63 } | 65 } |
| 64 | 66 |
| 65 bool InitializeGLBindings(GLImplementation implementation) { | 67 bool InitializeGLBindings(GLImplementation implementation) { |
| 66 #if (defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)) || defined(TOUCH_UI) | 68 #if (defined(TOOLKIT_VIEWS) && !defined(OS_CHROMEOS)) || defined(TOUCH_UI) |
| 67 base::AutoLock locked(g_lock.Get()); | 69 base::AutoLock locked(g_lock.Get()); |
| 68 #endif | 70 #endif |
| 69 // Prevent reinitialization with a different implementation. Once the gpu | 71 // Prevent reinitialization with a different implementation. Once the gpu |
| 70 // unit tests have initialized with kGLImplementationMock, we don't want to | 72 // unit tests have initialized with kGLImplementationMock, we don't want to |
| 71 // later switch to another GL implementation. | 73 // later switch to another GL implementation. |
| 72 if (GetGLImplementation() != kGLImplementationNone) | 74 if (GetGLImplementation() != kGLImplementationNone) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 return false; | 185 return false; |
| 184 } | 186 } |
| 185 | 187 |
| 186 | 188 |
| 187 return true; | 189 return true; |
| 188 } | 190 } |
| 189 | 191 |
| 190 bool InitializeGLExtensionBindings(GLImplementation implementation, | 192 bool InitializeGLExtensionBindings(GLImplementation implementation, |
| 191 GLContext* context) { | 193 GLContext* context) { |
| 192 switch (implementation) { | 194 switch (implementation) { |
| 195 #if !defined(USE_WAYLAND) |
| 193 case kGLImplementationOSMesaGL: | 196 case kGLImplementationOSMesaGL: |
| 194 InitializeGLExtensionBindingsGL(context); | 197 InitializeGLExtensionBindingsGL(context); |
| 195 InitializeGLExtensionBindingsOSMESA(context); | 198 InitializeGLExtensionBindingsOSMESA(context); |
| 196 break; | 199 break; |
| 197 case kGLImplementationDesktopGL: | 200 case kGLImplementationDesktopGL: |
| 198 InitializeGLExtensionBindingsGL(context); | 201 InitializeGLExtensionBindingsGL(context); |
| 199 InitializeGLExtensionBindingsGLX(context); | 202 InitializeGLExtensionBindingsGLX(context); |
| 200 break; | 203 break; |
| 204 #endif |
| 201 case kGLImplementationEGLGLES2: | 205 case kGLImplementationEGLGLES2: |
| 202 InitializeGLExtensionBindingsGL(context); | 206 InitializeGLExtensionBindingsGL(context); |
| 203 InitializeGLExtensionBindingsEGL(context); | 207 InitializeGLExtensionBindingsEGL(context); |
| 204 break; | 208 break; |
| 205 case kGLImplementationMockGL: | 209 case kGLImplementationMockGL: |
| 206 InitializeGLExtensionBindingsGL(context); | 210 InitializeGLExtensionBindingsGL(context); |
| 207 break; | 211 break; |
| 208 default: | 212 default: |
| 209 return false; | 213 return false; |
| 210 } | 214 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 227 #if !defined(USE_WAYLAND) | 231 #if !defined(USE_WAYLAND) |
| 228 ClearGLBindingsGLX(); | 232 ClearGLBindingsGLX(); |
| 229 ClearGLBindingsOSMESA(); | 233 ClearGLBindingsOSMESA(); |
| 230 #endif | 234 #endif |
| 231 SetGLImplementation(kGLImplementationNone); | 235 SetGLImplementation(kGLImplementationNone); |
| 232 | 236 |
| 233 UnloadGLNativeLibraries(); | 237 UnloadGLNativeLibraries(); |
| 234 } | 238 } |
| 235 | 239 |
| 236 } // namespace gfx | 240 } // namespace gfx |
| OLD | NEW |