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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 const GPUInfo& GpuDataManager::gpu_info() const { | 64 const GPUInfo& GpuDataManager::gpu_info() const { |
65 base::AutoLock auto_lock(gpu_info_lock_); | 65 base::AutoLock auto_lock(gpu_info_lock_); |
66 return gpu_info_; | 66 return gpu_info_; |
67 } | 67 } |
68 | 68 |
69 Value* GpuDataManager::GetFeatureStatus() { | 69 Value* GpuDataManager::GetFeatureStatus() { |
70 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 70 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
71 if (gpu_blacklist_.get()) | 71 if (gpu_blacklist_.get()) |
72 return gpu_blacklist_->GetFeatureStatus(GpuAccessAllowed(), | 72 return gpu_blacklist_->GetFeatureStatus(GpuAccessAllowed(), |
73 browser_command_line.HasSwitch( | 73 browser_command_line.HasSwitch(switches::kDisableAcceleratedCompositing)
, |
74 switches::kDisableAcceleratedCompositing), | 74 browser_command_line.HasSwitch(switches::kEnableAccelerated2dCanvas), |
75 browser_command_line.HasSwitch( | |
76 switches::kDisableAccelerated2dCanvas), | |
77 browser_command_line.HasSwitch(switches::kDisableExperimentalWebGL), | 75 browser_command_line.HasSwitch(switches::kDisableExperimentalWebGL), |
78 browser_command_line.HasSwitch(switches::kDisableGLMultisampling)); | 76 browser_command_line.HasSwitch(switches::kDisableGLMultisampling)); |
79 return NULL; | 77 return NULL; |
80 } | 78 } |
81 | 79 |
82 std::string GpuDataManager::GetBlacklistVersion() const { | 80 std::string GpuDataManager::GetBlacklistVersion() const { |
83 if (gpu_blacklist_.get() != NULL) { | 81 if (gpu_blacklist_.get() != NULL) { |
84 uint16 version_major, version_minor; | 82 uint16 version_major, version_minor; |
85 if (gpu_blacklist_->GetVersion(&version_major, | 83 if (gpu_blacklist_->GetVersion(&version_major, |
86 &version_minor)) { | 84 &version_minor)) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 if ((flags & GpuFeatureFlags::kGpuFeatureWebgl) && | 142 if ((flags & GpuFeatureFlags::kGpuFeatureWebgl) && |
145 !command_line->HasSwitch(switches::kDisableExperimentalWebGL)) | 143 !command_line->HasSwitch(switches::kDisableExperimentalWebGL)) |
146 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 144 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
147 if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) && | 145 if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) && |
148 !command_line->HasSwitch(switches::kDisableGLMultisampling)) | 146 !command_line->HasSwitch(switches::kDisableGLMultisampling)) |
149 command_line->AppendSwitch(switches::kDisableGLMultisampling); | 147 command_line->AppendSwitch(switches::kDisableGLMultisampling); |
150 // If we have kGpuFeatureAcceleratedCompositing, we disable all GPU features. | 148 // If we have kGpuFeatureAcceleratedCompositing, we disable all GPU features. |
151 if (flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) { | 149 if (flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) { |
152 const char* switches[] = { | 150 const char* switches[] = { |
153 switches::kDisableAcceleratedCompositing, | 151 switches::kDisableAcceleratedCompositing, |
154 switches::kDisableExperimentalWebGL, | 152 switches::kDisableExperimentalWebGL |
155 switches::kDisableAccelerated2dCanvas | |
156 }; | 153 }; |
157 const int switch_count = sizeof(switches) / sizeof(char*); | 154 const int switch_count = sizeof(switches) / sizeof(char*); |
158 for (int i = 0; i < switch_count; ++i) { | 155 for (int i = 0; i < switch_count; ++i) { |
159 if (!command_line->HasSwitch(switches[i])) | 156 if (!command_line->HasSwitch(switches[i])) |
160 command_line->AppendSwitch(switches[i]); | 157 command_line->AppendSwitch(switches[i]); |
161 } | 158 } |
162 } | 159 } |
163 } | 160 } |
164 | 161 |
165 void GpuDataManager::SetBuiltInGpuBlacklist(GpuBlacklist* built_in_list) { | 162 void GpuDataManager::SetBuiltInGpuBlacklist(GpuBlacklist* built_in_list) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 265 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
269 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || | 266 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || |
270 browser_command_line.GetSwitchValueASCII( | 267 browser_command_line.GetSwitchValueASCII( |
271 switches::kUseGL) == gfx::kGLImplementationOSMesaName) | 268 switches::kUseGL) == gfx::kGLImplementationOSMesaName) |
272 return NULL; | 269 return NULL; |
273 // No need to return an empty blacklist. | 270 // No need to return an empty blacklist. |
274 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) | 271 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) |
275 return NULL; | 272 return NULL; |
276 return gpu_blacklist_.get(); | 273 return gpu_blacklist_.get(); |
277 } | 274 } |
OLD | NEW |