Index: ui/gl/gl_implementation_nsl.cc |
diff --git a/ui/gl/gl_implementation_android.cc b/ui/gl/gl_implementation_nsl.cc |
similarity index 67% |
copy from ui/gl/gl_implementation_android.cc |
copy to ui/gl/gl_implementation_nsl.cc |
index d948c5782f86963d0d8151d0a0f8f6c643d1f3b8..3f91dc54a9a51775b9e2140bb38338e38b9eb742 100644 |
--- a/ui/gl/gl_implementation_android.cc |
+++ b/ui/gl/gl_implementation_nsl.cc |
@@ -8,6 +8,7 @@ |
#include "base/logging.h" |
#include "base/native_library.h" |
#include "base/path_service.h" |
+#include "ui/base/linux/native_surface_linux_factory.h" |
#include "ui/gl/gl_bindings.h" |
#include "ui/gl/gl_egl_api_implementation.h" |
#include "ui/gl/gl_gl_api_implementation.h" |
@@ -27,20 +28,6 @@ void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near, |
glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far)); |
} |
-base::NativeLibrary LoadLibrary(const base::FilePath& filename) { |
- std::string error; |
- base::NativeLibrary library = base::LoadNativeLibrary(filename, &error); |
- if (!library) { |
- DVLOG(1) << "Failed to load " << filename.MaybeAsASCII() << ": " << error; |
- return NULL; |
- } |
- return library; |
-} |
- |
-base::NativeLibrary LoadLibrary(const char* filename) { |
- return LoadLibrary(base::FilePath(filename)); |
-} |
- |
} // namespace |
void GetAllowedGLImplementations(std::vector<GLImplementation>* impls) { |
@@ -55,32 +42,10 @@ bool InitializeGLBindings(GLImplementation implementation) { |
return true; |
switch (implementation) { |
- case kGLImplementationEGLGLES2: { |
- base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so"); |
- if (!gles_library) |
- return false; |
- base::NativeLibrary egl_library = LoadLibrary("libEGL.so"); |
- if (!egl_library) { |
- base::UnloadNativeLibrary(gles_library); |
- return false; |
- } |
- |
- GLGetProcAddressProc get_proc_address = |
- reinterpret_cast<GLGetProcAddressProc>( |
- base::GetFunctionPointerFromNativeLibrary( |
- egl_library, "eglGetProcAddress")); |
- if (!get_proc_address) { |
- LOG(ERROR) << "eglGetProcAddress not found."; |
- base::UnloadNativeLibrary(egl_library); |
- base::UnloadNativeLibrary(gles_library); |
+ case kGLImplementationEGLGLES2: |
+ if (!ui::NativeSurfaceLinuxFactory::GetInstance()->LoadEGLGLES2Bindings()) |
return false; |
- } |
- |
- SetGLGetProcAddressProc(get_proc_address); |
- AddGLNativeLibrary(egl_library); |
- AddGLNativeLibrary(gles_library); |
SetGLImplementation(kGLImplementationEGLGLES2); |
- |
InitializeGLBindingsGL(); |
InitializeGLBindingsEGL(); |
@@ -89,7 +54,6 @@ bool InitializeGLBindings(GLImplementation implementation) { |
::gfx::g_driver_gl.fn.glClearDepthFn = MarshalClearDepthToClearDepthf; |
::gfx::g_driver_gl.fn.glDepthRangeFn = MarshalDepthRangeToDepthRangef; |
break; |
- } |
case kGLImplementationMockGL: { |
SetGLGetProcAddressProc(GetMockGLProcAddress); |
SetGLImplementation(kGLImplementationMockGL); |
@@ -97,7 +61,8 @@ bool InitializeGLBindings(GLImplementation implementation) { |
break; |
} |
default: |
- NOTIMPLEMENTED() << "InitializeGLBindings on Android"; |
+ NOTIMPLEMENTED() |
+ << "Unsupported GL type for NativeSurfaceLinux GL implementation"; |
return false; |
} |
@@ -128,7 +93,6 @@ void ClearGLBindings() { |
ClearGLBindingsEGL(); |
ClearGLBindingsGL(); |
SetGLImplementation(kGLImplementationNone); |
- |
UnloadGLNativeLibraries(); |
} |