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 "gpu/config/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(NULL) || | 23 if (!manager->GpuAccessAllowed(NULL) || |
24 manager->IsFeatureBlacklisted(GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) | 24 manager->IsFeatureBlacklisted( |
| 25 gpu::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING)) |
25 return false; | 26 return false; |
26 | 27 |
27 // Check for SwiftShader. | 28 // Check for SwiftShader. |
28 if (manager->ShouldUseSwiftShader()) | 29 if (manager->ShouldUseSwiftShader()) |
29 return false; | 30 return false; |
30 | 31 |
31 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 32 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
32 if (command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) | 33 if (command_line.HasSwitch(switches::kDisableAcceleratedCompositing)) |
33 return false; | 34 return false; |
34 | 35 |
35 return true; | 36 return true; |
36 } | 37 } |
37 | 38 |
38 bool IsForceCompositingModeBlacklisted() { | 39 bool IsForceCompositingModeBlacklisted() { |
39 return GpuDataManager::GetInstance()->IsFeatureBlacklisted( | 40 return GpuDataManager::GetInstance()->IsFeatureBlacklisted( |
40 GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE); | 41 gpu::GPU_FEATURE_TYPE_FORCE_COMPOSITING_MODE); |
41 } | 42 } |
42 | 43 |
43 } // namespace | 44 } // namespace |
44 | 45 |
45 bool IsThreadedCompositingEnabled() { | 46 bool IsThreadedCompositingEnabled() { |
46 #if defined(OS_WIN) && defined(USE_AURA) | 47 #if defined(OS_WIN) && defined(USE_AURA) |
47 // We always want compositing on Aura Windows. | 48 // We always want compositing on Aura Windows. |
48 return true; | 49 return true; |
49 #endif | 50 #endif |
50 | 51 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 108 |
108 // Force compositing is enabled in both the force compositing | 109 // Force compositing is enabled in both the force compositing |
109 // and threaded compositing mode field trials. | 110 // and threaded compositing mode field trials. |
110 return trial && | 111 return trial && |
111 (trial->group_name() == | 112 (trial->group_name() == |
112 kGpuCompositingFieldTrialForceCompositingEnabledName || | 113 kGpuCompositingFieldTrialForceCompositingEnabledName || |
113 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); | 114 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); |
114 } | 115 } |
115 | 116 |
116 } // namespace content | 117 } // namespace content |
OLD | NEW |