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 if (GetGLImplementation() != kGLImplementationNone) | 55 DCHECK_EQ(kGLImplementationNone, GetGLImplementation()); |
56 return true; | |
57 | 56 |
58 switch (implementation) { | 57 switch (implementation) { |
59 case kGLImplementationEGLGLES2: { | 58 case kGLImplementationEGLGLES2: { |
60 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); | 59 base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); |
61 if (!gles_library) | 60 if (!gles_library) |
62 return false; | 61 return false; |
63 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); | 62 base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); |
64 if (!egl_library) { | 63 if (!egl_library) { |
65 base::UnloadNativeLibrary(gles_library); | 64 base::UnloadNativeLibrary(gles_library); |
66 return false; | 65 return false; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 switch (GetGLImplementation()) { | 143 switch (GetGLImplementation()) { |
145 case kGLImplementationEGLGLES2: | 144 case kGLImplementationEGLGLES2: |
146 return GetGLWindowSystemBindingInfoEGL(info); | 145 return GetGLWindowSystemBindingInfoEGL(info); |
147 default: | 146 default: |
148 return false; | 147 return false; |
149 } | 148 } |
150 return false; | 149 return false; |
151 } | 150 } |
152 | 151 |
153 } // namespace gfx | 152 } // namespace gfx |
OLD | NEW |