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 "chrome/browser/chrome_gpu_util.h" | 5 #include "chrome/browser/chrome_gpu_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 "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/version.h" | 10 #include "base/version.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 // field trial. | 147 // field trial. |
148 if (!ShouldRunCompositingFieldTrial()) { | 148 if (!ShouldRunCompositingFieldTrial()) { |
149 DisableCompositingFieldTrial(); | 149 DisableCompositingFieldTrial(); |
150 return; | 150 return; |
151 } | 151 } |
152 | 152 |
153 const base::FieldTrial::Probability kDivisor = 3; | 153 const base::FieldTrial::Probability kDivisor = 3; |
154 scoped_refptr<base::FieldTrial> trial( | 154 scoped_refptr<base::FieldTrial> trial( |
155 base::FieldTrialList::FactoryGetFieldTrial( | 155 base::FieldTrialList::FactoryGetFieldTrial( |
156 content::kGpuCompositingFieldTrialName, kDivisor, | 156 content::kGpuCompositingFieldTrialName, kDivisor, |
157 "disable", 2012, 12, 31, NULL)); | 157 "disable", 2013, 12, 31, NULL)); |
158 | 158 |
159 // Produce the same result on every run of this client. | 159 // Produce the same result on every run of this client. |
160 trial->UseOneTimeRandomization(); | 160 trial->UseOneTimeRandomization(); |
161 | 161 |
162 base::FieldTrial::Probability force_compositing_mode_probability = 0; | 162 base::FieldTrial::Probability force_compositing_mode_probability = 0; |
163 base::FieldTrial::Probability threaded_compositing_probability = 0; | 163 base::FieldTrial::Probability threaded_compositing_probability = 0; |
164 | 164 |
165 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
166 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | |
Nico
2012/10/26 01:15:11
Huh, this used to be on by default on stable and b
| |
167 channel == chrome::VersionInfo::CHANNEL_BETA) { | |
168 // Stable and Beta channels: Non-threaded force-compositing-mode on by | |
169 // default (mac and windows only). | |
170 #if defined(OS_WIN) || defined(OS_MACOSX) | 165 #if defined(OS_WIN) || defined(OS_MACOSX) |
171 force_compositing_mode_probability = 3; | 166 force_compositing_mode_probability = 3; |
Nico
2012/10/26 01:15:11
nit: s/3/kDivisor/ (like last time)
| |
172 #endif | 167 #endif |
173 } else if (channel == chrome::VersionInfo::CHANNEL_DEV || | |
174 channel == chrome::VersionInfo::CHANNEL_CANARY) { | |
175 // Dev and Canary channels: force-compositing-mode and | |
176 // threaded-compositing on with 1/3 probability each. | |
177 force_compositing_mode_probability = 1; | |
178 | |
179 #if defined(OS_MACOSX) || defined(OS_LINUX) | |
180 // Threaded compositing mode isn't feature complete on mac or linux yet: | |
181 // http://crbug.com/133602 for mac | |
182 // http://crbug.com/140866 for linux | |
183 threaded_compositing_probability = 0; | |
184 #else | |
185 if (!CommandLine::ForCurrentProcess()->HasSwitch( | |
186 switches::kDisableThreadedCompositing)) | |
187 threaded_compositing_probability = 1; | |
188 #endif | |
189 } | |
190 | 168 |
191 int force_compositing_group = trial->AppendGroup( | 169 int force_compositing_group = trial->AppendGroup( |
192 content::kGpuCompositingFieldTrialForceCompositingEnabledName, | 170 content::kGpuCompositingFieldTrialForceCompositingEnabledName, |
193 force_compositing_mode_probability); | 171 force_compositing_mode_probability); |
194 int thread_group = trial->AppendGroup( | 172 int thread_group = trial->AppendGroup( |
195 content::kGpuCompositingFieldTrialThreadEnabledName, | 173 content::kGpuCompositingFieldTrialThreadEnabledName, |
196 threaded_compositing_probability); | 174 threaded_compositing_probability); |
197 | 175 |
198 bool force_compositing = (trial->group() == force_compositing_group); | 176 bool force_compositing = (trial->group() == force_compositing_group); |
199 bool thread = (trial->group() == thread_group); | 177 bool thread = (trial->group() == thread_group); |
200 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", | 178 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", |
201 force_compositing); | 179 force_compositing); |
202 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); | 180 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); |
203 } | 181 } |
204 | 182 |
205 } // namespace gpu_util; | 183 } // namespace gpu_util; |
206 | 184 |
OLD | NEW |