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

Unified Diff: base/native_library.h

Issue 206713004: Report PPAPI plugin load error code to UMA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make NativeLibraryLoadError a class. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/native_library_mac.mm » ('j') | content/ppapi_plugin/ppapi_thread.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/native_library.h
diff --git a/base/native_library.h b/base/native_library.h
index d7513d0b050e181b4df913e276b39051aef5318f..f68bb6f921c39920b8ee8d5aff925335ebb37ddb 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() : error_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,
+ const NativeLibraryLoadError& error);
+
} // namespace base
#endif // BASE_NATIVE_LIBRARY_H_
« no previous file with comments | « no previous file | base/native_library_mac.mm » ('j') | content/ppapi_plugin/ppapi_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698