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

Side by Side Diff: base/native_library_mac.mm

Issue 206713004: Report PPAPI plugin load error code to UMA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include <mach-o/getsect.h> 8 #include <mach-o/getsect.h>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 25 matching lines...) Expand all
36 #else 36 #else
37 const section* section = getsectbynamefromheader( 37 const section* section = getsectbynamefromheader(
38 reinterpret_cast<const struct mach_header*>(info.dli_fbase), 38 reinterpret_cast<const struct mach_header*>(info.dli_fbase),
39 SEG_OBJC, "__image_info"); 39 SEG_OBJC, "__image_info");
40 #endif 40 #endif
41 return section == NULL ? OBJC_NOT_PRESENT : OBJC_PRESENT; 41 return section == NULL ? OBJC_NOT_PRESENT : OBJC_PRESENT;
42 } 42 }
43 43
44 // static 44 // static
45 NativeLibrary LoadNativeLibrary(const base::FilePath& library_path, 45 NativeLibrary LoadNativeLibrary(const base::FilePath& library_path,
46 std::string* error) { 46 std::string* /* error_message */,
xhwang 2014/03/20 21:40:03 This is tracked in http://crbug.com/353771
47 uint32* /* error_code */) {
47 // dlopen() etc. open the file off disk. 48 // dlopen() etc. open the file off disk.
48 if (library_path.Extension() == "dylib" || !DirectoryExists(library_path)) { 49 if (library_path.Extension() == "dylib" || !DirectoryExists(library_path)) {
49 void* dylib = dlopen(library_path.value().c_str(), RTLD_LAZY); 50 void* dylib = dlopen(library_path.value().c_str(), RTLD_LAZY);
50 if (!dylib) 51 if (!dylib)
51 return NULL; 52 return NULL;
52 NativeLibrary native_lib = new NativeLibraryStruct(); 53 NativeLibrary native_lib = new NativeLibraryStruct();
53 native_lib->type = DYNAMIC_LIB; 54 native_lib->type = DYNAMIC_LIB;
54 native_lib->dylib = dylib; 55 native_lib->dylib = dylib;
55 native_lib->objc_status = OBJC_UNKNOWN; 56 native_lib->objc_status = OBJC_UNKNOWN;
56 return native_lib; 57 return native_lib;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 117
117 return function_pointer; 118 return function_pointer;
118 } 119 }
119 120
120 // static 121 // static
121 string16 GetNativeLibraryName(const string16& name) { 122 string16 GetNativeLibraryName(const string16& name) {
122 return name + ASCIIToUTF16(".dylib"); 123 return name + ASCIIToUTF16(".dylib");
123 } 124 }
124 125
125 } // namespace base 126 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698