Chromium Code Reviews| Index: base/native_library.h |
| diff --git a/base/native_library.h b/base/native_library.h |
| index d7513d0b050e181b4df913e276b39051aef5318f..eac24d0e70937a0ba741275ea0e97b2de8a2d83c 100644 |
| --- a/base/native_library.h |
| +++ b/base/native_library.h |
| @@ -8,6 +8,8 @@ |
| // This file defines a cross-platform "NativeLibrary" type which represents |
| // a loadable module. |
| +#include <iosfwd> |
| + |
| #include "base/base_export.h" |
| #include "base/compiler_specific.h" |
| #include "build/build_config.h" |
| @@ -50,11 +52,20 @@ typedef NativeLibraryStruct* NativeLibrary; |
| typedef void* NativeLibrary; |
| #endif // OS_* |
| +struct NativeLibraryLoadError { |
| +#if defined(OS_WIN) |
| + NativeLibraryLoadError() : code(0) {} |
| + DWORD code; |
| +#else |
| + std::string message; |
| +#endif // OS_WIN |
| +}; |
| + |
| // Loads a native library from disk. Release it with UnloadNativeLibrary when |
| // you're done. Returns NULL on failure. |
| -// If |error| is not NULL, it may be filled in with an error message on error. |
| +// If |error| is not NULL, it may be filled in on load error. |
| BASE_EXPORT NativeLibrary LoadNativeLibrary(const FilePath& library_path, |
| - std::string* error); |
| + NativeLibraryLoadError* error); |
| #if defined(OS_WIN) |
| // Loads a native library from disk. Release it with UnloadNativeLibrary when |
| @@ -79,6 +90,10 @@ BASE_EXPORT void* GetFunctionPointerFromNativeLibrary(NativeLibrary library, |
| // "mylib.dylib" on Mac. |
| BASE_EXPORT string16 GetNativeLibraryName(const string16& name); |
| +// Stream operator so NativeLibraryLoadError can be used in log statements. |
| +BASE_EXPORT std::ostream& operator<<(std::ostream& out, |
|
brettw
2014/03/24 17:21:25
The style guide permits operator<< for logging but
xhwang
2014/03/24 17:53:21
Done.
|
| + const NativeLibraryLoadError& error); |
| + |
| } // namespace base |
| #endif // BASE_NATIVE_LIBRARY_H_ |