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

Unified Diff: chrome/plugin/chrome_content_plugin_client.cc

Issue 13548005: Add UMA reporting on failure to load ppapi plugins. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: status -> result Created 7 years, 8 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: chrome/plugin/chrome_content_plugin_client.cc
diff --git a/chrome/plugin/chrome_content_plugin_client.cc b/chrome/plugin/chrome_content_plugin_client.cc
index c6712ab1502ce6003537ef020cc091626fde878f..291bc71cb8f34ed69a489a79658f81f725479224 100644
--- a/chrome/plugin/chrome_content_plugin_client.cc
+++ b/chrome/plugin/chrome_content_plugin_client.cc
@@ -4,6 +4,12 @@
#include "chrome/plugin/chrome_content_plugin_client.h"
+#include <sstream>
+
+#include "base/metrics/histogram.h"
+#include "chrome/common/chrome_constants.h"
+#include "third_party/widevine/cdm/widevine_cdm_common.h"
+
#if defined(ENABLE_REMOTING)
#include "base/files/file_path.h"
#include "base/path_service.h"
@@ -14,8 +20,8 @@
#include "base/native_library.h"
#elif defined(OS_POSIX) && !defined(OS_MACOSX) && defined(USE_NSS)
#include "crypto/nss_util.h"
-#endif
-#endif
+#endif // defined(OS_WIN)
+#endif // defined(ENABLE_REMOTING)
#if defined(OS_MACOSX)
#include "base/mac/mac_util.h"
@@ -23,7 +29,7 @@
#include "base/strings/sys_string_conversions.h"
#include "grit/chromium_strings.h"
#include "ui/base/l10n/l10n_util.h"
-#endif
+#endif // defined(OS_MACOSX)
namespace chrome {
@@ -67,4 +73,36 @@ void ChromeContentPluginClient::PluginProcessStarted(
#endif
}
+static void ReportPluginLoadUMA(const std::string& plugin_name,
+ bool is_broker,
+ int result) {
+ DCHECK_LT(result, content::ContentPluginClient::LOAD_RESULT_MAX);
+
+ std::ostringstream histogram_name;
+ histogram_name << "Plugin." << (is_broker ? "Broker" : "Plugin")
+ << "LoadResult." << plugin_name;
+
+ // Note: This leaks memory, which is expected behavior.
+ base::HistogramBase* histogram =
+ base::LinearHistogram::FactoryGet(
+ histogram_name.str(),
+ 1,
+ content::ContentPluginClient::LOAD_RESULT_MAX,
+ content::ContentPluginClient::LOAD_RESULT_MAX + 1,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
+
+ histogram->Add(result);
+}
+
+void ChromeContentPluginClient::PluginLoaded(const base::FilePath& plugin_path,
+ bool is_broker,
+ PluginLoadResult result) {
+ base::FilePath::StringType plugin_name = plugin_path.BaseName().value();
+ if (plugin_name == kPepperFlashPluginFilename) {
+ ReportPluginLoadUMA("PepperFlash", is_broker, result);
+ } else if (plugin_name == kWidevineCdmPluginFileName) {
+ ReportPluginLoadUMA("WidevineCDM", is_broker, result);
+ }
+}
+
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698