diff options
Diffstat (limited to 'content/browser/plugin_service_impl.cc')
-rw-r--r-- | content/browser/plugin_service_impl.cc | 42 |
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, |