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/browser/gpu/compositor_util.h" | 5 #include "content/browser/gpu/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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); | 96 base::FieldTrialList::Find(kGpuCompositingFieldTrialName); |
97 | 97 |
98 // Force compositing is enabled in both the force compositing | 98 // Force compositing is enabled in both the force compositing |
99 // and threaded compositing mode field trials. | 99 // and threaded compositing mode field trials. |
100 return trial && | 100 return trial && |
101 (trial->group_name() == | 101 (trial->group_name() == |
102 kGpuCompositingFieldTrialForceCompositingEnabledName || | 102 kGpuCompositingFieldTrialForceCompositingEnabledName || |
103 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); | 103 trial->group_name() == kGpuCompositingFieldTrialThreadEnabledName); |
104 } | 104 } |
105 | 105 |
| 106 bool IsDelegatedRendererEnabled() { |
| 107 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 108 bool enabled = false; |
| 109 |
| 110 #if defined(USE_AURA) |
| 111 // Default to true on Aura, but allow override via flags. |
| 112 enabled = true; |
| 113 #endif |
| 114 |
| 115 // Flags override. |
| 116 enabled |= command_line.HasSwitch(switches::kEnableDelegatedRenderer); |
| 117 enabled &= !command_line.HasSwitch(switches::kDisableDelegatedRenderer); |
| 118 |
| 119 // Needs compositing, and thread. |
| 120 if (enabled && |
| 121 (!IsForceCompositingModeEnabled() || !IsThreadedCompositingEnabled())) { |
| 122 enabled = false; |
| 123 LOG(ERROR) << "Disabling delegated-rendering because it needs " |
| 124 << "force-compositing-mode and threaded-compositing."; |
| 125 } |
| 126 |
| 127 return enabled; |
| 128 } |
| 129 |
106 } // namespace content | 130 } // namespace content |
OLD | NEW |