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

Unified 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: Rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/config/gpu_control_list.h ('k') | gpu/config/gpu_control_list_entry_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/config/gpu_control_list.cc
diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc
index 9ff8a4d24c63e0a05faa47190775e2be4ea4c00f..a8ba402758b71939201b9cca093b52f286f97d45 100644
--- a/gpu/config/gpu_control_list.cc
+++ b/gpu/config/gpu_control_list.cc
@@ -738,17 +738,40 @@ GpuControlList::GpuControlListEntry::GetEntryFromValue(
const base::ListValue* feature_value = NULL;
if (value->GetList("features", &feature_value)) {
std::vector<std::string> feature_list;
+ std::vector<std::string> feature_exception_list;
for (size_t i = 0; i < feature_value->GetSize(); ++i) {
std::string feature;
+ const base::DictionaryValue* features_info_value = NULL;
if (feature_value->GetString(i, &feature)) {
feature_list.push_back(feature);
+ } else if (feature_value->GetDictionary(i, &features_info_value)) {
+ const base::ListValue* exception_list_value = NULL;
+ if (features_info_value->size() > 1) {
+ LOG(WARNING) << "Malformed feature entry " << entry->id();
+ return NULL;
+ }
+ if (features_info_value->GetList("exceptions",
+ &exception_list_value)) {
+ for (size_t i = 0; i < exception_list_value->GetSize(); ++i) {
+ std::string exception_feature;
+ if (exception_list_value->GetString(i, &exception_feature)) {
+ feature_exception_list.push_back(exception_feature);
+ } else {
+ LOG(WARNING) << "Malformed feature entry " << entry->id();
+ return NULL;
+ }
+ }
+ } else {
+ LOG(WARNING) << "Malformed feature entry " << entry->id();
+ return NULL;
+ }
} else {
LOG(WARNING) << "Malformed feature entry " << entry->id();
return NULL;
}
}
- if (!entry->SetFeatures(
- feature_list, feature_map, supports_feature_type_all)) {
+ if (!entry->SetFeatures(feature_list, feature_exception_list, feature_map,
+ supports_feature_type_all)) {
LOG(WARNING) << "Malformed feature entry " << entry->id();
return NULL;
}
@@ -997,6 +1020,7 @@ void GpuControlList::GpuControlListEntry::SetInProcessGPUInfo(bool value) {
bool GpuControlList::GpuControlListEntry::SetFeatures(
const std::vector<std::string>& feature_strings,
+ const std::vector<std::string>& exception_strings,
const FeatureMap& feature_map,
bool supports_feature_type_all) {
size_t size = feature_strings.size();
@@ -1007,15 +1031,20 @@ bool GpuControlList::GpuControlListEntry::SetFeatures(
int feature = 0;
if (supports_feature_type_all && feature_strings[i] == "all") {
for (FeatureMap::const_iterator iter = feature_map.begin();
- iter != feature_map.end(); ++iter)
- features_.insert(iter->second);
+ iter != feature_map.end(); ++iter) {
+ if (std::find(exception_strings.begin(), exception_strings.end(),
+ iter->first) == exception_strings.end())
+ features_.insert(iter->second);
+ }
continue;
}
if (!StringToFeature(feature_strings[i], &feature, feature_map)) {
features_.clear();
return false;
}
- features_.insert(feature);
+ if (std::find(exception_strings.begin(), exception_strings.end(),
+ feature_strings[i]) == exception_strings.end())
+ features_.insert(feature);
}
return true;
}
« no previous file with comments | « gpu/config/gpu_control_list.h ('k') | gpu/config/gpu_control_list_entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698