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

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: Also report loading error for flash. 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
« no previous file with comments | « chrome/plugin/chrome_content_plugin_client.h ('k') | content/ppapi_plugin/ppapi_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..c4f25febb7acf9f759163b57b3f985ccf76b9e30 100644
--- a/chrome/plugin/chrome_content_plugin_client.cc
+++ b/chrome/plugin/chrome_content_plugin_client.cc
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/metrics/histogram.h"
+#include "chrome/common/chrome_constants.h"
#include "chrome/plugin/chrome_content_plugin_client.h"
+#include "third_party/widevine/cdm/widevine_cdm_common.h"
#if defined(ENABLE_REMOTING)
#include "base/files/file_path.h"
@@ -14,8 +17,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 +26,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 +70,29 @@ void ChromeContentPluginClient::PluginProcessStarted(
#endif
}
+// Reports plugin loading result through UMA. This macro can only be called
+// in function PluginLoaded.
+// |name| must be const string based on how UMA_HISTOGRAM_ENUMERATION works.
ddorwin 2013/04/09 01:44:11 You should also explain why this must be a macro f
xhwang 2013/04/09 03:59:42 Use FactoryGet following Ilya's suggestion as we d
+#define REPORT_PLUGIN_LOAD_UMA(name) \
+ do { \
+ if (!is_broker) { \
Ilya Sherman 2013/04/09 01:49:22 For readability's sake, please pass is_broker in a
xhwang 2013/04/09 03:59:42 Done.
+ UMA_HISTOGRAM_ENUMERATION("Plugin.PluginLoadResult."name, result, \
+ ContentPluginClient::LOAD_STATUS_MAX); \
+ } else { \
+ UMA_HISTOGRAM_ENUMERATION("Plugin.BrokerLoadResult."name, result, \
+ ContentPluginClient::LOAD_STATUS_MAX); \
+ } \
+ } while (0);
Ilya Sherman 2013/04/09 01:49:22 This is ok, but IMO it'd be cleaner to write a fun
xhwang 2013/04/09 03:59:42 Thanks! This is much better!
+
+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) {
+ REPORT_PLUGIN_LOAD_UMA("PepperFlash");
ddorwin 2013/04/09 01:44:11 pass result into your macro as if it was a functio
xhwang 2013/04/09 03:59:42 Done.
+ } else if (plugin_name == kWidevineCdmPluginFileName) {
+ REPORT_PLUGIN_LOAD_UMA("WidevineCDM");
+ }
+}
+
} // namespace chrome
« no previous file with comments | « chrome/plugin/chrome_content_plugin_client.h ('k') | content/ppapi_plugin/ppapi_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698