diff options
Diffstat (limited to 'webkit/plugins/ppapi/ppapi_plugin_instance.cc')
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 66940e8..16f71c9 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -32,6 +32,7 @@ #include "ppapi/c/ppp_mouse_lock.h" #include "ppapi/c/private/pp_content_decryptor.h" #include "ppapi/c/private/ppp_instance_private.h" +#include "ppapi/shared_impl/ppapi_preferences.h" #include "ppapi/shared_impl/ppb_input_event_shared.h" #include "ppapi/shared_impl/ppb_url_util_shared.h" #include "ppapi/shared_impl/ppb_view_shared.h" @@ -99,6 +100,7 @@ #if defined(OS_WIN) #include "base/metrics/histogram.h" +#include "base/win/windows_version.h" #include "skia/ext/platform_canvas.h" #include "ui/gfx/codec/jpeg_codec.h" #include "ui/gfx/gdi_util.h" @@ -593,6 +595,37 @@ void PluginInstance::InstanceCrashed() { delegate()->PluginCrashed(this); } +static void SetGPUHistogram(const ::ppapi::Preferences& prefs, + const std::vector<std::string>& arg_names, + const std::vector<std::string>& arg_values) { + // Calculate a histogram to let us determine how likely people are to try to + // run Stage3D content on machines that have it blacklisted. +#if defined(OS_WIN) + bool needs_gpu = false; + bool is_xp = base::win::GetVersion() <= base::win::VERSION_XP; + + for (size_t i = 0; i < arg_names.size(); i++) { + if (arg_names[i] == "wmode") { + // In theory content other than Flash could have a "wmode" argument, + // but that's pretty unlikely. + if (arg_values[i] == "direct" || arg_values[i] == "gpu") + needs_gpu = true; + break; + } + } + // 0 : No 3D content and GPU is blacklisted + // 1 : No 3D content and GPU is not blacklisted + // 2 : 3D content but GPU is blacklisted + // 3 : 3D content and GPU is not blacklisted + // 4 : No 3D content and GPU is blacklisted on XP + // 5 : No 3D content and GPU is not blacklisted on XP + // 6 : 3D content but GPU is blacklisted on XP + // 7 : 3D content and GPU is not blacklisted on XP + UMA_HISTOGRAM_ENUMERATION("Flash.UsesGPU", + is_xp * 4 + needs_gpu * 2 + prefs.is_webgl_supported, 8); +#endif +} + bool PluginInstance::Initialize(WebPluginContainer* container, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, @@ -604,6 +637,8 @@ bool PluginInstance::Initialize(WebPluginContainer* container, container_->setIsAcceptingTouchEvents(IsAcceptingTouchEvents()); + SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values); + argn_ = arg_names; argv_ = arg_values; scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); |