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" |
11 #if defined(OS_WIN) | 11 #if defined(OS_WIN) |
12 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
13 #endif | 13 #endif |
14 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
15 #include "chrome/common/chrome_version_info.h" | 15 #include "chrome/common/chrome_version_info.h" |
16 #include "content/public/browser/gpu_data_manager.h" | 16 #include "content/public/browser/gpu_data_manager.h" |
17 #include "content/public/common/content_constants.h" | 17 #include "content/public/common/content_constants.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 | 19 |
20 using content::GpuDataManager; | 20 using content::GpuDataManager; |
21 | 21 |
22 namespace gpu_util { | 22 namespace gpu_util { |
23 | 23 |
| 24 bool ShouldRunStage3DFieldTrial() { |
| 25 #if !defined(OS_WIN) |
| 26 return false; |
| 27 #else |
| 28 if (base::win::GetVersion() >= base::win::VERSION_VISTA) |
| 29 return false; |
| 30 return true; |
| 31 #endif |
| 32 } |
| 33 |
| 34 void InitializeStage3DFieldTrial() { |
| 35 if (!ShouldRunStage3DFieldTrial()) { |
| 36 base::FieldTrial* trial = |
| 37 base::FieldTrialList::Find(content::kStage3DFieldTrialName); |
| 38 if (trial) |
| 39 trial->Disable(); |
| 40 return; |
| 41 } |
| 42 |
| 43 const base::FieldTrial::Probability kDivisor = 1000; |
| 44 scoped_refptr<base::FieldTrial> trial( |
| 45 base::FieldTrialList::FactoryGetFieldTrial( |
| 46 content::kStage3DFieldTrialName, kDivisor, |
| 47 content::kStage3DFieldTrialEnabledName, 2013, 3, 1, NULL)); |
| 48 |
| 49 // Produce the same result on every run of this client. |
| 50 trial->UseOneTimeRandomization(); |
| 51 |
| 52 // Kill-switch, so disabled unless we get info from server. |
| 53 int blacklisted_group = trial->AppendGroup( |
| 54 content::kStage3DFieldTrialBlacklistedName, kDivisor); |
| 55 |
| 56 bool enabled = (trial->group() != blacklisted_group); |
| 57 |
| 58 UMA_HISTOGRAM_BOOLEAN("GPU.Stage3DFieldTrial", enabled); |
| 59 } |
| 60 |
24 void DisableCompositingFieldTrial() { | 61 void DisableCompositingFieldTrial() { |
25 base::FieldTrial* trial = | 62 base::FieldTrial* trial = |
26 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); | 63 base::FieldTrialList::Find(content::kGpuCompositingFieldTrialName); |
27 if (trial) | 64 if (trial) |
28 trial->Disable(); | 65 trial->Disable(); |
29 } | 66 } |
30 | 67 |
31 bool ShouldRunCompositingFieldTrial() { | 68 bool ShouldRunCompositingFieldTrial() { |
32 // Enable the field trial only on desktop OS's. | 69 // Enable the field trial only on desktop OS's. |
33 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)) | 70 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 152 |
116 bool force_compositing = (trial->group() == force_compositing_group); | 153 bool force_compositing = (trial->group() == force_compositing_group); |
117 bool thread = (trial->group() == thread_group); | 154 bool thread = (trial->group() == thread_group); |
118 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", | 155 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", |
119 force_compositing); | 156 force_compositing); |
120 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); | 157 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); |
121 } | 158 } |
122 | 159 |
123 } // namespace gpu_util; | 160 } // namespace gpu_util; |
124 | 161 |
OLD | NEW |