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

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10875077: Add UMA histogram to determine how often Stage3D could be used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: run on non-xp Created 8 years, 4 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 | « ppapi/shared_impl/ppapi_preferences.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index 36569266fbcc26a230ea6c32eafaa6ab587505c1..29d724b303be004b2eb1a929272e5beeeb4654f9 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -29,6 +29,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"
@@ -96,6 +97,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"
@@ -533,6 +535,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,
@@ -544,6 +577,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_));
« no previous file with comments | « ppapi/shared_impl/ppapi_preferences.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698