| 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/gpu_util.h" | 5 #include "chrome/browser/gpu_util.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 #if defined(OS_WIN) | 185 #if defined(OS_WIN) |
| 186 // Don't run the trial on Windows XP. | 186 // Don't run the trial on Windows XP. |
| 187 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 187 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 188 return; | 188 return; |
| 189 #elif defined(OS_MACOSX) | 189 #elif defined(OS_MACOSX) |
| 190 // Accelerated compositing is only implemented on Mac OSX 10.6 or later. | 190 // Accelerated compositing is only implemented on Mac OSX 10.6 or later. |
| 191 if (base::mac::IsOSLeopardOrEarlier()) | 191 if (base::mac::IsOSLeopardOrEarlier()) |
| 192 return; | 192 return; |
| 193 #endif | 193 #endif |
| 194 | 194 |
| 195 // Don't activate the field trial if force-compositing-mode has been |
| 196 // explicitly disabled from the command line. |
| 197 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 198 switches::kDisableForceCompositingMode)) |
| 199 return; |
| 200 |
| 195 const base::FieldTrial::Probability kDivisor = 100; | 201 const base::FieldTrial::Probability kDivisor = 100; |
| 196 scoped_refptr<base::FieldTrial> trial( | 202 scoped_refptr<base::FieldTrial> trial( |
| 197 base::FieldTrialList::FactoryGetFieldTrial( | 203 base::FieldTrialList::FactoryGetFieldTrial( |
| 198 kForceCompositingModeFieldTrialName, kDivisor, | 204 kForceCompositingModeFieldTrialName, kDivisor, |
| 199 "disable", 2012, 12, 31, NULL)); | 205 "disable", 2012, 12, 31, NULL)); |
| 200 | 206 |
| 201 // Produce the same result on every run of this client. | 207 // Produce the same result on every run of this client. |
| 202 trial->UseOneTimeRandomization(); | 208 trial->UseOneTimeRandomization(); |
| 203 // 50% probability of being in the enabled group. | 209 // 50% probability of being in the enabled group. |
| 204 const base::FieldTrial::Probability kEnableProbability = 50; | 210 const base::FieldTrial::Probability kEnableProbability = 50; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 status = "enabled"; | 368 status = "enabled"; |
| 363 if (kGpuFeatureInfo[i].name == "webgl" && | 369 if (kGpuFeatureInfo[i].name == "webgl" && |
| 364 (command_line.HasSwitch(switches::kDisableAcceleratedCompositing) || | 370 (command_line.HasSwitch(switches::kDisableAcceleratedCompositing) || |
| 365 (flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))) | 371 (flags & content::GPU_FEATURE_TYPE_ACCELERATED_COMPOSITING))) |
| 366 status += "_readback"; | 372 status += "_readback"; |
| 367 bool has_thread = | 373 bool has_thread = |
| 368 command_line.HasSwitch(switches::kEnableThreadedCompositing) && | 374 command_line.HasSwitch(switches::kEnableThreadedCompositing) && |
| 369 !command_line.HasSwitch(switches::kDisableThreadedCompositing); | 375 !command_line.HasSwitch(switches::kDisableThreadedCompositing); |
| 370 if (kGpuFeatureInfo[i].name == "compositing") { | 376 if (kGpuFeatureInfo[i].name == "compositing") { |
| 371 bool force_compositing = | 377 bool force_compositing = |
| 372 command_line.HasSwitch(switches::kForceCompositingMode) || | 378 (command_line.HasSwitch(switches::kForceCompositingMode) && |
| 379 !command_line.HasSwitch( |
| 380 switches::kDisableForceCompositingMode)) || |
| 373 InForceCompositingModeTrial(); | 381 InForceCompositingModeTrial(); |
| 374 if (force_compositing) | 382 if (force_compositing) |
| 375 status += "_force"; | 383 status += "_force"; |
| 376 if (has_thread) | 384 if (has_thread) |
| 377 status += "_threaded"; | 385 status += "_threaded"; |
| 378 } | 386 } |
| 379 if (kGpuFeatureInfo[i].name == "css_animation") { | 387 if (kGpuFeatureInfo[i].name == "css_animation") { |
| 380 if (has_thread) | 388 if (has_thread) |
| 381 status = "accelerated_threaded"; | 389 status = "accelerated_threaded"; |
| 382 else | 390 else |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 kGpuBlacklistFeatureHistogramNamesWin[i], | 573 kGpuBlacklistFeatureHistogramNamesWin[i], |
| 566 1, kNumWinSubVersions * kGpuFeatureNumStatus, | 574 1, kNumWinSubVersions * kGpuFeatureNumStatus, |
| 567 kNumWinSubVersions * kGpuFeatureNumStatus + 1, | 575 kNumWinSubVersions * kGpuFeatureNumStatus + 1, |
| 568 base::Histogram::kUmaTargetedHistogramFlag); | 576 base::Histogram::kUmaTargetedHistogramFlag); |
| 569 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); | 577 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); |
| 570 #endif | 578 #endif |
| 571 } | 579 } |
| 572 } | 580 } |
| 573 | 581 |
| 574 } // namespace gpu_util; | 582 } // namespace gpu_util; |
| OLD | NEW |