summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 15:48:28 +0000
committerjbauman@chromium.org <jbauman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-29 15:48:28 +0000
commit536769a6137dacc0a60480c62f042f9ecc2478dc (patch)
treefa2acfb9212a1e0fe4e16d79853534486369f7a8 /webkit
parent2fc76b4710ecc086a57d1e624f903aa9dc15b1d2 (diff)
downloadchromium_src-536769a6137dacc0a60480c62f042f9ecc2478dc.zip
chromium_src-536769a6137dacc0a60480c62f042f9ecc2478dc.tar.gz
chromium_src-536769a6137dacc0a60480c62f042f9ecc2478dc.tar.bz2
Add UMA histogram to determine how often Stage3D could be used.
BUG= Review URL: https://chromiumcodereview.appspot.com/10875077 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@153887 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc35
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_));