diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 01:59:09 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-25 01:59:09 +0000 |
commit | 0f99844cb63471f828fb62a5105d07aaef63ec54 (patch) | |
tree | 8208b8f75342a68a7023980ff6245502b9cd4f16 /content/ppapi_plugin/ppapi_thread.cc | |
parent | 4912961802e33de08bf6e6f9bbfe89bece472b70 (diff) | |
download | chromium_src-0f99844cb63471f828fb62a5105d07aaef63ec54.zip chromium_src-0f99844cb63471f828fb62a5105d07aaef63ec54.tar.gz chromium_src-0f99844cb63471f828fb62a5105d07aaef63ec54.tar.bz2 |
Report PPAPI plugin load error code to UMA.
TBR=sky@chrmium.org
BUG=353886
Review URL: https://codereview.chromium.org/206713004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259091 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/ppapi_plugin/ppapi_thread.cc')
-rw-r--r-- | content/ppapi_plugin/ppapi_thread.cc | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/content/ppapi_plugin/ppapi_thread.cc b/content/ppapi_plugin/ppapi_thread.cc index ea74313..7a4e6e536 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 |