| OLD | NEW |
| 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 "content/public/browser/compositor_util.h" | 5 #include "content/public/browser/compositor_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "content/public/browser/gpu_data_manager.h" | 9 #include "content/public/browser/gpu_data_manager.h" |
| 10 #include "content/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
| 11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 12 #include "content/public/common/gpu_feature_type.h" | 12 #include "content/public/common/gpu_feature_type.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 bool CanDoAcceleratedCompositing() { | 18 bool CanDoAcceleratedCompositing() { |
| 19 const GpuDataManager* manager = GpuDataManager::GetInstance(); | 19 const GpuDataManager* manager = GpuDataManager::GetInstance(); |
| 20 | 20 |
| 21 // Don't run the field trial if gpu access has been blocked or | 21 // Don't run the field trial if gpu access has been blocked or |
| 22 // accelerated compositing is blacklisted. | 22 // accelerated compositing is blacklisted. |
| 23 if (!manager->GpuAccessAllowed() || | 23 if (!manager->GpuAccessAllowed() || |
| 24 manager->IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) | 24 manager->IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) |
| 25 return false; | 25 return false; |
| 26 | 26 |
| 27 // Check for the software rasterizer (SwiftShader). | 27 // Check for SwiftShader. |
| 28 if (manager->ShouldUseSoftwareRendering()) | 28 if (manager->ShouldUseSwiftShader()) |
| 29 return false; | 29 return false; |
| 30 | 30 |
| 31 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 31 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 32 if (command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) | 32 if (command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) |
| 33 return false; | 33 return false; |
| 34 | 34 |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool IsForceCompositingModeBlacklisted() { | 38 bool IsForceCompositingModeBlacklisted() { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 // Force compositing is enabled in both the force compositing | 108 // Force compositing is enabled in both the force compositing |
| 109 // and threaded compositing mode field trials. | 109 // and threaded compositing mode field trials. |
| 110 return trial && | 110 return trial && |
| 111 (trial->group_name() == | 111 (trial->group_name() == |
| 112 kGpuCompositingFieldTrialForceCompositingEnabledName || | 112 kGpuCompositingFieldTrialForceCompositingEnabledName || |
| 113 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); | 113 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); |
| 114 } | 114 } |
| 115 | 115 |
| 116 } // namespace content | 116 } // namespace content |
| OLD | NEW |