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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
115 content::kGpuCompositingFieldTrialThreadEnabledName, | 115 content::kGpuCompositingFieldTrialThreadEnabledName, |
116 threaded_compositing_probability); | 116 threaded_compositing_probability); |
117 | 117 |
118 bool force_compositing = (trial->group() == force_compositing_group); | 118 bool force_compositing = (trial->group() == force_compositing_group); |
119 bool thread = (trial->group() == thread_group); | 119 bool thread = (trial->group() == thread_group); |
120 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", | 120 UMA_HISTOGRAM_BOOLEAN("GPU.InForceCompositingModeFieldTrial", |
121 force_compositing); | 121 force_compositing); |
122 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); | 122 UMA_HISTOGRAM_BOOLEAN("GPU.InCompositorThreadFieldTrial", thread); |
123 } | 123 } |
124 | 124 |
125 bool ShouldRunStage3DFieldTrial() { | |
126 #if !defined(OS_WIN) | |
127 return false; | |
128 #else | |
129 if (base::win::GetVersion() >= base::win::VERSION_VISTA) | |
130 return false; | |
131 return true; | |
132 #endif | |
133 } | |
134 | |
135 void InitializeStage3DFieldTrial() { | |
136 if (!ShouldRunStage3DFieldTrial()) { | |
137 base::FieldTrial* trial = | |
138 base::FieldTrialList::Find(content::kStage3DFieldTrialName); | |
139 if (trial) | |
140 trial->Disable(); | |
Alexei Svitkine (slow)
2012/09/19 20:33:16
Disabling the trial has the effect of choosing the
| |
141 return; | |
142 } | |
143 | |
144 const base::FieldTrial::Probability kDivisor = 1000; | |
145 scoped_refptr<base::FieldTrial> trial( | |
146 base::FieldTrialList::FactoryGetFieldTrial( | |
147 content::kStage3DFieldTrialName, kDivisor, | |
148 content::kStage3DFieldTrialBlacklistedName, 2013, 3, 1, NULL)); | |
149 | |
150 // Produce the same result on every run of this client. | |
151 trial->UseOneTimeRandomization(); | |
152 | |
153 // Kill-switch, so disabled unless we get info from server. | |
154 int enabled_group = trial->AppendGroup( | |
155 content::kStage3DFieldTrialEnabledName, 0); | |
156 | |
157 bool enabled = (trial->group() == enabled_group); | |
158 | |
159 UMA_HISTOGRAM_BOOLEAN("GPU.Stage3DFieldTrial", enabled); | |
160 } | |
161 | |
125 // Load GPU Blacklist, collect preliminary gpu info, and compute preliminary | 162 // Load GPU Blacklist, collect preliminary gpu info, and compute preliminary |
126 // gpu feature flags. | 163 // gpu feature flags. |
127 void InitializeGpuDataManager(const CommandLine& command_line) { | 164 void InitializeGpuDataManager(const CommandLine& command_line) { |
128 if (command_line.HasSwitch(switches::kSkipGpuDataLoading)) | 165 if (command_line.HasSwitch(switches::kSkipGpuDataLoading)) |
129 return; | 166 return; |
130 | 167 |
131 std::string chrome_version_string = "0"; | 168 std::string chrome_version_string = "0"; |
132 std::string gpu_blacklist_json_string; | 169 std::string gpu_blacklist_json_string; |
133 if (!command_line.HasSwitch(switches::kIgnoreGpuBlacklist)) { | 170 if (!command_line.HasSwitch(switches::kIgnoreGpuBlacklist)) { |
134 chrome::VersionInfo chrome_version_info; | 171 chrome::VersionInfo chrome_version_info; |
135 if (chrome_version_info.is_valid()) | 172 if (chrome_version_info.is_valid()) |
136 chrome_version_string = chrome_version_info.Version(); | 173 chrome_version_string = chrome_version_info.Version(); |
137 | 174 |
138 const base::StringPiece gpu_blacklist_json( | 175 const base::StringPiece gpu_blacklist_json( |
139 ResourceBundle::GetSharedInstance().GetRawDataResource( | 176 ResourceBundle::GetSharedInstance().GetRawDataResource( |
140 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); | 177 IDR_GPU_BLACKLIST, ui::SCALE_FACTOR_NONE)); |
141 gpu_blacklist_json_string = gpu_blacklist_json.as_string(); | 178 gpu_blacklist_json_string = gpu_blacklist_json.as_string(); |
142 } | 179 } |
143 content::GpuDataManager::GetInstance()->Initialize( | 180 content::GpuDataManager::GetInstance()->Initialize( |
144 chrome_version_string, gpu_blacklist_json_string); | 181 chrome_version_string, gpu_blacklist_json_string); |
145 } | 182 } |
146 | 183 |
147 } // namespace gpu_util; | 184 } // namespace gpu_util; |
148 | 185 |
OLD | NEW |