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

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: 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 | « content/ppapi_plugin/ppapi_thread.h ('k') | content/zygote/zygote_main_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7a4e6e536c8129a055245af5940f47b4ebeaa02a 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,14 @@ 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;
+ base::NativeLibraryLoadError error;
library.Reset(base::LoadNativeLibrary(path, &error));
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.ToString() << ")";
ReportLoadResult(path, LOAD_FAILED);
+ // Report detailed reason for load failure.
+ ReportLoadErrorCode(path, error);
return;
}
@@ -502,15 +505,14 @@ void PpapiThread::SavePluginName(const base::FilePath& path) {
void PpapiThread::ReportLoadResult(const base::FilePath& path,
LoadResult result) {
DCHECK_LT(result, LOAD_RESULT_MAX);
-
- std::ostringstream histogram_name;
- histogram_name << "Plugin.Ppapi" << (is_broker_ ? "Broker" : "Plugin")
- << "LoadResult_" << path.BaseName().MaybeAsASCII();
+ std::string histogram_name = std::string("Plugin.Ppapi") +
+ (is_broker_ ? "Broker" : "Plugin") +
+ "LoadResult_" + path.BaseName().MaybeAsASCII();
// Note: This leaks memory, which is expected behavior.
base::HistogramBase* histogram =
base::LinearHistogram::FactoryGet(
- histogram_name.str(),
+ histogram_name,
1,
LOAD_RESULT_MAX,
LOAD_RESULT_MAX + 1,
@@ -519,4 +521,20 @@ void PpapiThread::ReportLoadResult(const base::FilePath& path,
histogram->Add(result);
}
+void PpapiThread::ReportLoadErrorCode(
+ const base::FilePath& path,
+ const base::NativeLibraryLoadError& error) {
+#if defined(OS_WIN)
+ // Only report load error code on Windows because that's the only platform
+ // that has a numerical error value.
+ std::string histogram_name =
+ std::string("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, error.code);
+#endif
+}
+
} // namespace content
« no previous file with comments | « content/ppapi_plugin/ppapi_thread.h ('k') | content/zygote/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698