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

Unified Diff: base/native_library_win.cc

Issue 206713004: Report PPAPI plugin load error code to UMA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: BASE_EXPORT 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 | « base/native_library_posix.cc ('k') | chrome/browser/load_library_perf_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/native_library_win.cc
diff --git a/base/native_library_win.cc b/base/native_library_win.cc
index bcea485a1d10582016622738f1081fde471cd567..43528b977e477dc402fa3843d22bc441cec4ea50 100644
--- a/base/native_library_win.cc
+++ b/base/native_library_win.cc
@@ -15,9 +15,11 @@ namespace base {
typedef HMODULE (WINAPI* LoadLibraryFunction)(const wchar_t* file_name);
+namespace {
+
NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path,
LoadLibraryFunction load_library_api,
- std::string* error) {
+ NativeLibraryLoadError* error) {
// LoadLibrary() opens the file off disk.
ThreadRestrictions::AssertIOAllowed();
@@ -36,8 +38,7 @@ NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path,
HMODULE module = (*load_library_api)(library_path.value().c_str());
if (!module && error) {
// GetLastError() needs to be called immediately after |load_library_api|.
- DWORD last_error = GetLastError();
- *error = StringPrintf("%u", last_error);
+ error->code = GetLastError();
}
if (restore_directory)
@@ -46,9 +47,15 @@ NativeLibrary LoadNativeLibraryHelper(const FilePath& library_path,
return module;
}
+} // namespace
+
+std::string NativeLibraryLoadError::ToString() const {
+ return StringPrintf("%u", code);
+}
+
// static
NativeLibrary LoadNativeLibrary(const FilePath& library_path,
- std::string* error) {
+ NativeLibraryLoadError* error) {
return LoadNativeLibraryHelper(library_path, LoadLibraryW, error);
}
« no previous file with comments | « base/native_library_posix.cc ('k') | chrome/browser/load_library_perf_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698