Index: gpu/config/gpu_control_list.cc |
diff --git a/gpu/config/gpu_control_list.cc b/gpu/config/gpu_control_list.cc |
index f051ea19382a75fcb3f84ce6172e9a4faf90f371..cc0487a900f0a2a1978da82ac21afbb0d66f3a3a 100644 |
--- a/gpu/config/gpu_control_list.cc |
+++ b/gpu/config/gpu_control_list.cc |
@@ -414,6 +414,28 @@ bool GpuControlList::IntInfo::IsValid() const { |
return op_ != kUnknown; |
} |
+GpuControlList::BoolInfo::BoolInfo(const std::string& bool_value) |
+ : valid_(false), |
+ value_(false) { |
+ if (bool_value == "true") { |
+ valid_ = true; |
+ value_ = true; |
+ } else if (bool_value == "false") { |
+ valid_ = true; |
+ value_ = false; |
+ } |
+} |
+ |
+bool GpuControlList::BoolInfo::Contains(bool value) const { |
+ if (!valid_) |
+ return false; |
+ return value_ == value; |
+} |
+ |
+bool GpuControlList::BoolInfo::IsValid() const { |
+ return valid_; |
+} |
+ |
// static |
GpuControlList::ScopedGpuControlListEntry |
GpuControlList::GpuControlListEntry::GetEntryFromValue( |
@@ -744,6 +766,15 @@ GpuControlList::GpuControlListEntry::GetEntryFromValue( |
dictionary_entry_count++; |
} |
+ std::string direct_rendering_string; |
+ if (value->GetString("direct_rendering", &direct_rendering_string)) { |
+ if (!entry->SetDirectRenderingInfo(direct_rendering_string)) { |
+ LOG(WARNING) << "Malformed direct_rendering entry " << entry->id(); |
+ return NULL; |
+ } |
+ dictionary_entry_count++; |
+ } |
+ |
if (top_level) { |
const base::ListValue* feature_value = NULL; |
if (value->GetList("features", &feature_value)) { |
@@ -970,6 +1001,12 @@ bool GpuControlList::GpuControlListEntry::SetGpuCountInfo( |
return gpu_count_info_->IsValid(); |
} |
+bool GpuControlList::GpuControlListEntry::SetDirectRenderingInfo( |
+ const std::string& value) { |
+ direct_rendering_info_.reset(new BoolInfo(value)); |
+ return direct_rendering_info_->IsValid(); |
+} |
+ |
bool GpuControlList::GpuControlListEntry::SetFeatures( |
const std::vector<std::string>& feature_strings, |
const FeatureMap& feature_map, |
@@ -1119,6 +1156,9 @@ bool GpuControlList::GpuControlListEntry::Contains( |
if (gpu_count_info_.get() != NULL && |
!gpu_count_info_->Contains(gpu_info.secondary_gpus.size() + 1)) |
return false; |
+ if (direct_rendering_info_.get() != NULL && |
+ !direct_rendering_info_->Contains(gpu_info.direct_rendering)) |
+ return false; |
if (cpu_brand_.get() != NULL) { |
base::CPU cpu_info; |
if (!cpu_brand_->Contains(cpu_info.cpu_brand())) |