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 "gpu/config/gpu_control_list.h" | 5 #include "gpu/config/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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
716 } | 716 } |
717 dictionary_entry_count++; | 717 dictionary_entry_count++; |
718 } | 718 } |
719 | 719 |
720 bool direct_rendering; | 720 bool direct_rendering; |
721 if (value->GetBoolean("direct_rendering", &direct_rendering)) { | 721 if (value->GetBoolean("direct_rendering", &direct_rendering)) { |
722 entry->SetDirectRenderingInfo(direct_rendering); | 722 entry->SetDirectRenderingInfo(direct_rendering); |
723 dictionary_entry_count++; | 723 dictionary_entry_count++; |
724 } | 724 } |
725 | 725 |
| 726 bool in_process_gpu; |
| 727 if (value->GetBoolean("in_process_gpu", &in_process_gpu)) { |
| 728 entry->SetInProcessGPUInfo(in_process_gpu); |
| 729 dictionary_entry_count++; |
| 730 } |
| 731 |
726 if (top_level) { | 732 if (top_level) { |
727 const base::ListValue* feature_value = NULL; | 733 const base::ListValue* feature_value = NULL; |
728 if (value->GetList("features", &feature_value)) { | 734 if (value->GetList("features", &feature_value)) { |
729 std::vector<std::string> feature_list; | 735 std::vector<std::string> feature_list; |
730 for (size_t i = 0; i < feature_value->GetSize(); ++i) { | 736 for (size_t i = 0; i < feature_value->GetSize(); ++i) { |
731 std::string feature; | 737 std::string feature; |
732 if (feature_value->GetString(i, &feature)) { | 738 if (feature_value->GetString(i, &feature)) { |
733 feature_list.push_back(feature); | 739 feature_list.push_back(feature); |
734 } else { | 740 } else { |
735 LOG(WARNING) << "Malformed feature entry " << entry->id(); | 741 LOG(WARNING) << "Malformed feature entry " << entry->id(); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 const std::string& int_string, | 979 const std::string& int_string, |
974 const std::string& int_string2) { | 980 const std::string& int_string2) { |
975 gpu_count_info_.reset(new IntInfo(op, int_string, int_string2)); | 981 gpu_count_info_.reset(new IntInfo(op, int_string, int_string2)); |
976 return gpu_count_info_->IsValid(); | 982 return gpu_count_info_->IsValid(); |
977 } | 983 } |
978 | 984 |
979 void GpuControlList::GpuControlListEntry::SetDirectRenderingInfo(bool value) { | 985 void GpuControlList::GpuControlListEntry::SetDirectRenderingInfo(bool value) { |
980 direct_rendering_info_.reset(new BoolInfo(value)); | 986 direct_rendering_info_.reset(new BoolInfo(value)); |
981 } | 987 } |
982 | 988 |
| 989 void GpuControlList::GpuControlListEntry::SetInProcessGPUInfo(bool value) { |
| 990 in_process_gpu_info_.reset(new BoolInfo(value)); |
| 991 } |
| 992 |
983 bool GpuControlList::GpuControlListEntry::SetFeatures( | 993 bool GpuControlList::GpuControlListEntry::SetFeatures( |
984 const std::vector<std::string>& feature_strings, | 994 const std::vector<std::string>& feature_strings, |
985 const FeatureMap& feature_map, | 995 const FeatureMap& feature_map, |
986 bool supports_feature_type_all) { | 996 bool supports_feature_type_all) { |
987 size_t size = feature_strings.size(); | 997 size_t size = feature_strings.size(); |
988 if (size == 0) | 998 if (size == 0) |
989 return false; | 999 return false; |
990 features_.clear(); | 1000 features_.clear(); |
991 for (size_t i = 0; i < size; ++i) { | 1001 for (size_t i = 0; i < size; ++i) { |
992 int feature = 0; | 1002 int feature = 0; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 if (machine_model_version_info_.get() != NULL && | 1246 if (machine_model_version_info_.get() != NULL && |
1237 (gpu_info.machine_model_version.empty() || | 1247 (gpu_info.machine_model_version.empty() || |
1238 !machine_model_version_info_->Contains(gpu_info.machine_model_version))) | 1248 !machine_model_version_info_->Contains(gpu_info.machine_model_version))) |
1239 return false; | 1249 return false; |
1240 if (gpu_count_info_.get() != NULL && | 1250 if (gpu_count_info_.get() != NULL && |
1241 !gpu_count_info_->Contains(gpu_info.secondary_gpus.size() + 1)) | 1251 !gpu_count_info_->Contains(gpu_info.secondary_gpus.size() + 1)) |
1242 return false; | 1252 return false; |
1243 if (direct_rendering_info_.get() != NULL && | 1253 if (direct_rendering_info_.get() != NULL && |
1244 !direct_rendering_info_->Contains(gpu_info.direct_rendering)) | 1254 !direct_rendering_info_->Contains(gpu_info.direct_rendering)) |
1245 return false; | 1255 return false; |
| 1256 if (in_process_gpu_info_.get() != NULL && |
| 1257 !in_process_gpu_info_->Contains(gpu_info.in_process_gpu)) |
| 1258 return false; |
1246 if (!cpu_brand_.empty()) { | 1259 if (!cpu_brand_.empty()) { |
1247 base::CPU cpu_info; | 1260 base::CPU cpu_info; |
1248 if (StringMismatch(cpu_info.cpu_brand(), cpu_brand_)) | 1261 if (StringMismatch(cpu_info.cpu_brand(), cpu_brand_)) |
1249 return false; | 1262 return false; |
1250 } | 1263 } |
1251 | 1264 |
1252 for (size_t i = 0; i < exceptions_.size(); ++i) { | 1265 for (size_t i = 0; i < exceptions_.size(); ++i) { |
1253 if (exceptions_[i]->Contains(os_type, os_version, gpu_info) && | 1266 if (exceptions_[i]->Contains(os_type, os_version, gpu_info) && |
1254 !exceptions_[i]->NeedsMoreInfo(gpu_info, true)) | 1267 !exceptions_[i]->NeedsMoreInfo(gpu_info, true)) |
1255 return false; | 1268 return false; |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 const std::string& feature_name, int feature_id) { | 1578 const std::string& feature_name, int feature_id) { |
1566 feature_map_[feature_name] = feature_id; | 1579 feature_map_[feature_name] = feature_id; |
1567 } | 1580 } |
1568 | 1581 |
1569 void GpuControlList::set_supports_feature_type_all(bool supported) { | 1582 void GpuControlList::set_supports_feature_type_all(bool supported) { |
1570 supports_feature_type_all_ = supported; | 1583 supports_feature_type_all_ = supported; |
1571 } | 1584 } |
1572 | 1585 |
1573 } // namespace gpu | 1586 } // namespace gpu |
1574 | 1587 |
OLD | NEW |