Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1015)

Unified Diff: ui/gfx/gl/gl_implementation_linux.cc

Issue 6864020: linux: don't always print dlopen errors from LoadNativeLibrary (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: owners Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/http_auth_gssapi_posix.cc ('k') | ui/gfx/gl/gl_implementation_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34069cf63b701c26d710c2ba87a1d3ebf936061a..834bb31caed1853ccdb658aabe0f24d54a54331e 100644
--- a/ui/gfx/gl/gl_implementation_linux.cc
+++ b/ui/gfx/gl/gl_implementation_linux.cc
@@ -27,6 +27,18 @@ void GL_BINDING_CALL MarshalDepthRangeToDepthRangef(GLclampd z_near,
glDepthRangef(static_cast<GLclampf>(z_near), static_cast<GLclampf>(z_far));
}
+// Load a library, printing an error message on failure.
+base::NativeLibrary LoadLibrary(const char* filename) {
+ std::string error;
+ base::NativeLibrary library = base::LoadNativeLibrary(FilePath(filename),
+ &error);
+ if (!library) {
+ VLOG(1) << "Failed to load " << filename << ": " << error;
+ return NULL;
+ }
+ return library;
+}
+
} // namespace anonymous
bool InitializeGLBindings(GLImplementation implementation) {
@@ -44,12 +56,9 @@ bool InitializeGLBindings(GLImplementation implementation) {
return false;
}
- base::NativeLibrary library = base::LoadNativeLibrary(
- module_path.Append("libosmesa.so"));
- if (!library) {
- VLOG(1) << "libosmesa.so not found";
+ base::NativeLibrary library = LoadLibrary("libosmesa.so");
+ if (!library)
return false;
- }
GLGetProcAddressProc get_proc_address =
reinterpret_cast<GLGetProcAddressProc>(
@@ -70,12 +79,9 @@ bool InitializeGLBindings(GLImplementation implementation) {
break;
}
case kGLImplementationDesktopGL: {
- base::NativeLibrary library = base::LoadNativeLibrary(
- FilePath("libGL.so.1"));
- if (!library) {
- VLOG(1) << "libGL.so.1 not found.";
+ base::NativeLibrary library = LoadLibrary("libGL.so.1");
+ if (!library)
return false;
- }
GLGetProcAddressProc get_proc_address =
reinterpret_cast<GLGetProcAddressProc>(
@@ -96,20 +102,12 @@ bool InitializeGLBindings(GLImplementation implementation) {
break;
}
case kGLImplementationEGLGLES2: {
- base::NativeLibrary gles_library = base::LoadNativeLibrary(
- FilePath("libGLESv2.so"));
- if (!gles_library) {
- VLOG(1) << "libGLESv2.so not found";
+ base::NativeLibrary gles_library = LoadLibrary("libGLESv2.so");
+ if (!gles_library)
return false;
- }
-
- base::NativeLibrary egl_library = base::LoadNativeLibrary(
- FilePath("libEGL.so"));
- if (!egl_library) {
- VLOG(1) << "libEGL.so not found";
- base::UnloadNativeLibrary(gles_library);
+ base::NativeLibrary egl_library = LoadLibrary("libEGL.so");
+ if (!egl_library)
return false;
- }
GLGetProcAddressProc get_proc_address =
reinterpret_cast<GLGetProcAddressProc>(
« no previous file with comments | « net/http/http_auth_gssapi_posix.cc ('k') | ui/gfx/gl/gl_implementation_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698