| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/base_paths.h" | 5 #include "base/base_paths.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/native_library.h" | 9 #include "base/native_library.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } // namespace | 45 } // namespace |
| 46 | 46 |
| 47 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { | 47 void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { |
| 48 impls->push_back(kGLImplementationEGLGLES2); | 48 impls->push_back(kGLImplementationEGLGLES2); |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool InitializeStaticGLBindings(GLImplementation implementation) { | 51 bool InitializeStaticGLBindings(GLImplementation implementation) { |
| 52 // Prevent reinitialization with a different implementation. Once the gpu | 52 // Prevent reinitialization with a different implementation. Once the gpu |
| 53 // unit tests have initialized with kGLImplementationMock, we don't want to | 53 // unit tests have initialized with kGLImplementationMock, we don't want to |
| 54 // later switch to another GL implementation. | 54 // later switch to another GL implementation. |
| 55 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); | 55 if (GetGLImplementation() != kGLImplementationNone) |
| 56 return true; |
| 56 | 57 |
| 57 switch (implementation) { | 58 switch (implementation) { |
| 58 case kGLImplementationEGLGLES2: { | 59 case kGLImplementationEGLGLES2: { |
| 59 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); | 60 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); |
| 60 if (!gles_library) | 61 if (!gles_library) |
| 61 return false; | 62 return false; |
| 62 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); | 63 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); |
| 63 if (!egl_library) { | 64 if (!egl_library) { |
| 64 base::UnloadNativeLibrary(gles_library); | 65 base::UnloadNativeLibrary(gles_library); |
| 65 return false; | 66 return false; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 switch (GetGLImplementation()) { | 144 switch (GetGLImplementation()) { |
| 144 case kGLImplementationEGLGLES2: | 145 case kGLImplementationEGLGLES2: |
| 145 return GetGLWindowSystemBindingInfoEGL(info); | 146 return GetGLWindowSystemBindingInfoEGL(info); |
| 146 default: | 147 default: |
| 147 return false; | 148 return false; |
| 148 } | 149 } |
| 149 return false; | 150 return false; |
| 150 } | 151 } |
| 151 | 152 |
| 152 } // namespace gfx | 153 } // namespace gfx |
| OLD | NEW |