| 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 "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
| 16 #include "content/browser/gpu/gpu_blacklist.h" | 16 #include "content/browser/gpu/gpu_blacklist.h" |
| 17 #include "content/browser/gpu/gpu_process_host.h" | 17 #include "content/browser/gpu/gpu_process_host.h" |
| 18 #include "content/common/content_client.h" | 18 #include "content/common/content_client.h" |
| 19 #include "content/common/content_switches.h" | 19 #include "content/common/content_switches.h" |
| 20 #include "content/common/gpu/gpu_messages.h" | 20 #include "content/common/gpu/gpu_messages.h" |
| 21 #include "content/gpu/gpu_info_collector.h" | 21 #include "content/gpu/gpu_info_collector.h" |
| 22 #include "ui/gfx/gl/gl_implementation.h" | 22 #include "ui/gfx/gl/gl_implementation.h" |
| 23 #include "ui/gfx/gl/gl_switches.h" | 23 #include "ui/gfx/gl/gl_switches.h" |
| 24 #include "webkit/plugins/plugin_switches.h" |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 #if defined(OS_MACOSX) | 28 #if defined(OS_MACOSX) |
| 28 void DisplayReconfigCallback(CGDirectDisplayID display, | 29 void DisplayReconfigCallback(CGDirectDisplayID display, |
| 29 CGDisplayChangeSummaryFlags flags, | 30 CGDisplayChangeSummaryFlags flags, |
| 30 void* gpu_data_manager) { | 31 void* gpu_data_manager) { |
| 31 // TODO(zmo): this logging is temporary for crbug 88008 and will be removed. | 32 // TODO(zmo): this logging is temporary for crbug 88008 and will be removed. |
| 32 LOG(INFO) << "Display re-configuration: flags = 0x" | 33 LOG(INFO) << "Display re-configuration: flags = 0x" |
| 33 << base::StringPrintf("%04x", flags); | 34 << base::StringPrintf("%04x", flags); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 210 } |
| 210 return false; | 211 return false; |
| 211 } | 212 } |
| 212 | 213 |
| 213 void GpuDataManager::AppendRendererCommandLine( | 214 void GpuDataManager::AppendRendererCommandLine( |
| 214 CommandLine* command_line) { | 215 CommandLine* command_line) { |
| 215 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 216 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 216 DCHECK(command_line); | 217 DCHECK(command_line); |
| 217 | 218 |
| 218 uint32 flags = gpu_feature_flags_.flags(); | 219 uint32 flags = gpu_feature_flags_.flags(); |
| 219 if ((flags & GpuFeatureFlags::kGpuFeatureWebgl) && | 220 if ((flags & GpuFeatureFlags::kGpuFeatureWebgl)) { |
| 220 !command_line->HasSwitch(switches::kDisableExperimentalWebGL)) | 221 if (!command_line->HasSwitch(switches::kDisableExperimentalWebGL)) |
| 221 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); | 222 command_line->AppendSwitch(switches::kDisableExperimentalWebGL); |
| 223 if (!command_line->HasSwitch(switches::kDisablePepper3dForUntrustedUse)) |
| 224 command_line->AppendSwitch(switches::kDisablePepper3dForUntrustedUse); |
| 225 } |
| 222 if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) && | 226 if ((flags & GpuFeatureFlags::kGpuFeatureMultisampling) && |
| 223 !command_line->HasSwitch(switches::kDisableGLMultisampling)) | 227 !command_line->HasSwitch(switches::kDisableGLMultisampling)) |
| 224 command_line->AppendSwitch(switches::kDisableGLMultisampling); | 228 command_line->AppendSwitch(switches::kDisableGLMultisampling); |
| 225 if ((flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) && | 229 if ((flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) && |
| 226 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) | 230 !command_line->HasSwitch(switches::kDisableAcceleratedCompositing)) |
| 227 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); | 231 command_line->AppendSwitch(switches::kDisableAcceleratedCompositing); |
| 228 if ((flags & GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas) && | 232 if ((flags & GpuFeatureFlags::kGpuFeatureAccelerated2dCanvas) && |
| 229 !command_line->HasSwitch(switches::kDisableAccelerated2dCanvas)) | 233 !command_line->HasSwitch(switches::kDisableAccelerated2dCanvas)) |
| 230 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); | 234 command_line->AppendSwitch(switches::kDisableAccelerated2dCanvas); |
| 231 } | 235 } |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 394 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
| 391 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || | 395 if (browser_command_line.HasSwitch(switches::kIgnoreGpuBlacklist) || |
| 392 browser_command_line.GetSwitchValueASCII( | 396 browser_command_line.GetSwitchValueASCII( |
| 393 switches::kUseGL) == gfx::kGLImplementationOSMesaName) | 397 switches::kUseGL) == gfx::kGLImplementationOSMesaName) |
| 394 return NULL; | 398 return NULL; |
| 395 // No need to return an empty blacklist. | 399 // No need to return an empty blacklist. |
| 396 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) | 400 if (gpu_blacklist_.get() != NULL && gpu_blacklist_->max_entry_id() == 0) |
| 397 return NULL; | 401 return NULL; |
| 398 return gpu_blacklist_.get(); | 402 return gpu_blacklist_.get(); |
| 399 } | 403 } |
| OLD | NEW |