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