diff options
-rw-r--r-- | chrome/browser/gpu/gpu_mode_manager.cc | 11 | ||||
-rw-r--r-- | chrome/browser/gpu/gpu_mode_manager.h | 6 | ||||
-rw-r--r-- | chrome/browser/ui/webui/options/browser_options_handler.cc | 5 |
3 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/gpu/gpu_mode_manager.cc b/chrome/browser/gpu/gpu_mode_manager.cc index 38ec835..f56cb76 100644 --- a/chrome/browser/gpu/gpu_mode_manager.cc +++ b/chrome/browser/gpu/gpu_mode_manager.cc @@ -17,7 +17,8 @@ void GpuModeManager::RegisterPrefs(PrefRegistrySimple* registry) { prefs::kHardwareAccelerationModeEnabled, true); } -GpuModeManager::GpuModeManager() { +GpuModeManager::GpuModeManager() + : initial_gpu_mode_pref_(true) { if (g_browser_process->local_state()) { // Skip for unit tests pref_registrar_.Init(g_browser_process->local_state()); // Do nothing when the pref changes. It takes effect after @@ -26,7 +27,9 @@ GpuModeManager::GpuModeManager() { prefs::kHardwareAccelerationModeEnabled, base::Bind(&base::DoNothing)); - if (!IsGpuModePrefEnabled()) { + initial_gpu_mode_pref_ = IsGpuModePrefEnabled(); + + if (!initial_gpu_mode_pref_) { content::GpuDataManager* gpu_data_manager = content::GpuDataManager::GetInstance(); DCHECK(gpu_data_manager); @@ -38,6 +41,10 @@ GpuModeManager::GpuModeManager() { GpuModeManager::~GpuModeManager() { } +bool GpuModeManager::initial_gpu_mode_pref() const { + return initial_gpu_mode_pref_; +} + // static bool GpuModeManager::IsGpuModePrefEnabled() { PrefService* service = g_browser_process->local_state(); diff --git a/chrome/browser/gpu/gpu_mode_manager.h b/chrome/browser/gpu/gpu_mode_manager.h index 872c6fd..8dd605b 100644 --- a/chrome/browser/gpu/gpu_mode_manager.h +++ b/chrome/browser/gpu/gpu_mode_manager.h @@ -16,11 +16,15 @@ class GpuModeManager { GpuModeManager(); ~GpuModeManager(); - static bool IsGpuModePrefEnabled(); + bool initial_gpu_mode_pref() const; private: + static bool IsGpuModePrefEnabled(); + PrefChangeRegistrar pref_registrar_; + bool initial_gpu_mode_pref_; + DISALLOW_COPY_AND_ASSIGN(GpuModeManager); }; diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc index 4757370..8c17095 100644 --- a/chrome/browser/ui/webui/options/browser_options_handler.cc +++ b/chrome/browser/ui/webui/options/browser_options_handler.cc @@ -495,8 +495,9 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) { #endif #if !defined(OS_CHROMEOS) - values->SetBoolean("gpuEnabledAtStart", - GpuModeManager::IsGpuModePrefEnabled()); + values->SetBoolean( + "gpuEnabledAtStart", + g_browser_process->gpu_mode_manager()->initial_gpu_mode_pref()); #endif } |