summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/base_paths_mac.mm21
-rw-r--r--chrome/chrome_exe.gypi2
-rw-r--r--ui/gfx/gl/gl_implementation_mac.cc4
3 files changed, 23 insertions, 4 deletions
diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm
index ec1398b..90a274c 100644
--- a/base/base_paths_mac.mm
+++ b/base/base_paths_mac.mm
@@ -1,9 +1,10 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/base_paths_mac.h"
+#include <dlfcn.h>
#import <Foundation/Foundation.h>
#include <mach-o/dyld.h>
@@ -37,6 +38,19 @@ bool GetNSExecutablePath(FilePath* path) {
return true;
}
+// Returns true if the module for |address| is found. |path| will contain
+// the path to the module. Note that |path| may not be absolute.
+bool GetModulePathForAddress(FilePath* path,
+ const void* address) WARN_UNUSED_RESULT;
+
+bool GetModulePathForAddress(FilePath* path, const void* address) {
+ Dl_info info;
+ if (dladdr(address, &info) == 0)
+ return false;
+ *path = FilePath(info.dli_fname);
+ return true;
+}
+
} // namespace
namespace base {
@@ -44,9 +58,10 @@ namespace base {
bool PathProviderMac(int key, FilePath* result) {
switch (key) {
case base::FILE_EXE:
- case base::FILE_MODULE: {
return GetNSExecutablePath(result);
- }
+ case base::FILE_MODULE:
+ return GetModulePathForAddress(result,
+ reinterpret_cast<const void*>(&base::PathProviderMac));
case base::DIR_CACHE:
return base::mac::GetUserDirectory(NSCachesDirectory, result);
case base::DIR_APP_DATA:
diff --git a/chrome/chrome_exe.gypi b/chrome/chrome_exe.gypi
index a11d90b..c14b0a0 100644
--- a/chrome/chrome_exe.gypi
+++ b/chrome/chrome_exe.gypi
@@ -484,7 +484,7 @@
'conditions': [
['OS=="mac"', {
'copies': [{
- 'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Versions/<(version_full)/<(mac_product_name) Helper.app/Contents/MacOS/',
+ 'destination': '<(PRODUCT_DIR)/<(mac_product_name).app/Contents/Versions/<(version_full)/<(mac_product_name) Framework.framework/Libraries/',
'files': ['<(PRODUCT_DIR)/osmesa.so'],
}],
}],
diff --git a/ui/gfx/gl/gl_implementation_mac.cc b/ui/gfx/gl/gl_implementation_mac.cc
index a8b3ddd..351bc11 100644
--- a/ui/gfx/gl/gl_implementation_mac.cc
+++ b/ui/gfx/gl/gl_implementation_mac.cc
@@ -31,6 +31,10 @@ bool InitializeGLBindings(GLImplementation implementation) {
return false;
}
+ // osmesa.so is located in:
+ // Contents/Versions/<vers>/Chromium Framework.framework/Libraries
+ module_path = module_path.DirName().Append("Libraries");
+
// When using OSMesa, just use OSMesaGetProcAddress to find entry points.
base::NativeLibrary library = base::LoadNativeLibrary(
module_path.Append("osmesa.so"), NULL);