| 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 #if defined(OS_MACOSX) | 7 #if defined(OS_MACOSX) |
| 8 #include <CoreGraphics/CGDisplayConfiguration.h> | 8 #include <CoreGraphics/CGDisplayConfiguration.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
| 15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "base/version.h" | 17 #include "base/version.h" |
| 18 #include "content/browser/browser_thread.h" | 18 #include "content/browser/browser_thread.h" |
| 19 #include "content/browser/gpu/gpu_blacklist.h" | 19 #include "content/browser/gpu/gpu_blacklist.h" |
| 20 #include "content/browser/gpu/gpu_process_host.h" | 20 #include "content/browser/gpu/gpu_process_host.h" |
| 21 #include "content/common/content_client.h" | 21 #include "content/common/content_client.h" |
| 22 #include "content/common/content_switches.h" | 22 #include "content/common/content_switches.h" |
| 23 #include "content/common/gpu/gpu_messages.h" | 23 #include "content/common/gpu/gpu_messages.h" |
| 24 #include "content/gpu/gpu_info_collector.h" | 24 #include "content/gpu/gpu_info_collector.h" |
| 25 #include "ui/gfx/gl/gl_implementation.h" | 25 #include "ui/gfx/gl/gl_implementation.h" |
| 26 #include "ui/gfx/gl/gl_switches.h" | 26 #include "ui/gfx/gl/gl_switches.h" |
| 27 #include "webkit/plugins/plugin_switches.h" |
| 27 | 28 |
| 28 namespace { | 29 namespace { |
| 29 | 30 |
| 30 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
| 31 void DisplayReconfigCallback(CGDirectDisplayID display, | 32 void DisplayReconfigCallback(CGDirectDisplayID display, |
| 32 CGDisplayChangeSummaryFlags flags, | 33 CGDisplayChangeSummaryFlags flags, |
| 33 void* gpu_data_manager) { | 34 void* gpu_data_manager) { |
| 34 // TODO(zmo): this logging is temporary for crbug 88008 and will be removed. | 35 // TODO(zmo): this logging is temporary for crbug 88008 and will be removed. |
| 35 LOG(INFO) << "Display re-configuration: flags = 0x" | 36 LOG(INFO) << "Display re-configuration: flags = 0x" |
| 36 << base::StringPrintf("%04x", flags); | 37 << base::StringPrintf("%04x", flags); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 243 } |
| 243 return false; | 244 return false; |
| 244 } | 245 } |
| 245 | 246 |
| 246 void GpuDataManager::AppendRendererCommandLine( | 247 void GpuDataManager::AppendRendererCommandLine( |
| 247 CommandLine* command_line) { | 248 CommandLine* command_line) { |
| 248 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 249 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 249 DCHECK(command_line); | 250 DCHECK(command_line); |
| 250 | 251 |
| 251 uint32 flags = gpu_feature_flags_.flags(); | 252 uint32 flags = gpu_feature_flags_.flags(); |
| 252 if ((flags & GpuFeatureFlags::kGpuFeatureWebgl) && | 253 if ((flags & GpuFeatureFlags::kGpuFeatureWebgl)) { |
| 253 !command_line->HasSwitch(switches::kDisableExperimentalWebGL)) | 254 if (!command_line->HasSwitch(switches::kDisableExperimentalWebGL)) |
| 254 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 255 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
| 256 if (!command_line->HasSwitch(switches::kDisablePepper3dForUntrustedUse)) |
| 257 command_line->AppendSwitch(switches::kDisablePepper3dForUntrustedUse); |
| 258 } |
| 255 if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) && | 259 if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) && |
| 256 !command_line->HasSwitch(switches::kDisableGLMultisampling)) | 260 !command_line->HasSwitch(switches::kDisableGLMultisampling)) |
| 257 command_line->AppendSwitch(switches::kDisableGLMultisampling); | 261 command_line->AppendSwitch(switches::kDisableGLMultisampling); |
| 258 if ((flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) && | 262 if ((flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) && |
| 259 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) | 263 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) |
| 260 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 264 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
| 261 if ((flags & GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas) && | 265 if ((flags & GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas) && |
| 262 !command_line->HasSwitch(switches::kDisableAccelerated2dCanvas)) | 266 !command_line->HasSwitch(switches::kDisableAccelerated2dCanvas)) |
| 263 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 267 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 264 } | 268 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 448 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 445 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || | 449 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || |
| 446 browser_command_line.GetSwitchValueASCII( | 450 browser_command_line.GetSwitchValueASCII( |
| 447 switches::kUseGL) == gfx::kGLImplementationOSMesaName) | 451 switches::kUseGL) == gfx::kGLImplementationOSMesaName) |
| 448 return NULL; | 452 return NULL; |
| 449 // No need to return an empty blacklist. | 453 // No need to return an empty blacklist. |
| 450 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) | 454 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) |
| 451 return NULL; | 455 return NULL; |
| 452 return gpu_blacklist_.get(); | 456 return gpu_blacklist_.get(); |
| 453 } | 457 } |
| OLD | NEW |