| 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
|
|
|