summaryrefslogtreecommitdiffstats
path: root/content/browser/plugin_service_impl.cc
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-28 02:48:33 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-28 02:48:33 +0000
commitfd8d8d6cab072673afc99779df2b214a3e3f3f7d (patch)
tree69125de947851953c9ac6d86ff3f5c4928635d69 /content/browser/plugin_service_impl.cc
parent8b0f8255da1adf1f7275427e709a49c1689a079e (diff)
downloadchromium_src-fd8d8d6cab072673afc99779df2b214a3e3f3f7d.zip
chromium_src-fd8d8d6cab072673afc99779df2b214a3e3f3f7d.tar.gz
chromium_src-fd8d8d6cab072673afc99779df2b214a3e3f3f7d.tar.bz2
Record stats on Chrome users running PPAPI Flash vs NPAPI Flash.
- Plugin.FlashUsage: Number of browser processes that start at least one NPAPI/PPAPI Flash process during their lifetime. BUG=None TEST=None Review URL: https://chromiumcodereview.appspot.com/12319137 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185124 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/plugin_service_impl.cc')
-rw-r--r--content/browser/plugin_service_impl.cc42
1 files changed, 42 insertions, 0 deletions
diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc
index e3dcdd1..4ae318a 100644
--- a/content/browser/plugin_service_impl.cc
+++ b/content/browser/plugin_service_impl.cc
@@ -10,6 +10,7 @@
#include "base/files/file_path.h"
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
+#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/synchronization/waitable_event.h"
@@ -31,6 +32,7 @@
#include "content/public/common/process_type.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/npapi/plugin_utils.h"
+#include "webkit/plugins/plugin_constants.h"
#include "webkit/plugins/webplugininfo.h"
#if defined(OS_WIN)
@@ -48,6 +50,19 @@ using ::base::FilePathWatcher;
namespace content {
namespace {
+// This enum is used to collect Flash usage data.
+enum FlashUsage {
+ // Number of browser processes that have started at least one NPAPI Flash
+ // process during their lifetime.
+ START_NPAPI_FLASH_AT_LEAST_ONCE,
+ // Number of browser processes that have started at least one PPAPI Flash
+ // process during their lifetime.
+ START_PPAPI_FLASH_AT_LEAST_ONCE,
+ // Total number of browser processes.
+ TOTAL_BROWSER_PROCESSES,
+ FLASH_USAGE_ENUM_COUNT
+};
+
bool LoadPluginListInProcess() {
#if defined(OS_WIN)
return true;
@@ -121,6 +136,15 @@ PluginServiceImpl* PluginServiceImpl::GetInstance() {
PluginServiceImpl::PluginServiceImpl()
: plugin_list_(NULL), filter_(NULL) {
+ // Collect the total number of browser processes (which create
+ // PluginServiceImpl objects, to be precise). The number is used to normalize
+ // the number of processes which start at least one NPAPI/PPAPI Flash process.
+ static bool counted = false;
+ if (!counted) {
+ counted = true;
+ UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage", TOTAL_BROWSER_PROCESSES,
+ FLASH_USAGE_ENUM_COUNT);
+ }
}
PluginServiceImpl::~PluginServiceImpl() {
@@ -282,6 +306,15 @@ PluginProcessHost* PluginServiceImpl::FindOrStartNpapiPluginProcess(
return NULL;
}
+ // Record when NPAPI Flash process is started for the first time.
+ static bool counted = false;
+ if (!counted && UTF16ToUTF8(info.name) == kFlashPluginName) {
+ counted = true;
+ UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage",
+ START_NPAPI_FLASH_AT_LEAST_ONCE,
+ FLASH_USAGE_ENUM_COUNT);
+ }
+
// This plugin isn't loaded by any plugin process, so create a new process.
scoped_ptr<PluginProcessHost> new_host(new PluginProcessHost());
if (!new_host->Init(info)) {
@@ -311,6 +344,15 @@ PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiPluginProcess(
if (!info)
return NULL;
+ // Record when PPAPI Flash process is started for the first time.
+ static bool counted = false;
+ if (!counted && info->name == kFlashPluginName) {
+ counted = true;
+ UMA_HISTOGRAM_ENUMERATION("Plugin.FlashUsage",
+ START_PPAPI_FLASH_AT_LEAST_ONCE,
+ FLASH_USAGE_ENUM_COUNT);
+ }
+
// This plugin isn't loaded by any plugin process, so create a new process.
return PpapiPluginProcessHost::CreatePluginHost(
*info, profile_data_directory,