OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/gpu/gl_string_manager.h" | 5 #include "chrome/browser/gpu/gl_string_manager.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/prefs/pref_service.h" | 8 #include "chrome/browser/prefs/pref_service.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "content/public/browser/gpu_data_manager.h" | 10 #include "content/public/browser/gpu_data_manager.h" |
11 | 11 |
12 GLStringManager::GLStringManager() { | 12 GLStringManager::GLStringManager() { |
13 } | 13 } |
14 | 14 |
15 GLStringManager::~GLStringManager() { | 15 GLStringManager::~GLStringManager() { |
16 } | 16 } |
17 | 17 |
18 void GLStringManager::Initialize() { | 18 void GLStringManager::Initialize() { |
19 // On MacOSX or Windows, preliminary GPUInfo is enough. | 19 // On MacOSX or Windows, preliminary GPUInfo is enough. |
20 #if defined(OS_LINUX) | 20 #if defined(OS_LINUX) |
21 // We never remove this observer from GpuDataManager. | 21 // We never remove this observer from GpuDataManager. |
22 content::GpuDataManager::GetInstance()->AddObserver(this); | 22 content::GpuDataManager::GetInstance()->AddObserver(this); |
23 | 23 |
24 PrefService* local_state = g_browser_process->local_state(); | 24 PrefServiceSimple* local_state = g_browser_process->local_state(); |
25 if (!local_state) | 25 if (!local_state) |
26 return; | 26 return; |
27 | 27 |
| 28 // TODO(joi): This should happen via browser_prefs::RegisterLocalState(). |
28 local_state->RegisterStringPref(prefs::kGLVendorString, gl_vendor_); | 29 local_state->RegisterStringPref(prefs::kGLVendorString, gl_vendor_); |
29 local_state->RegisterStringPref(prefs::kGLRendererString, gl_renderer_); | 30 local_state->RegisterStringPref(prefs::kGLRendererString, gl_renderer_); |
30 local_state->RegisterStringPref(prefs::kGLVersionString, gl_version_); | 31 local_state->RegisterStringPref(prefs::kGLVersionString, gl_version_); |
31 | 32 |
32 gl_vendor_ = local_state->GetString(prefs::kGLVendorString); | 33 gl_vendor_ = local_state->GetString(prefs::kGLVendorString); |
33 gl_renderer_ = local_state->GetString(prefs::kGLRendererString); | 34 gl_renderer_ = local_state->GetString(prefs::kGLRendererString); |
34 gl_version_ = local_state->GetString(prefs::kGLVersionString); | 35 gl_version_ = local_state->GetString(prefs::kGLVersionString); |
35 | 36 |
36 if (!gl_vendor_.empty() || !gl_renderer_.empty() || !gl_version_.empty()) { | 37 if (!gl_vendor_.empty() || !gl_renderer_.empty() || !gl_version_.empty()) { |
37 content::GpuDataManager::GetInstance()->SetGLStrings( | 38 content::GpuDataManager::GetInstance()->SetGLStrings( |
(...skipping 18 matching lines...) Expand all Loading... |
56 if (!gl_renderer.empty() && gl_renderer != gl_renderer_) { | 57 if (!gl_renderer.empty() && gl_renderer != gl_renderer_) { |
57 gl_renderer_ = gl_renderer; | 58 gl_renderer_ = gl_renderer; |
58 local_state->SetString(prefs::kGLRendererString, gl_renderer_); | 59 local_state->SetString(prefs::kGLRendererString, gl_renderer_); |
59 } | 60 } |
60 if (!gl_version.empty() && gl_version != gl_version_) { | 61 if (!gl_version.empty() && gl_version != gl_version_) { |
61 gl_version_ = gl_version; | 62 gl_version_ = gl_version; |
62 local_state->SetString(prefs::kGLVersionString, gl_version_); | 63 local_state->SetString(prefs::kGLVersionString, gl_version_); |
63 } | 64 } |
64 } | 65 } |
65 | 66 |
OLD | NEW |