OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_control_list.h" | 5 #include "content/browser/gpu/gpu_control_list.h" |
6 | 6 |
7 #include "base/cpu.h" | 7 #include "base/cpu.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 return kVersionStyleLexical; | 210 return kVersionStyleLexical; |
211 return kVersionStyleUnknown; | 211 return kVersionStyleUnknown; |
212 } | 212 } |
213 | 213 |
214 GpuControlList::OsInfo::OsInfo(const std::string& os, | 214 GpuControlList::OsInfo::OsInfo(const std::string& os, |
215 const std::string& version_op, | 215 const std::string& version_op, |
216 const std::string& version_string, | 216 const std::string& version_string, |
217 const std::string& version_string2) { | 217 const std::string& version_string2) { |
218 type_ = StringToOsType(os); | 218 type_ = StringToOsType(os); |
219 if (type_ != kOsUnknown) { | 219 if (type_ != kOsUnknown) { |
220 version_info_.reset( | 220 version_info_.reset(new VersionInfo( |
221 new VersionInfo(version_op, "", version_string, version_string2)); | 221 version_op, std::string(), version_string, version_string2)); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 GpuControlList::OsInfo::~OsInfo() {} | 225 GpuControlList::OsInfo::~OsInfo() {} |
226 | 226 |
227 bool GpuControlList::OsInfo::Contains(OsType type, | 227 bool GpuControlList::OsInfo::Contains(OsType type, |
228 const std::string& version) const { | 228 const std::string& version) const { |
229 if (!IsValid()) | 229 if (!IsValid()) |
230 return false; | 230 return false; |
231 if (type_ != type && type_ != kOsAny) | 231 if (type_ != type && type_ != kOsAny) |
(...skipping 26 matching lines...) Expand all Loading... |
258 return kOsUnknown; | 258 return kOsUnknown; |
259 } | 259 } |
260 | 260 |
261 GpuControlList::MachineModelInfo::MachineModelInfo( | 261 GpuControlList::MachineModelInfo::MachineModelInfo( |
262 const std::string& name_op, | 262 const std::string& name_op, |
263 const std::string& name_value, | 263 const std::string& name_value, |
264 const std::string& version_op, | 264 const std::string& version_op, |
265 const std::string& version_string, | 265 const std::string& version_string, |
266 const std::string& version_string2) { | 266 const std::string& version_string2) { |
267 name_info_.reset(new StringInfo(name_op, name_value)); | 267 name_info_.reset(new StringInfo(name_op, name_value)); |
268 version_info_.reset( | 268 version_info_.reset(new VersionInfo( |
269 new VersionInfo(version_op, "", version_string, version_string2)); | 269 version_op, std::string(), version_string, version_string2)); |
270 } | 270 } |
271 | 271 |
272 GpuControlList::MachineModelInfo::~MachineModelInfo() {} | 272 GpuControlList::MachineModelInfo::~MachineModelInfo() {} |
273 | 273 |
274 bool GpuControlList::MachineModelInfo::Contains( | 274 bool GpuControlList::MachineModelInfo::Contains( |
275 const std::string& name, const std::string& version) const { | 275 const std::string& name, const std::string& version) const { |
276 if (!IsValid()) | 276 if (!IsValid()) |
277 return false; | 277 return false; |
278 if (!name_info_->Contains(name)) | 278 if (!name_info_->Contains(name)) |
279 return false; | 279 return false; |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 driver_version_info_.reset(new VersionInfo( | 857 driver_version_info_.reset(new VersionInfo( |
858 version_op, version_style, version_string, version_string2)); | 858 version_op, version_style, version_string, version_string2)); |
859 return driver_version_info_->IsValid(); | 859 return driver_version_info_->IsValid(); |
860 } | 860 } |
861 | 861 |
862 bool GpuControlList::GpuControlListEntry::SetDriverDateInfo( | 862 bool GpuControlList::GpuControlListEntry::SetDriverDateInfo( |
863 const std::string& date_op, | 863 const std::string& date_op, |
864 const std::string& date_string, | 864 const std::string& date_string, |
865 const std::string& date_string2) { | 865 const std::string& date_string2) { |
866 driver_date_info_.reset( | 866 driver_date_info_.reset( |
867 new VersionInfo(date_op, "", date_string, date_string2)); | 867 new VersionInfo(date_op, std::string(), date_string, date_string2)); |
868 return driver_date_info_->IsValid(); | 868 return driver_date_info_->IsValid(); |
869 } | 869 } |
870 | 870 |
871 bool GpuControlList::GpuControlListEntry::SetGLVendorInfo( | 871 bool GpuControlList::GpuControlListEntry::SetGLVendorInfo( |
872 const std::string& vendor_op, | 872 const std::string& vendor_op, |
873 const std::string& vendor_value) { | 873 const std::string& vendor_value) { |
874 gl_vendor_info_.reset(new StringInfo(vendor_op, vendor_value)); | 874 gl_vendor_info_.reset(new StringInfo(vendor_op, vendor_value)); |
875 return gl_vendor_info_->IsValid(); | 875 return gl_vendor_info_->IsValid(); |
876 } | 876 } |
877 | 877 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 DCHECK(value); | 1341 DCHECK(value); |
1342 const base::DictionaryValue* browser_version_value = NULL; | 1342 const base::DictionaryValue* browser_version_value = NULL; |
1343 if (value->GetDictionary("browser_version", &browser_version_value)) { | 1343 if (value->GetDictionary("browser_version", &browser_version_value)) { |
1344 std::string version_op = "any"; | 1344 std::string version_op = "any"; |
1345 std::string version_string; | 1345 std::string version_string; |
1346 std::string version_string2; | 1346 std::string version_string2; |
1347 browser_version_value->GetString(kOp, &version_op); | 1347 browser_version_value->GetString(kOp, &version_op); |
1348 browser_version_value->GetString("number", &version_string); | 1348 browser_version_value->GetString("number", &version_string); |
1349 browser_version_value->GetString("number2", &version_string2); | 1349 browser_version_value->GetString("number2", &version_string2); |
1350 scoped_ptr<VersionInfo> browser_version_info; | 1350 scoped_ptr<VersionInfo> browser_version_info; |
1351 browser_version_info.reset( | 1351 browser_version_info.reset(new VersionInfo( |
1352 new VersionInfo(version_op, "", version_string, version_string2)); | 1352 version_op, std::string(), version_string, version_string2)); |
1353 if (!browser_version_info->IsValid()) | 1353 if (!browser_version_info->IsValid()) |
1354 return kMalformed; | 1354 return kMalformed; |
1355 if (browser_version_info->Contains(browser_version_)) | 1355 if (browser_version_info->Contains(browser_version_)) |
1356 return kSupported; | 1356 return kSupported; |
1357 return kUnsupported; | 1357 return kUnsupported; |
1358 } | 1358 } |
1359 return kSupported; | 1359 return kSupported; |
1360 } | 1360 } |
1361 | 1361 |
1362 // static | 1362 // static |
(...skipping 20 matching lines...) Expand all Loading... |
1383 const std::string& feature_name, int feature_id) { | 1383 const std::string& feature_name, int feature_id) { |
1384 feature_map_[feature_name] = feature_id; | 1384 feature_map_[feature_name] = feature_id; |
1385 } | 1385 } |
1386 | 1386 |
1387 void GpuControlList::set_supports_feature_type_all(bool supported) { | 1387 void GpuControlList::set_supports_feature_type_all(bool supported) { |
1388 supports_feature_type_all_ = supported; | 1388 supports_feature_type_all_ = supported; |
1389 } | 1389 } |
1390 | 1390 |
1391 } // namespace content | 1391 } // namespace content |
1392 | 1392 |
OLD | NEW |