| 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 "content/browser/gpu/gpu_util.h" | 5 #include "content/browser/gpu/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/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas"; | 23 const char kGpuFeatureNameAccelerated2dCanvas[] = "accelerated_2d_canvas"; |
| 24 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; | 24 const char kGpuFeatureNameAcceleratedCompositing[] = "accelerated_compositing"; |
| 25 const char kGpuFeatureNameWebgl[] = "webgl"; | 25 const char kGpuFeatureNameWebgl[] = "webgl"; |
| 26 const char kGpuFeatureNameMultisampling[] = "multisampling"; | 26 const char kGpuFeatureNameMultisampling[] = "multisampling"; |
| 27 const char kGpuFeatureNameFlash3d[] = "flash_3d"; | 27 const char kGpuFeatureNameFlash3d[] = "flash_3d"; |
| 28 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d"; | 28 const char kGpuFeatureNameFlashStage3d[] = "flash_stage3d"; |
| 29 const char kGpuFeatureNameTextureSharing[] = "texture_sharing"; | 29 const char kGpuFeatureNameTextureSharing[] = "texture_sharing"; |
| 30 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode"; | 30 const char kGpuFeatureNameAcceleratedVideoDecode[] = "accelerated_video_decode"; |
| 31 const char kGpuFeatureName3dCss[] = "3d_css"; | 31 const char kGpuFeatureName3dCss[] = "3d_css"; |
| 32 const char kGpuFeatureNameAcceleratedVideo[] = "accelerated_video"; | 32 const char kGpuFeatureNameAcceleratedVideo[] = "accelerated_video"; |
| 33 const char kGpuFeatureNamePanelFitting[] = "panel_fitting"; |
| 33 const char kGpuFeatureNameAll[] = "all"; | 34 const char kGpuFeatureNameAll[] = "all"; |
| 34 const char kGpuFeatureNameUnknown[] = "unknown"; | 35 const char kGpuFeatureNameUnknown[] = "unknown"; |
| 35 | 36 |
| 36 enum GpuFeatureStatus { | 37 enum GpuFeatureStatus { |
| 37 kGpuFeatureEnabled = 0, | 38 kGpuFeatureEnabled = 0, |
| 38 kGpuFeatureBlacklisted = 1, | 39 kGpuFeatureBlacklisted = 1, |
| 39 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted | 40 kGpuFeatureDisabled = 2, // disabled by user but not blacklisted |
| 40 kGpuFeatureNumStatus | 41 kGpuFeatureNumStatus |
| 41 }; | 42 }; |
| 42 | 43 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 if (feature_string == kGpuFeatureNameFlashStage3d) | 103 if (feature_string == kGpuFeatureNameFlashStage3d) |
| 103 return content::GPU_FEATURE_TYPE_FLASH_STAGE3D; | 104 return content::GPU_FEATURE_TYPE_FLASH_STAGE3D; |
| 104 if (feature_string == kGpuFeatureNameTextureSharing) | 105 if (feature_string == kGpuFeatureNameTextureSharing) |
| 105 return content::GPU_FEATURE_TYPE_TEXTURE_SHARING; | 106 return content::GPU_FEATURE_TYPE_TEXTURE_SHARING; |
| 106 if (feature_string == kGpuFeatureNameAcceleratedVideoDecode) | 107 if (feature_string == kGpuFeatureNameAcceleratedVideoDecode) |
| 107 return content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE; | 108 return content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE; |
| 108 if (feature_string == kGpuFeatureName3dCss) | 109 if (feature_string == kGpuFeatureName3dCss) |
| 109 return content::GPU_FEATURE_TYPE_3D_CSS; | 110 return content::GPU_FEATURE_TYPE_3D_CSS; |
| 110 if (feature_string == kGpuFeatureNameAcceleratedVideo) | 111 if (feature_string == kGpuFeatureNameAcceleratedVideo) |
| 111 return content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO; | 112 return content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO; |
| 113 if (feature_string == kGpuFeatureNamePanelFitting) |
| 114 return content::GPU_FEATURE_TYPE_PANEL_FITTING; |
| 112 if (feature_string == kGpuFeatureNameAll) | 115 if (feature_string == kGpuFeatureNameAll) |
| 113 return content::GPU_FEATURE_TYPE_ALL; | 116 return content::GPU_FEATURE_TYPE_ALL; |
| 114 return content::GPU_FEATURE_TYPE_UNKNOWN; | 117 return content::GPU_FEATURE_TYPE_UNKNOWN; |
| 115 } | 118 } |
| 116 | 119 |
| 117 std::string GpuFeatureTypeToString(GpuFeatureType type) { | 120 std::string GpuFeatureTypeToString(GpuFeatureType type) { |
| 118 std::vector<std::string> matches; | 121 std::vector<std::string> matches; |
| 119 if (type == content::GPU_FEATURE_TYPE_ALL) { | 122 if (type == content::GPU_FEATURE_TYPE_ALL) { |
| 120 matches.push_back(kGpuFeatureNameAll); | 123 matches.push_back(kGpuFeatureNameAll); |
| 121 } else { | 124 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 132 if (type & content::GPU_FEATURE_TYPE_FLASH_STAGE3D) | 135 if (type & content::GPU_FEATURE_TYPE_FLASH_STAGE3D) |
| 133 matches.push_back(kGpuFeatureNameFlashStage3d); | 136 matches.push_back(kGpuFeatureNameFlashStage3d); |
| 134 if (type & content::GPU_FEATURE_TYPE_TEXTURE_SHARING) | 137 if (type & content::GPU_FEATURE_TYPE_TEXTURE_SHARING) |
| 135 matches.push_back(kGpuFeatureNameTextureSharing); | 138 matches.push_back(kGpuFeatureNameTextureSharing); |
| 136 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) | 139 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE) |
| 137 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode); | 140 matches.push_back(kGpuFeatureNameAcceleratedVideoDecode); |
| 138 if (type & content::GPU_FEATURE_TYPE_3D_CSS) | 141 if (type & content::GPU_FEATURE_TYPE_3D_CSS) |
| 139 matches.push_back(kGpuFeatureName3dCss); | 142 matches.push_back(kGpuFeatureName3dCss); |
| 140 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO) | 143 if (type & content::GPU_FEATURE_TYPE_ACCELERATED_VIDEO) |
| 141 matches.push_back(kGpuFeatureNameAcceleratedVideo); | 144 matches.push_back(kGpuFeatureNameAcceleratedVideo); |
| 145 if (type & content::GPU_FEATURE_TYPE_PANEL_FITTING) |
| 146 matches.push_back(kGpuFeatureNamePanelFitting); |
| 142 if (!matches.size()) | 147 if (!matches.size()) |
| 143 matches.push_back(kGpuFeatureNameUnknown); | 148 matches.push_back(kGpuFeatureNameUnknown); |
| 144 } | 149 } |
| 145 return JoinString(matches, ','); | 150 return JoinString(matches, ','); |
| 146 } | 151 } |
| 147 | 152 |
| 148 GpuSwitchingOption StringToGpuSwitchingOption( | 153 GpuSwitchingOption StringToGpuSwitchingOption( |
| 149 const std::string& switching_string) { | 154 const std::string& switching_string) { |
| 150 if (switching_string == switches::kGpuSwitchingOptionNameAutomatic) | 155 if (switching_string == switches::kGpuSwitchingOptionNameAutomatic) |
| 151 return content::GPU_SWITCHING_OPTION_AUTOMATIC; | 156 return content::GPU_SWITCHING_OPTION_AUTOMATIC; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 kGpuBlacklistFeatureHistogramNamesWin[i], | 253 kGpuBlacklistFeatureHistogramNamesWin[i], |
| 249 1, kNumWinSubVersions * kGpuFeatureNumStatus, | 254 1, kNumWinSubVersions * kGpuFeatureNumStatus, |
| 250 kNumWinSubVersions * kGpuFeatureNumStatus + 1, | 255 kNumWinSubVersions * kGpuFeatureNumStatus + 1, |
| 251 base::Histogram::kUmaTargetedHistogramFlag); | 256 base::Histogram::kUmaTargetedHistogramFlag); |
| 252 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); | 257 histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value)); |
| 253 #endif | 258 #endif |
| 254 } | 259 } |
| 255 } | 260 } |
| 256 | 261 |
| 257 } // namespace gpu_util; | 262 } // namespace gpu_util; |
| OLD | NEW |