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/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 const base::ListValue* exception_list_value = NULL; | 751 const base::ListValue* exception_list_value = NULL; |
752 if (value->GetList("exceptions", &exception_list_value)) { | 752 if (value->GetList("exceptions", &exception_list_value)) { |
753 for (size_t i = 0; i < exception_list_value->GetSize(); ++i) { | 753 for (size_t i = 0; i < exception_list_value->GetSize(); ++i) { |
754 const base::DictionaryValue* exception_value = NULL; | 754 const base::DictionaryValue* exception_value = NULL; |
755 if (!exception_list_value->GetDictionary(i, &exception_value)) { | 755 if (!exception_list_value->GetDictionary(i, &exception_value)) { |
756 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); | 756 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); |
757 return NULL; | 757 return NULL; |
758 } | 758 } |
759 ScopedGpuControlListEntry exception(GetEntryFromValue( | 759 ScopedGpuControlListEntry exception(GetEntryFromValue( |
760 exception_value, false, feature_map, supports_feature_type_all)); | 760 exception_value, false, feature_map, supports_feature_type_all)); |
761 if (exception == NULL) { | 761 if (exception.get() == NULL) { |
762 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); | 762 LOG(WARNING) << "Malformed exceptions entry " << entry->id(); |
763 return NULL; | 763 return NULL; |
764 } | 764 } |
765 // Exception should inherit vendor_id from parent, otherwise if only | 765 // Exception should inherit vendor_id from parent, otherwise if only |
766 // device_ids are specified in Exception, the info will be incomplete. | 766 // device_ids are specified in Exception, the info will be incomplete. |
767 if (exception->vendor_id_ == 0 && entry->vendor_id_ != 0) | 767 if (exception->vendor_id_ == 0 && entry->vendor_id_ != 0) |
768 exception->vendor_id_ = entry->vendor_id_; | 768 exception->vendor_id_ = entry->vendor_id_; |
769 if (exception->contains_unknown_fields_) { | 769 if (exception->contains_unknown_fields_) { |
770 LOG(WARNING) << "Exception with unknown fields " << entry->id(); | 770 LOG(WARNING) << "Exception with unknown fields " << entry->id(); |
771 entry->contains_unknown_fields_ = true; | 771 entry->contains_unknown_fields_ = true; |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 // current browser version, don't process it. | 1218 // current browser version, don't process it. |
1219 BrowserVersionSupport browser_version_support = | 1219 BrowserVersionSupport browser_version_support = |
1220 IsEntrySupportedByCurrentBrowserVersion(list_item); | 1220 IsEntrySupportedByCurrentBrowserVersion(list_item); |
1221 if (browser_version_support == kMalformed) | 1221 if (browser_version_support == kMalformed) |
1222 return false; | 1222 return false; |
1223 if (browser_version_support == kUnsupported) | 1223 if (browser_version_support == kUnsupported) |
1224 continue; | 1224 continue; |
1225 DCHECK(browser_version_support == kSupported); | 1225 DCHECK(browser_version_support == kSupported); |
1226 ScopedGpuControlListEntry entry(GpuControlListEntry::GetEntryFromValue( | 1226 ScopedGpuControlListEntry entry(GpuControlListEntry::GetEntryFromValue( |
1227 list_item, true, feature_map_, supports_feature_type_all_)); | 1227 list_item, true, feature_map_, supports_feature_type_all_)); |
1228 if (entry == NULL) | 1228 if (entry.get() == NULL) |
1229 return false; | 1229 return false; |
1230 if (entry->id() > max_entry_id) | 1230 if (entry->id() > max_entry_id) |
1231 max_entry_id = entry->id(); | 1231 max_entry_id = entry->id(); |
1232 // If an unknown field is encountered, skip the entry; if an unknown | 1232 // If an unknown field is encountered, skip the entry; if an unknown |
1233 // feature is encountered, ignore the feature, but keep the entry. | 1233 // feature is encountered, ignore the feature, but keep the entry. |
1234 if (entry->contains_unknown_fields()) { | 1234 if (entry->contains_unknown_fields()) { |
1235 contains_unknown_fields = true; | 1235 contains_unknown_fields = true; |
1236 continue; | 1236 continue; |
1237 } | 1237 } |
1238 if (entry->contains_unknown_features()) | 1238 if (entry->contains_unknown_features()) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 entry_ids->clear(); | 1298 entry_ids->clear(); |
1299 for (size_t i = 0; i < active_entries_.size(); ++i) { | 1299 for (size_t i = 0; i < active_entries_.size(); ++i) { |
1300 if (disabled == active_entries_[i]->disabled()) | 1300 if (disabled == active_entries_[i]->disabled()) |
1301 entry_ids->push_back(active_entries_[i]->id()); | 1301 entry_ids->push_back(active_entries_[i]->id()); |
1302 } | 1302 } |
1303 } | 1303 } |
1304 | 1304 |
1305 void GpuControlList::GetReasons(base::ListValue* problem_list) const { | 1305 void GpuControlList::GetReasons(base::ListValue* problem_list) const { |
1306 DCHECK(problem_list); | 1306 DCHECK(problem_list); |
1307 for (size_t i = 0; i < active_entries_.size(); ++i) { | 1307 for (size_t i = 0; i < active_entries_.size(); ++i) { |
1308 GpuControlListEntry* entry = active_entries_[i]; | 1308 GpuControlListEntry* entry = active_entries_[i].get(); |
1309 if (entry->disabled()) | 1309 if (entry->disabled()) |
1310 continue; | 1310 continue; |
1311 base::DictionaryValue* problem = new base::DictionaryValue(); | 1311 base::DictionaryValue* problem = new base::DictionaryValue(); |
1312 | 1312 |
1313 problem->SetString("description", entry->description()); | 1313 problem->SetString("description", entry->description()); |
1314 | 1314 |
1315 base::ListValue* cr_bugs = new base::ListValue(); | 1315 base::ListValue* cr_bugs = new base::ListValue(); |
1316 for (size_t j = 0; j < entry->cr_bugs().size(); ++j) | 1316 for (size_t j = 0; j < entry->cr_bugs().size(); ++j) |
1317 cr_bugs->Append(new base::FundamentalValue(entry->cr_bugs()[j])); | 1317 cr_bugs->Append(new base::FundamentalValue(entry->cr_bugs()[j])); |
1318 problem->Set("crBugs", cr_bugs); | 1318 problem->Set("crBugs", cr_bugs); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 const std::string& feature_name, int feature_id) { | 1410 const std::string& feature_name, int feature_id) { |
1411 feature_map_[feature_name] = feature_id; | 1411 feature_map_[feature_name] = feature_id; |
1412 } | 1412 } |
1413 | 1413 |
1414 void GpuControlList::set_supports_feature_type_all(bool supported) { | 1414 void GpuControlList::set_supports_feature_type_all(bool supported) { |
1415 supports_feature_type_all_ = supported; | 1415 supports_feature_type_all_ = supported; |
1416 } | 1416 } |
1417 | 1417 |
1418 } // namespace gpu | 1418 } // namespace gpu |
1419 | 1419 |
OLD | NEW |