summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 22:06:22 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-18 22:06:22 +0000
commit84479325c4ccdecd2bddc2f257d436b66595aa10 (patch)
treecd91804f50e952a09f84c6bdf7f68bdb3dab4bc4 /ui
parente51eeb7307ea00ec6ef593d938a60f356e3a0882 (diff)
downloadchromium_src-84479325c4ccdecd2bddc2f257d436b66595aa10.zip
chromium_src-84479325c4ccdecd2bddc2f257d436b66595aa10.tar.gz
chromium_src-84479325c4ccdecd2bddc2f257d436b66595aa10.tar.bz2
linux: don't always print dlopen errors from LoadNativeLibrary
Instead, return them to the caller and let the caller decide whether the error is worth notifying the user about. BUG=79068 Review URL: http://codereview.chromium.org/6864020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@82008 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/gfx/gl/gl_implementation_linux.cc42
-rw-r--r--ui/gfx/gl/gl_implementation_mac.cc4
-rw-r--r--ui/gfx/gl/gl_implementation_win.cc8
3 files changed, 26 insertions, 28 deletions
diff --git a/ui/gfx/gl/gl_implementation_linux.cc b/ui/gfx/gl/gl_implementation_linux.cc
index 34069cf..834bb31 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>(
diff --git a/ui/gfx/gl/gl_implementation_mac.cc b/ui/gfx/gl/gl_implementation_mac.cc
index 00ed6bb..a8b3ddd 100644
--- a/ui/gfx/gl/gl_implementation_mac.cc
+++ b/ui/gfx/gl/gl_implementation_mac.cc
@@ -33,7 +33,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
// When using OSMesa, just use OSMesaGetProcAddress to find entry points.
base::NativeLibrary library = base::LoadNativeLibrary(
- module_path.Append("osmesa.so"));
+ module_path.Append("osmesa.so"), NULL);
if (!library) {
VLOG(1) << "osmesa.so not found";
return false;
@@ -59,7 +59,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
}
case kGLImplementationDesktopGL: {
base::NativeLibrary library = base::LoadNativeLibrary(
- FilePath(kOpenGLFrameworkPath));
+ FilePath(kOpenGLFrameworkPath), NULL);
if (!library) {
LOG(ERROR) << "OpenGL framework not found";
return false;
diff --git a/ui/gfx/gl/gl_implementation_win.cc b/ui/gfx/gl/gl_implementation_win.cc
index ee07cfc..9061bb3 100644
--- a/ui/gfx/gl/gl_implementation_win.cc
+++ b/ui/gfx/gl/gl_implementation_win.cc
@@ -43,7 +43,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
}
base::NativeLibrary library = base::LoadNativeLibrary(
- module_path.Append(L"osmesa.dll"));
+ module_path.Append(L"osmesa.dll"), NULL);
if (!library) {
VLOG(1) << "osmesa.dll not found";
return false;
@@ -76,7 +76,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
// the former and if there is another version of libglesv2.dll in the dll
// search path, it will get loaded.
base::NativeLibrary gles_library = base::LoadNativeLibrary(
- module_path.Append(L"libglesv2.dll"));
+ module_path.Append(L"libglesv2.dll"), NULL);
if (!gles_library) {
VLOG(1) << "libglesv2.dll not found";
return false;
@@ -85,7 +85,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
// When using EGL, first try eglGetProcAddress and then Windows
// GetProcAddress on both the EGL and GLES2 DLLs.
base::NativeLibrary egl_library = base::LoadNativeLibrary(
- module_path.Append(L"libegl.dll"));
+ module_path.Append(L"libegl.dll"), NULL);
if (!egl_library) {
VLOG(1) << "libegl.dll not found.";
base::UnloadNativeLibrary(gles_library);
@@ -121,7 +121,7 @@ bool InitializeGLBindings(GLImplementation implementation) {
// When using Windows OpenGL, first try wglGetProcAddress and then
// Windows GetProcAddress.
base::NativeLibrary library = base::LoadNativeLibrary(
- FilePath(L"opengl32.dll"));
+ FilePath(L"opengl32.dll"), NULL);
if (!library) {
VLOG(1) << "opengl32.dll not found";
return false;