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

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: make separate function, add comments 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..f835bb43a1431d2d063d7fa67bef61bed4f7ead9 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,33 @@ 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. This only tests
+ // on XP at the moment.
+#if defined(OS_WIN)
+ if (base::win::GetVersion() <= base::win::VERSION_XP) {
+ bool needs_gpu = false;
+
+ 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;
+ }
+ }
+ // The value of this histogram is 1 or 3 if 3D is not blacklisted on this
+ // card, and 2 or 3 if the content needs the GPU.
vangelis 2012/08/28 17:30:23 Maybe it would be more clear to enumerate the pote
+ UMA_HISTOGRAM_ENUMERATION("Flash.UsesGPU",
+ needs_gpu * 2 + prefs.is_webgl_supported, 4);
+ }
+#endif
+}
+
bool PluginInstance::Initialize(WebPluginContainer* container,
const std::vector<std::string>& arg_names,
const std::vector<std::string>& arg_values,
@@ -544,6 +573,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