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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 if (!CanDoAcceleratedCompositing()) | 54 if (!CanDoAcceleratedCompositing()) |
55 return false; | 55 return false; |
56 | 56 |
57 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 57 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
58 | 58 |
59 // Command line switches take precedence over blacklist and field trials. | 59 // Command line switches take precedence over blacklist and field trials. |
60 if (command_line.HasSwitch(switches::kDisableForceCompositingMode) || | 60 if (command_line.HasSwitch(switches::kDisableForceCompositingMode) || |
61 command_line.HasSwitch(switches::kDisableThreadedCompositing)) | 61 command_line.HasSwitch(switches::kDisableThreadedCompositing)) |
62 return false; | 62 return false; |
63 | 63 |
| 64 #if defined(OS_CHROMEOS) |
| 65 // We always want threaded compositing on ChromeOS unless it's explicitly |
| 66 // disabled above. |
| 67 return true; |
| 68 #endif |
| 69 |
64 if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) | 70 if (command_line.HasSwitch(switches::kEnableThreadedCompositing)) |
65 return true; | 71 return true; |
66 | 72 |
67 if (IsForceCompositingModeBlacklisted()) | 73 if (IsForceCompositingModeBlacklisted()) |
68 return false; | 74 return false; |
69 | 75 |
70 base::FieldTrial* trial = | 76 base::FieldTrial* trial = |
71 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); | 77 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); |
72 return trial && | 78 return trial && |
73 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName; | 79 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName; |
74 } | 80 } |
75 | 81 |
76 bool IsForceCompositingModeEnabled() { | 82 bool IsForceCompositingModeEnabled() { |
77 #if defined(OS_WIN) && defined(USE_AURA) | 83 #if defined(OS_WIN) && defined(USE_AURA) |
78 // We always want compositing on Aura Windows. | 84 // We always want compositing on Aura Windows. |
79 return true; | 85 return true; |
80 #endif | 86 #endif |
81 | 87 |
82 if (!CanDoAcceleratedCompositing()) | 88 if (!CanDoAcceleratedCompositing()) |
83 return false; | 89 return false; |
84 | 90 |
85 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 91 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
86 | 92 |
87 // Command line switches take precedence over blacklisting and field trials. | 93 // Command line switches take precedence over blacklisting and field trials. |
88 if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) | 94 if (command_line.HasSwitch(switches::kDisableForceCompositingMode)) |
89 return false; | 95 return false; |
90 | 96 |
| 97 #if defined(OS_CHROMEOS) |
| 98 // We always want compositing ChromeOS unless it's explicitly disabled above. |
| 99 return true; |
| 100 #endif |
| 101 |
91 if (command_line.HasSwitch(switches::kForceCompositingMode)) | 102 if (command_line.HasSwitch(switches::kForceCompositingMode)) |
92 return true; | 103 return true; |
93 | 104 |
94 if (IsForceCompositingModeBlacklisted()) | 105 if (IsForceCompositingModeBlacklisted()) |
95 return false; | 106 return false; |
96 | 107 |
97 base::FieldTrial* trial = | 108 base::FieldTrial* trial = |
98 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); | 109 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); |
99 | 110 |
100 // Force compositing is enabled in both the force compositing | 111 // Force compositing is enabled in both the force compositing |
101 // and threaded compositing mode field trials. | 112 // and threaded compositing mode field trials. |
102 return trial && | 113 return trial && |
103 (trial->group_name() == | 114 (trial->group_name() == |
104 kGpuCompositingFieldTrialForceCompositingEnabledName || | 115 kGpuCompositingFieldTrialForceCompositingEnabledName || |
105 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); | 116 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); |
106 } | 117 } |
107 | 118 |
108 } // namespace content | 119 } // namespace content |
OLD | NEW |