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

Side by Side Diff: chrome/browser/gpu/gpu_mode_manager.cc

Issue 12593005: Add a user pref in Settings to disable all GPU features. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/gpu/gpu_mode_manager.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/gpu/gpu_mode_manager.h"
6
7 #include "base/bind.h"
8 #include "base/prefs/pref_registry_simple.h"
9 #include "base/prefs/pref_service.h"
10 #include "chrome/browser/browser_process.h"
11 #include "chrome/common/pref_names.h"
12 #include "content/public/browser/gpu_data_manager.h"
13
14 // static
15 void GpuModeManager::RegisterPrefs(PrefRegistrySimple* registry) {
16 registry->RegisterBooleanPref(
17 prefs::kHardwareAccelerationModeEnabled, true);
18 }
19
20 GpuModeManager::GpuModeManager() {
21 if (g_browser_process->local_state()) { // Skip for unit tests
22 pref_registrar_.Init(g_browser_process->local_state());
23 pref_registrar_.Add(
24 prefs::kHardwareAccelerationModeEnabled,
25 base::Bind(&base::DoNothing));
26
27 if (!IsGpuModePrefEnabled()) {
28 content::GpuDataManager* gpu_data_manager =
29 content::GpuDataManager::GetInstance();
30 DCHECK(gpu_data_manager);
31 gpu_data_manager->DisableHardwareAcceleration();
32 }
33 }
34 }
35
36 GpuModeManager::~GpuModeManager() {
37 }
38
39 void GpuModeManager::OnGpuModeEnabledPrefChanged() {
Lei Zhang 2013/03/09 00:23:43 Remove this too?
Zhenyao Mo 2013/03/09 00:30:48 Done.
40 // Do nothing. The pref change takes effect after chrome restarts.
41 }
42
43 bool GpuModeManager::IsGpuModePrefEnabled() const {
44 PrefService* service = g_browser_process->local_state();
45 DCHECK(service);
46 return service->GetBoolean(
47 prefs::kHardwareAccelerationModeEnabled);
48 }
49
OLDNEW
« no previous file with comments | « chrome/browser/gpu/gpu_mode_manager.h ('k') | chrome/browser/prefs/browser_prefs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698