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

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

Issue 1925203002: Add exceptions to features in GpuControlList (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/cpu.h" 10 #include "base/cpu.h"
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 bool in_process_gpu; 731 bool in_process_gpu;
732 if (value->GetBoolean("in_process_gpu", &in_process_gpu)) { 732 if (value->GetBoolean("in_process_gpu", &in_process_gpu)) {
733 entry->SetInProcessGPUInfo(in_process_gpu); 733 entry->SetInProcessGPUInfo(in_process_gpu);
734 dictionary_entry_count++; 734 dictionary_entry_count++;
735 } 735 }
736 736
737 if (top_level) { 737 if (top_level) {
738 const base::ListValue* feature_value = NULL; 738 const base::ListValue* feature_value = NULL;
739 if (value->GetList("features", &feature_value)) { 739 if (value->GetList("features", &feature_value)) {
740 std::vector<std::string> feature_list; 740 std::vector<std::string> feature_list;
741 std::vector<std::string> feature_exception_list;
741 for (size_t i = 0; i < feature_value->GetSize(); ++i) { 742 for (size_t i = 0; i < feature_value->GetSize(); ++i) {
742 std::string feature; 743 std::string feature;
744 const base::DictionaryValue* features_info_value = NULL;
743 if (feature_value->GetString(i, &feature)) { 745 if (feature_value->GetString(i, &feature)) {
744 feature_list.push_back(feature); 746 feature_list.push_back(feature);
747 } else if (feature_value->GetDictionary(i, &features_info_value)) {
748 const base::ListValue* exception_list_value = NULL;
749 if (features_info_value->GetList("exceptions",
750 &exception_list_value)) {
751 for (size_t i = 0; i < exception_list_value->GetSize(); ++i) {
752 std::string exception_feature;
753 if (exception_list_value->GetString(i, &exception_feature))
754 feature_exception_list.push_back(exception_feature);
Zhenyao Mo 2016/04/29 00:34:17 else here, malformed feature entry.
Julien Isorce Samsung 2016/04/29 15:52:14 Done.
755 }
756 }
Zhenyao Mo 2016/04/29 00:34:17 else here, malformed feature entry.
Julien Isorce Samsung 2016/04/29 15:52:14 Done.
745 } else { 757 } else {
746 LOG(WARNING) << "Malformed feature entry " << entry->id(); 758 LOG(WARNING) << "Malformed feature entry " << entry->id();
747 return NULL; 759 return NULL;
748 } 760 }
749 } 761 }
750 if (!entry->SetFeatures( 762 if (!entry->SetFeatures(feature_list, feature_exception_list, feature_map,
751 feature_list, feature_map, supports_feature_type_all)) { 763 supports_feature_type_all)) {
752 LOG(WARNING) << "Malformed feature entry " << entry->id(); 764 LOG(WARNING) << "Malformed feature entry " << entry->id();
753 return NULL; 765 return NULL;
754 } 766 }
755 dictionary_entry_count++; 767 dictionary_entry_count++;
756 } 768 }
757 } 769 }
758 770
759 if (top_level) { 771 if (top_level) {
760 const base::ListValue* exception_list_value = NULL; 772 const base::ListValue* exception_list_value = NULL;
761 if (value->GetList("exceptions", &exception_list_value)) { 773 if (value->GetList("exceptions", &exception_list_value)) {
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 void GpuControlList::GpuControlListEntry::SetDirectRenderingInfo(bool value) { 1002 void GpuControlList::GpuControlListEntry::SetDirectRenderingInfo(bool value) {
991 direct_rendering_info_.reset(new BoolInfo(value)); 1003 direct_rendering_info_.reset(new BoolInfo(value));
992 } 1004 }
993 1005
994 void GpuControlList::GpuControlListEntry::SetInProcessGPUInfo(bool value) { 1006 void GpuControlList::GpuControlListEntry::SetInProcessGPUInfo(bool value) {
995 in_process_gpu_info_.reset(new BoolInfo(value)); 1007 in_process_gpu_info_.reset(new BoolInfo(value));
996 } 1008 }
997 1009
998 bool GpuControlList::GpuControlListEntry::SetFeatures( 1010 bool GpuControlList::GpuControlListEntry::SetFeatures(
999 const std::vector<std::string>& feature_strings, 1011 const std::vector<std::string>& feature_strings,
1012 const std::vector<std::string>& exception_strings,
1000 const FeatureMap& feature_map, 1013 const FeatureMap& feature_map,
1001 bool supports_feature_type_all) { 1014 bool supports_feature_type_all) {
1002 size_t size = feature_strings.size(); 1015 size_t size = feature_strings.size();
1003 if (size == 0) 1016 if (size == 0)
1004 return false; 1017 return false;
1005 features_.clear(); 1018 features_.clear();
1006 for (size_t i = 0; i < size; ++i) { 1019 for (size_t i = 0; i < size; ++i) {
1007 int feature = 0; 1020 int feature = 0;
1008 if (supports_feature_type_all && feature_strings[i] == "all") { 1021 if (supports_feature_type_all && feature_strings[i] == "all") {
1009 for (FeatureMap::const_iterator iter = feature_map.begin(); 1022 for (FeatureMap::const_iterator iter = feature_map.begin();
1010 iter != feature_map.end(); ++iter) 1023 iter != feature_map.end(); ++iter) {
1011 features_.insert(iter->second); 1024 if (std::find(exception_strings.begin(), exception_strings.end(),
1025 iter->first) == exception_strings.end())
1026 features_.insert(iter->second);
1027 }
1012 continue; 1028 continue;
1013 } 1029 }
1014 if (!StringToFeature(feature_strings[i], &feature, feature_map)) { 1030 if (!StringToFeature(feature_strings[i], &feature, feature_map)) {
1015 features_.clear(); 1031 features_.clear();
1016 return false; 1032 return false;
1017 } 1033 }
1018 features_.insert(feature); 1034 if (std::find(exception_strings.begin(), exception_strings.end(),
1035 feature_strings[i]) == exception_strings.end())
1036 features_.insert(feature);
1019 } 1037 }
1020 return true; 1038 return true;
1021 } 1039 }
1022 1040
1023 void GpuControlList::GpuControlListEntry::AddException( 1041 void GpuControlList::GpuControlListEntry::AddException(
1024 ScopedGpuControlListEntry exception) { 1042 ScopedGpuControlListEntry exception) {
1025 exceptions_.push_back(exception); 1043 exceptions_.push_back(exception);
1026 } 1044 }
1027 1045
1028 bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch( 1046 bool GpuControlList::GpuControlListEntry::GLVersionInfoMismatch(
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 const std::string& feature_name, int feature_id) { 1603 const std::string& feature_name, int feature_id) {
1586 feature_map_[feature_name] = feature_id; 1604 feature_map_[feature_name] = feature_id;
1587 } 1605 }
1588 1606
1589 void GpuControlList::set_supports_feature_type_all(bool supported) { 1607 void GpuControlList::set_supports_feature_type_all(bool supported) {
1590 supports_feature_type_all_ = supported; 1608 supports_feature_type_all_ = supported;
1591 } 1609 }
1592 1610
1593 } // namespace gpu 1611 } // namespace gpu
1594 1612
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698