| 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 // Note: Threaded compositing mode isn't feature complete on mac or linux yet: |
| 166 // http://crbug.com/133602 for mac |
| 167 // http://crbug.com/140866 for linux |
| 168 |
| 165 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 169 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
| 166 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | 170 if (channel == chrome::VersionInfo::CHANNEL_CANARY || |
| 167 channel == chrome::VersionInfo::CHANNEL_BETA) { | 171 channel == chrome::VersionInfo::CHANNEL_DEV) { |
| 168 // Stable and Beta channels: Non-threaded force-compositing-mode on by | 172 #if defined(OS_WIN) |
| 169 // default (mac and windows only). | 173 // Enable threaded compositing on Windows. |
| 170 #if defined(OS_WIN) || defined(OS_MACOSX) | 174 threaded_compositing_probability = kDivisor; |
| 171 force_compositing_mode_probability = 3; | 175 #elif defined(OS_MACOSX) |
| 172 #endif | 176 // Enable force-compositing-mode on the Mac. |
| 173 } else if (channel == chrome::VersionInfo::CHANNEL_DEV || | 177 force_compositing_mode_probability = kDivisor; |
| 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 | 178 #endif |
| 189 } | 179 } |
| 190 | 180 |
| 191 int force_compositing_group = trial->AppendGroup( | 181 int force_compositing_group = trial->AppendGroup( |
| 192 content::kGpuCompositingFieldTrialForceCompositingEnabledName, | 182 content::kGpuCompositingFieldTrialForceCompositingEnabledName, |
| 193 force_compositing_mode_probability); | 183 force_compositing_mode_probability); |
| 194 int thread_group = trial->AppendGroup( | 184 int thread_group = trial->AppendGroup( |
| 195 content::kGpuCompositingFieldTrialThreadEnabledName, | 185 content::kGpuCompositingFieldTrialThreadEnabledName, |
| 196 threaded_compositing_probability); | 186 threaded_compositing_probability); |
| 197 | 187 |
| 198 bool force_compositing = (trial->group() == force_compositing_group); | 188 bool force_compositing = (trial->group() == force_compositing_group); |
| 199 bool thread = (trial->group() == thread_group); | 189 bool thread = (trial->group() == thread_group); |
| 200 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", | 190 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", |
| 201 force_compositing); | 191 force_compositing); |
| 202 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); | 192 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); |
| 203 } | 193 } |
| 204 | 194 |
| 205 } // namespace gpu_util; | 195 } // namespace gpu_util; |
| 206 | 196 |
| OLD | NEW |