Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: gpu/config/gpu_test_config.cc

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/config/gpu_test_config.h ('k') | gpu/config/gpu_test_expectations_parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "gpu/config/gpu_test_config.h" 5 #include "gpu/config/gpu_test_config.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include "base/logging.h" 10 #include "base/logging.h"
8 #include "base/sys_info.h" 11 #include "base/sys_info.h"
9 #include "gpu/config/gpu_info.h" 12 #include "gpu/config/gpu_info.h"
10 #include "gpu/config/gpu_info_collector.h" 13 #include "gpu/config/gpu_info_collector.h"
11 #include "gpu/config/gpu_test_expectations_parser.h" 14 #include "gpu/config/gpu_test_expectations_parser.h"
12 15
13 #if defined(OS_MACOSX) 16 #if defined(OS_MACOSX)
14 #include "base/mac/mac_util.h" 17 #include "base/mac/mac_util.h"
15 #elif defined(OS_WIN) 18 #elif defined(OS_WIN)
16 #include "base/win/windows_version.h" 19 #include "base/win/windows_version.h"
17 #endif 20 #endif
18 21
19 namespace gpu { 22 namespace gpu {
20 23
21 namespace { 24 namespace {
22 25
23 GPUTestConfig::OS GetCurrentOS() { 26 GPUTestConfig::OS GetCurrentOS() {
24 #if defined(OS_CHROMEOS) 27 #if defined(OS_CHROMEOS)
25 return GPUTestConfig::kOsChromeOS; 28 return GPUTestConfig::kOsChromeOS;
26 #elif defined(OS_LINUX) || defined(OS_OPENBSD) 29 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
27 return GPUTestConfig::kOsLinux; 30 return GPUTestConfig::kOsLinux;
28 #elif defined(OS_WIN) 31 #elif defined(OS_WIN)
29 int32 major_version = 0; 32 int32_t major_version = 0;
30 int32 minor_version = 0; 33 int32_t minor_version = 0;
31 int32 bugfix_version = 0; 34 int32_t bugfix_version = 0;
32 base::SysInfo::OperatingSystemVersionNumbers( 35 base::SysInfo::OperatingSystemVersionNumbers(
33 &major_version, &minor_version, &bugfix_version); 36 &major_version, &minor_version, &bugfix_version);
34 if (major_version == 5) 37 if (major_version == 5)
35 return GPUTestConfig::kOsWinXP; 38 return GPUTestConfig::kOsWinXP;
36 if (major_version == 6 && minor_version == 0) 39 if (major_version == 6 && minor_version == 0)
37 return GPUTestConfig::kOsWinVista; 40 return GPUTestConfig::kOsWinVista;
38 if (major_version == 6 && minor_version == 1) 41 if (major_version == 6 && minor_version == 1)
39 return GPUTestConfig::kOsWin7; 42 return GPUTestConfig::kOsWin7;
40 if (major_version == 6 && (minor_version == 2 || minor_version == 3)) 43 if (major_version == 6 && (minor_version == 2 || minor_version == 3))
41 return GPUTestConfig::kOsWin8; 44 return GPUTestConfig::kOsWin8;
42 if (major_version == 10) 45 if (major_version == 10)
43 return GPUTestConfig::kOsWin10; 46 return GPUTestConfig::kOsWin10;
44 #elif defined(OS_MACOSX) 47 #elif defined(OS_MACOSX)
45 int32 major_version = 0; 48 int32_t major_version = 0;
46 int32 minor_version = 0; 49 int32_t minor_version = 0;
47 int32 bugfix_version = 0; 50 int32_t bugfix_version = 0;
48 base::SysInfo::OperatingSystemVersionNumbers( 51 base::SysInfo::OperatingSystemVersionNumbers(
49 &major_version, &minor_version, &bugfix_version); 52 &major_version, &minor_version, &bugfix_version);
50 if (major_version == 10) { 53 if (major_version == 10) {
51 switch (minor_version) { 54 switch (minor_version) {
52 case 5: 55 case 5:
53 return GPUTestConfig::kOsMacLeopard; 56 return GPUTestConfig::kOsMacLeopard;
54 case 6: 57 case 6:
55 return GPUTestConfig::kOsMacSnowLeopard; 58 return GPUTestConfig::kOsMacSnowLeopard;
56 case 7: 59 case 7:
57 return GPUTestConfig::kOsMacLion; 60 return GPUTestConfig::kOsMacLion;
(...skipping 18 matching lines...) Expand all
76 GPUTestConfig::GPUTestConfig() 79 GPUTestConfig::GPUTestConfig()
77 : validate_gpu_info_(true), 80 : validate_gpu_info_(true),
78 os_(kOsUnknown), 81 os_(kOsUnknown),
79 gpu_device_id_(0), 82 gpu_device_id_(0),
80 build_type_(kBuildTypeUnknown), 83 build_type_(kBuildTypeUnknown),
81 api_(kAPIUnknown) {} 84 api_(kAPIUnknown) {}
82 85
83 GPUTestConfig::~GPUTestConfig() { 86 GPUTestConfig::~GPUTestConfig() {
84 } 87 }
85 88
86 void GPUTestConfig::set_os(int32 os) { 89 void GPUTestConfig::set_os(int32_t os) {
87 DCHECK_EQ(0, os & ~(kOsAndroid | kOsWin | kOsMac | kOsLinux | kOsChromeOS)); 90 DCHECK_EQ(0, os & ~(kOsAndroid | kOsWin | kOsMac | kOsLinux | kOsChromeOS));
88 os_ = os; 91 os_ = os;
89 } 92 }
90 93
91 void GPUTestConfig::AddGPUVendor(uint32 gpu_vendor) { 94 void GPUTestConfig::AddGPUVendor(uint32_t gpu_vendor) {
92 DCHECK_NE(0u, gpu_vendor); 95 DCHECK_NE(0u, gpu_vendor);
93 for (size_t i = 0; i < gpu_vendor_.size(); ++i) 96 for (size_t i = 0; i < gpu_vendor_.size(); ++i)
94 DCHECK_NE(gpu_vendor_[i], gpu_vendor); 97 DCHECK_NE(gpu_vendor_[i], gpu_vendor);
95 gpu_vendor_.push_back(gpu_vendor); 98 gpu_vendor_.push_back(gpu_vendor);
96 } 99 }
97 100
98 void GPUTestConfig::set_gpu_device_id(uint32 id) { 101 void GPUTestConfig::set_gpu_device_id(uint32_t id) {
99 gpu_device_id_ = id; 102 gpu_device_id_ = id;
100 } 103 }
101 104
102 void GPUTestConfig::set_build_type(int32 build_type) { 105 void GPUTestConfig::set_build_type(int32_t build_type) {
103 DCHECK_EQ(0, build_type & ~(kBuildTypeRelease | kBuildTypeDebug)); 106 DCHECK_EQ(0, build_type & ~(kBuildTypeRelease | kBuildTypeDebug));
104 build_type_ = build_type; 107 build_type_ = build_type;
105 } 108 }
106 109
107 void GPUTestConfig::set_api(int32 api) { 110 void GPUTestConfig::set_api(int32_t api) {
108 DCHECK_EQ(0, api & ~(kAPID3D9 | kAPID3D11 | kAPIGLDesktop | kAPIGLES)); 111 DCHECK_EQ(0, api & ~(kAPID3D9 | kAPID3D11 | kAPIGLDesktop | kAPIGLES));
109 api_ = api; 112 api_ = api;
110 } 113 }
111 114
112 bool GPUTestConfig::IsValid() const { 115 bool GPUTestConfig::IsValid() const {
113 if (!validate_gpu_info_) 116 if (!validate_gpu_info_)
114 return true; 117 return true;
115 if (gpu_device_id_ != 0 && (gpu_vendor_.size() != 1 || gpu_vendor_[0] == 0)) 118 if (gpu_device_id_ != 0 && (gpu_vendor_.size() != 1 || gpu_vendor_[0] == 0))
116 return false; 119 return false;
117 return true; 120 return true;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 validate_gpu_info_ = false; 153 validate_gpu_info_ = false;
151 } 154 }
152 155
153 void GPUTestConfig::ClearGPUVendor() { 156 void GPUTestConfig::ClearGPUVendor() {
154 gpu_vendor_.clear(); 157 gpu_vendor_.clear();
155 } 158 }
156 159
157 GPUTestBotConfig::~GPUTestBotConfig() { 160 GPUTestBotConfig::~GPUTestBotConfig() {
158 } 161 }
159 162
160 void GPUTestBotConfig::AddGPUVendor(uint32 gpu_vendor) { 163 void GPUTestBotConfig::AddGPUVendor(uint32_t gpu_vendor) {
161 DCHECK_EQ(0u, GPUTestConfig::gpu_vendor().size()); 164 DCHECK_EQ(0u, GPUTestConfig::gpu_vendor().size());
162 GPUTestConfig::AddGPUVendor(gpu_vendor); 165 GPUTestConfig::AddGPUVendor(gpu_vendor);
163 } 166 }
164 167
165 bool GPUTestBotConfig::SetGPUInfo(const GPUInfo& gpu_info) { 168 bool GPUTestBotConfig::SetGPUInfo(const GPUInfo& gpu_info) {
166 DCHECK(validate_gpu_info_); 169 DCHECK(validate_gpu_info_);
167 if (gpu_info.gpu.device_id == 0 || gpu_info.gpu.vendor_id == 0) 170 if (gpu_info.gpu.device_id == 0 || gpu_info.gpu.vendor_id == 0)
168 return false; 171 return false;
169 ClearGPUVendor(); 172 ClearGPUVendor();
170 AddGPUVendor(gpu_info.gpu.vendor_id); 173 AddGPUVendor(gpu_info.gpu.vendor_id);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 // Blacklist rule #79 disables all Gpu acceleration before Windows 7. 309 // Blacklist rule #79 disables all Gpu acceleration before Windows 7.
307 if (base::win::GetVersion() <= base::win::VERSION_VISTA) { 310 if (base::win::GetVersion() <= base::win::VERSION_VISTA) {
308 return true; 311 return true;
309 } 312 }
310 #endif 313 #endif
311 return false; 314 return false;
312 } 315 }
313 316
314 } // namespace gpu 317 } // namespace gpu
315 318
OLDNEW
« no previous file with comments | « gpu/config/gpu_test_config.h ('k') | gpu/config/gpu_test_expectations_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698