Chromium Code Reviews| 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..14eac508fb487734c5dc048fb1cdb058d9ab0e6f 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 << ")"; |
| 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,18 @@ void PpapiThread::ReportLoadResult(const base::FilePath& path, |
| histogram->Add(result); |
| } |
| +void PpapiThread::ReportLoadErrorCode( |
|
ddorwin
2014/03/21 22:47:01
Maybe comment that this is only reported on Window
xhwang
2014/03/21 23:02:04
Done.
|
| + const base::FilePath& path, |
| + const base::NativeLibraryLoadError& error) { |
| +#if defined(OS_WIN) |
| + 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 |