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

Side by Side Diff: base/native_library_linux.cc

Issue 115896: Making the browser tests work on Unix (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "base/native_library.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/string_util.h"
11 12
12 namespace base { 13 namespace base {
13 14
14 // static 15 // static
15 NativeLibrary LoadNativeLibrary(const FilePath& library_path) { 16 NativeLibrary LoadNativeLibrary(const FilePath& library_path) {
16 void* dl = dlopen(library_path.value().c_str(), RTLD_LAZY|RTLD_DEEPBIND); 17 void* dl = dlopen(library_path.value().c_str(), RTLD_LAZY|RTLD_DEEPBIND);
17 if (!dl) 18 if (!dl)
18 NOTREACHED() << "dlopen failed: " << dlerror(); 19 NOTREACHED() << "dlopen failed: " << dlerror();
19 20
20 return dl; 21 return dl;
21 } 22 }
22 23
23 // static 24 // static
24 void UnloadNativeLibrary(NativeLibrary library) { 25 void UnloadNativeLibrary(NativeLibrary library) {
25 int ret = dlclose(library); 26 int ret = dlclose(library);
26 if (ret < 0) 27 if (ret < 0)
27 NOTREACHED() << "dlclose failed: " << dlerror(); 28 NOTREACHED() << "dlclose failed: " << dlerror();
28 } 29 }
29 30
30 // static 31 // static
31 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, 32 void* GetFunctionPointerFromNativeLibrary(NativeLibrary library,
32 NativeLibraryFunctionNameType name) { 33 const char* name) {
33 return dlsym(library, name); 34 return dlsym(library, name);
34 } 35 }
35 36
37 // static
38 string16 GetNativeLibraryName(const string16& name) {
39 return ASCIIToUTF16("lib") + name + ASCIIToUTF16(".so");
40 }
41
36 } // namespace base 42 } // namespace base
OLDNEW
« no previous file with comments | « base/native_library.h ('k') | base/native_library_mac.mm » ('j') | chrome/chrome.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698