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

Unified Diff: content/ppapi_plugin/ppapi_thread.cc

Issue 206713004: Report PPAPI plugin load error code to UMA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments addressed 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
Index: content/ppapi_plugin/ppapi_thread.cc
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc
index ea7431378aa124a1247a55ab2f098f31cbb209c3..689120858e4326c918fa4dd8b946178cae8a8682 100644
--- a/content/ppapi_plugin/ppapi_thread.cc
+++ b/content/ppapi_plugin/ppapi_thread.cc
@@ -11,6 +11,7 @@
#include "base/debug/crash_logging.h"
#include "base/logging.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/sparse_histogram.h"
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -269,12 +270,15 @@ void PpapiThread::OnLoadPlugin(const base::FilePath& path,
base::ScopedNativeLibrary library;
if (plugin_entry_points_.initialize_module == NULL) {
// Load the plugin from the specified library.
- std::string error;
- library.Reset(base::LoadNativeLibrary(path, &error));
+ std::string error_message;
+ uint32 error_code = 0;
+ library.Reset(base::LoadNativeLibrary(path, &error_message, &error_code));
if (!library.is_valid()) {
- LOG(ERROR) << "Failed to load Pepper module from "
- << path.value() << " (error: " << error << ")";
+ LOG(ERROR) << "Failed to load Pepper module from " << path.value()
+ << " (error: " << error_code << " - " << error_message << ")";
ReportLoadResult(path, LOAD_FAILED);
+ // Report detailed reason for load failure.
+ ReportLoadErrorCode(path, error_code);
return;
}
@@ -519,4 +523,15 @@ void PpapiThread::ReportLoadResult(const base::FilePath& path,
histogram->Add(result);
}
+void PpapiThread::ReportLoadErrorCode(const base::FilePath& path,
+ uint32 error_code) {
+ std::ostringstream histogram_name;
+ histogram_name << "Plugin.Ppapi" << (is_broker_ ? "Broker" : "Plugin")
+ << "LoadErrorCode_" << path.BaseName().MaybeAsASCII();
+
+ // For sparse histograms, we can use the macro, as it does not incorporate a
+ // static.
+ UMA_HISTOGRAM_SPARSE_SLOWLY(histogram_name.str(), error_code);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698