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

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

Issue 1547793004: Make gpu black list work again on Linux (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove changes from gpu_info_collector files Created 4 years, 10 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
OLDNEW
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 "base/command_line.h"
7 #include "base/prefs/pref_registry_simple.h" 8 #include "base/prefs/pref_registry_simple.h"
8 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
9 #include "build/build_config.h" 10 #include "build/build_config.h"
10 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
11 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
12 #include "content/public/browser/gpu_data_manager.h" 13 #include "content/public/browser/gpu_data_manager.h"
14 #include "gpu/config/gpu_switches.h"
13 15
14 // static 16 // static
15 void GLStringManager::RegisterPrefs(PrefRegistrySimple* registry) { 17 void GLStringManager::RegisterPrefs(PrefRegistrySimple* registry) {
16 registry->RegisterStringPref(prefs::kGLVendorString, std::string()); 18 registry->RegisterStringPref(prefs::kGLVendorString, std::string());
17 registry->RegisterStringPref(prefs::kGLRendererString, std::string()); 19 registry->RegisterStringPref(prefs::kGLRendererString, std::string());
18 registry->RegisterStringPref(prefs::kGLVersionString, std::string()); 20 registry->RegisterStringPref(prefs::kGLVersionString, std::string());
19 } 21 }
20 22
21 GLStringManager::GLStringManager() { 23 GLStringManager::GLStringManager() {
22 } 24 }
23 25
24 GLStringManager::~GLStringManager() { 26 GLStringManager::~GLStringManager() {
25 } 27 }
26 28
27 void GLStringManager::Initialize() { 29 void GLStringManager::Initialize() {
28 // On MacOSX or Windows, preliminary GPUInfo is enough. 30 // On MacOSX or Windows, preliminary GPUInfo is enough.
29 #if defined(OS_LINUX) 31 #if defined(OS_LINUX)
30 // We never remove this observer from GpuDataManager. 32 // We never remove this observer from GpuDataManager.
31 content::GpuDataManager::GetInstance()->AddObserver(this); 33 content::GpuDataManager::GetInstance()->AddObserver(this);
32 34
33 PrefService* local_state = g_browser_process->local_state(); 35 PrefService* local_state = g_browser_process->local_state();
34 if (!local_state) 36 if (!local_state)
35 return; 37 return;
36 38
37 gl_vendor_ = local_state->GetString(prefs::kGLVendorString); 39 gl_vendor_ = local_state->GetString(prefs::kGLVendorString);
38 gl_renderer_ = local_state->GetString(prefs::kGLRendererString); 40 gl_renderer_ = local_state->GetString(prefs::kGLRendererString);
39 gl_version_ = local_state->GetString(prefs::kGLVersionString); 41 gl_version_ = local_state->GetString(prefs::kGLVersionString);
40 42
43 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
44
45 if (command_line->HasSwitch(switches::kGpuTestingGLVendor))
Zhenyao Mo 2016/02/01 20:19:36 nit: with multi-line body, you should use {} Here
46 gl_vendor_ =
47 command_line->GetSwitchValueASCII(switches::kGpuTestingGLVendor);
48
49 if (command_line->HasSwitch(switches::kGpuTestingGLRenderer))
50 gl_renderer_ =
51 command_line->GetSwitchValueASCII(switches::kGpuTestingGLRenderer);
52
53 if (command_line->HasSwitch(switches::kGpuTestingGLVersion))
54 gl_version_ =
55 command_line->GetSwitchValueASCII(switches::kGpuTestingGLVersion);
56
41 if (!gl_vendor_.empty() || !gl_renderer_.empty() || !gl_version_.empty()) { 57 if (!gl_vendor_.empty() || !gl_renderer_.empty() || !gl_version_.empty()) {
42 content::GpuDataManager::GetInstance()->SetGLStrings( 58 content::GpuDataManager::GetInstance()->SetGLStrings(
43 gl_vendor_, gl_renderer_, gl_version_); 59 gl_vendor_, gl_renderer_, gl_version_);
44 } 60 }
45 #endif 61 #endif
46 } 62 }
47 63
48 void GLStringManager::OnGpuInfoUpdate() { 64 void GLStringManager::OnGpuInfoUpdate() {
49 std::string gl_vendor, gl_renderer, gl_version; 65 std::string gl_vendor, gl_renderer, gl_version;
50 content::GpuDataManager::GetInstance()->GetGLStrings( 66 content::GpuDataManager::GetInstance()->GetGLStrings(
(...skipping 10 matching lines...) Expand all
61 if (!gl_renderer.empty() && gl_renderer != gl_renderer_) { 77 if (!gl_renderer.empty() && gl_renderer != gl_renderer_) {
62 gl_renderer_ = gl_renderer; 78 gl_renderer_ = gl_renderer;
63 local_state->SetString(prefs::kGLRendererString, gl_renderer_); 79 local_state->SetString(prefs::kGLRendererString, gl_renderer_);
64 } 80 }
65 if (!gl_version.empty() && gl_version != gl_version_) { 81 if (!gl_version.empty() && gl_version != gl_version_) {
66 gl_version_ = gl_version; 82 gl_version_ = gl_version;
67 local_state->SetString(prefs::kGLVersionString, gl_version_); 83 local_state->SetString(prefs::kGLVersionString, gl_version_);
68 } 84 }
69 } 85 }
70 86
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698