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" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/stringprintf.h" | 14 #include "base/stringprintf.h" |
15 #include "base/sys_info.h" | 15 #include "base/sys_info.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 #include "base/version.h" | 17 #include "base/version.h" |
18 #include "chrome/browser/gpu_blacklist.h" | 18 #include "chrome/browser/gpu_blacklist.h" |
19 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
20 #include "content/public/browser/gpu_data_manager.h" | 20 #include "content/public/browser/gpu_data_manager.h" |
21 #include "content/public/common/compositor_util.h" | 21 #include "content/public/common/compositor_util.h" |
22 #include "content/public/common/content_constants.h" | 22 #include "content/public/common/content_constants.h" |
23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
24 #include "content/public/common/gpu_info.h" | 24 #include "content/public/common/gpu_info.h" |
25 | 25 |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 #include "base/win/windows_version.h" | 27 #include "base/win/windows_version.h" |
28 #elif defined(OS_MACOSX) | |
29 #include "base/mac/mac_util.h" | |
30 #endif | 28 #endif |
31 | 29 |
32 using content::GpuDataManager; | 30 using content::GpuDataManager; |
33 using content::GpuFeatureType; | 31 using content::GpuFeatureType; |
34 | 32 |
35 namespace { | 33 namespace { |
36 | 34 |
37 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas"; | 35 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas"; |
38 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; | 36 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; |
39 const char kGpuFeatureNameWebgl[] = "webgl"; | 37 const char kGpuFeatureNameWebgl[] = "webgl"; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 174 |
177 void InitializeCompositingFieldTrial() { | 175 void InitializeCompositingFieldTrial() { |
178 // Enable the field trial only on desktop OS's. | 176 // Enable the field trial only on desktop OS's. |
179 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)) | 177 #if !(defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)) |
180 return; | 178 return; |
181 #endif | 179 #endif |
182 #if defined(OS_WIN) | 180 #if defined(OS_WIN) |
183 // Don't run the trial on Windows XP. | 181 // Don't run the trial on Windows XP. |
184 if (base::win::GetVersion() < base::win::VERSION_VISTA) | 182 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
185 return; | 183 return; |
186 #elif defined(OS_MACOSX) | |
187 // Accelerated compositing is only implemented on Mac OSX 10.6 or later. | |
188 if (base::mac::IsOSLeopardOrEarlier()) | |
189 return; | |
190 #endif | 184 #endif |
191 | 185 |
192 // The performance of accelerated compositing is too low with software | 186 // The performance of accelerated compositing is too low with software |
193 // rendering. | 187 // rendering. |
194 if (content::GpuDataManager::GetInstance()->ShouldUseSoftwareRendering()) | 188 if (content::GpuDataManager::GetInstance()->ShouldUseSoftwareRendering()) |
195 return; | 189 return; |
196 | 190 |
197 // Don't activate the field trial if force-compositing-mode has been | 191 // Don't activate the field trial if force-compositing-mode has been |
198 // explicitly disabled from the command line. | 192 // explicitly disabled from the command line. |
199 if (CommandLine::ForCurrentProcess()->HasSwitch( | 193 if (CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 kGpuBlacklistFeatureHistogramNamesWin[i], | 614 kGpuBlacklistFeatureHistogramNamesWin[i], |
621 1, kNumWinSubVersions * kGpuFeatureNumStatus, | 615 1, kNumWinSubVersions * kGpuFeatureNumStatus, |
622 kNumWinSubVersions * kGpuFeatureNumStatus + 1, | 616 kNumWinSubVersions * kGpuFeatureNumStatus + 1, |
623 base::Histogram::kUmaTargetedHistogramFlag); | 617 base::Histogram::kUmaTargetedHistogramFlag); |
624 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); | 618 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); |
625 #endif | 619 #endif |
626 } | 620 } |
627 } | 621 } |
628 | 622 |
629 } // namespace gpu_util; | 623 } // namespace gpu_util; |
OLD | NEW |