OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/gpu/gpu_data_manager.h" | 5 #include "content/browser/gpu/gpu_data_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 const GPUInfo& GpuDataManager::gpu_info() const { | 56 const GPUInfo& GpuDataManager::gpu_info() const { |
57 base::AutoLock auto_lock(gpu_info_lock_); | 57 base::AutoLock auto_lock(gpu_info_lock_); |
58 return gpu_info_; | 58 return gpu_info_; |
59 } | 59 } |
60 | 60 |
61 Value* GpuDataManager::GetFeatureStatus() { | 61 Value* GpuDataManager::GetFeatureStatus() { |
62 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 62 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
63 if (gpu_blacklist_.get()) | 63 if (gpu_blacklist_.get()) |
64 return gpu_blacklist_->GetFeatureStatus(GpuAccessAllowed(), | 64 return gpu_blacklist_->GetFeatureStatus(GpuAccessAllowed(), |
65 browser_command_line.HasSwitch(switches::kDisableAcceleratedCompositing)
, | 65 browser_command_line.HasSwitch( |
66 browser_command_line.HasSwitch(switches::kEnableAccelerated2dCanvas), | 66 switches::kDisableAcceleratedCompositing), |
| 67 browser_command_line.HasSwitch( |
| 68 switches::kDisableAccelerated2dCanvas), |
67 browser_command_line.HasSwitch(switches::kDisableExperimentalWebGL), | 69 browser_command_line.HasSwitch(switches::kDisableExperimentalWebGL), |
68 browser_command_line.HasSwitch(switches::kDisableGLMultisampling)); | 70 browser_command_line.HasSwitch(switches::kDisableGLMultisampling)); |
69 return NULL; | 71 return NULL; |
70 } | 72 } |
71 | 73 |
72 std::string GpuDataManager::GetBlacklistVersion() const { | 74 std::string GpuDataManager::GetBlacklistVersion() const { |
73 if (gpu_blacklist_.get() != NULL) { | 75 if (gpu_blacklist_.get() != NULL) { |
74 uint16 version_major, version_minor; | 76 uint16 version_major, version_minor; |
75 if (gpu_blacklist_->GetVersion(&version_major, | 77 if (gpu_blacklist_->GetVersion(&version_major, |
76 &version_minor)) { | 78 &version_minor)) { |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if ((flags & GpuFeatureFlags::kGpuFeatureWebgl) && | 137 if ((flags & GpuFeatureFlags::kGpuFeatureWebgl) && |
136 !command_line->HasSwitch(switches::kDisableExperimentalWebGL)) | 138 !command_line->HasSwitch(switches::kDisableExperimentalWebGL)) |
137 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 139 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
138 if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) && | 140 if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) && |
139 !command_line->HasSwitch(switches::kDisableGLMultisampling)) | 141 !command_line->HasSwitch(switches::kDisableGLMultisampling)) |
140 command_line->AppendSwitch(switches::kDisableGLMultisampling); | 142 command_line->AppendSwitch(switches::kDisableGLMultisampling); |
141 // If we have kGpuFeatureAcceleratedCompositing, we disable all GPU features. | 143 // If we have kGpuFeatureAcceleratedCompositing, we disable all GPU features. |
142 if (flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) { | 144 if (flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) { |
143 const char* switches[] = { | 145 const char* switches[] = { |
144 switches::kDisableAcceleratedCompositing, | 146 switches::kDisableAcceleratedCompositing, |
145 switches::kDisableExperimentalWebGL | 147 switches::kDisableExperimentalWebGL, |
| 148 switches::kDisableAccelerated2dCanvas |
146 }; | 149 }; |
147 const int switch_count = sizeof(switches) / sizeof(char*); | 150 const int switch_count = sizeof(switches) / sizeof(char*); |
148 for (int i = 0; i < switch_count; ++i) { | 151 for (int i = 0; i < switch_count; ++i) { |
149 if (!command_line->HasSwitch(switches[i])) | 152 if (!command_line->HasSwitch(switches[i])) |
150 command_line->AppendSwitch(switches[i]); | 153 command_line->AppendSwitch(switches[i]); |
151 } | 154 } |
152 } | 155 } |
153 } | 156 } |
154 | 157 |
155 void GpuDataManager::UpdateGpuBlacklist(GpuBlacklist* gpu_blacklist) { | 158 void GpuDataManager::UpdateGpuBlacklist(GpuBlacklist* gpu_blacklist) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 220 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
218 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || | 221 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || |
219 browser_command_line.GetSwitchValueASCII( | 222 browser_command_line.GetSwitchValueASCII( |
220 switches::kUseGL) == gfx::kGLImplementationOSMesaName) | 223 switches::kUseGL) == gfx::kGLImplementationOSMesaName) |
221 return NULL; | 224 return NULL; |
222 // No need to return an empty blacklist. | 225 // No need to return an empty blacklist. |
223 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) | 226 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) |
224 return NULL; | 227 return NULL; |
225 return gpu_blacklist_.get(); | 228 return gpu_blacklist_.get(); |
226 } | 229 } |
OLD | NEW |