OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/native_library.h" | 5 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreFoundatio
n.framework/Headers/CFBase.h> |
6 | 6 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreFoundatio
n.framework/Headers/CFBundle.h> |
| 7 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreFoundatio
n.framework/Headers/CFString.h> |
| 8 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreFoundatio
n.framework/Headers/CFURL.h> |
| 9 #include </Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreServices.
framework/Headers/../Frameworks/CarbonCore.framework/Headers/MacTypes.h> |
7 #include <dlfcn.h> | 10 #include <dlfcn.h> |
| 11 #include <stdbool.h> |
| 12 #include <stddef.h> |
| 13 #include <string> |
8 | 14 |
9 #include "base/file_path.h" | 15 #include "base/file_path.h" |
10 #include "base/file_util.h" | 16 #include "base/file_util.h" |
11 #include "base/mac/scoped_cftyperef.h" | 17 #include "base/mac/scoped_cftyperef.h" |
12 #include "base/string_util.h" | 18 #include "base/native_library.h" |
13 #include "base/threading/thread_restrictions.h" | 19 #include "base/string16.h" |
14 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
15 | 21 |
16 namespace base { | 22 namespace base { |
17 | 23 |
18 // static | 24 // static |
19 NativeLibrary LoadNativeLibrary(const FilePath& library_path) { | 25 NativeLibrary LoadNativeLibrary(const FilePath& library_path) { |
20 // dlopen() etc. open the file off disk. | 26 // dlopen() etc. open the file off disk. |
21 if (library_path.Extension() == "dylib" || | 27 if (library_path.Extension() == "dylib" || |
22 !file_util::DirectoryExists(library_path)) { | 28 !file_util::DirectoryExists(library_path)) { |
23 void* dylib = dlopen(library_path.value().c_str(), RTLD_LAZY); | 29 void* dylib = dlopen(library_path.value().c_str(), RTLD_LAZY); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 76 } |
71 return dlsym(library->dylib, name); | 77 return dlsym(library->dylib, name); |
72 } | 78 } |
73 | 79 |
74 // static | 80 // static |
75 string16 GetNativeLibraryName(const string16& name) { | 81 string16 GetNativeLibraryName(const string16& name) { |
76 return name + ASCIIToUTF16(".dylib"); | 82 return name + ASCIIToUTF16(".dylib"); |
77 } | 83 } |
78 | 84 |
79 } // namespace base | 85 } // namespace base |
OLD | NEW |