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

Unified Diff: chrome/browser/gpu/gpu_mode_manager.cc

Issue 14113002: Add UMA stats for GPU feature disable checkbox. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 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 | « no previous file | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gpu/gpu_mode_manager.cc
===================================================================
--- chrome/browser/gpu/gpu_mode_manager.cc (revision 193279)
+++ chrome/browser/gpu/gpu_mode_manager.cc (working copy)
@@ -5,16 +5,38 @@
#include "chrome/browser/gpu/gpu_mode_manager.h"
#include "base/bind.h"
+#include "base/metrics/histogram.h"
#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/gpu_data_manager.h"
+#include "content/public/browser/user_metrics.h"
+using content::UserMetricsAction;
+
+namespace {
+
+bool GetPreviousGpuModePref() {
+ PrefService* service = g_browser_process->local_state();
+ DCHECK(service);
+ return service->GetBoolean(prefs::kHardwareAccelerationModePrevious);
+}
+
+void SetPreviousGpuModePref(bool enabled) {
+ PrefService* service = g_browser_process->local_state();
+ DCHECK(service);
+ service->SetBoolean(prefs::kHardwareAccelerationModePrevious, enabled);
+}
+
+} // namespace anonymous
+
// static
void GpuModeManager::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(
prefs::kHardwareAccelerationModeEnabled, true);
+ registry->RegisterBooleanPref(
+ prefs::kHardwareAccelerationModePrevious, true);
}
GpuModeManager::GpuModeManager()
@@ -28,7 +50,16 @@
base::Bind(&base::DoNothing));
initial_gpu_mode_pref_ = IsGpuModePrefEnabled();
+ bool previous_gpu_mode_pref = GetPreviousGpuModePref();
+ SetPreviousGpuModePref(initial_gpu_mode_pref_);
+ UMA_HISTOGRAM_BOOLEAN("GPU.HardwareAccelerationModeEnabled",
+ initial_gpu_mode_pref_);
+ if (previous_gpu_mode_pref && !initial_gpu_mode_pref_)
+ content::RecordAction(UserMetricsAction("GpuAccelerationDisabled"));
+ if (!previous_gpu_mode_pref && initial_gpu_mode_pref_)
+ content::RecordAction(UserMetricsAction("GpuAccelerationEnabled"));
+
if (!initial_gpu_mode_pref_) {
content::GpuDataManager* gpu_data_manager =
content::GpuDataManager::GetInstance();
« no previous file with comments | « no previous file | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698