Index: content/browser/gpu_blacklist.cc |
diff --git a/content/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc |
index c64ddca02c3e0b3f6edf09c31fbb93022f8d9574..862a28f738be1fc27eb745f321adbee120f27a7f 100644 |
--- a/content/browser/gpu_blacklist.cc |
+++ b/content/browser/gpu_blacklist.cc |
@@ -679,27 +679,66 @@ void GpuBlacklist::GetGpuFeatureFlagEntries( |
} |
} |
-Value* GpuBlacklist::GetBlacklistingReasons() const { |
- ListValue* reasons = new ListValue(); |
- for (size_t i = 0; i < active_entries_.size(); ++i) { |
- DictionaryValue* reason = new DictionaryValue(); |
- reason->SetString("description", active_entries_[i]->description()); |
+Value* GpuBlacklist::GetStatus() const { |
+ DictionaryValue* status = new DictionaryValue(); |
+ |
+ // build the feature_status field |
+ { |
+ ListValue* feature_status_list = new ListValue(); |
+ // Iterate over all feature bits in kGpuFeatureAll and set feature status |
+ // for each one. |
+ for (size_t i = 0; i < sizeof(GpuFeatureFlags::GpuFeatureType) * 8; ++i) { |
+ GpuFeatureFlags::GpuFeatureType feature = |
+ static_cast<GpuFeatureFlags::GpuFeatureType>(1 << i); |
+ if (!(feature & GpuFeatureFlags::kGpuFeatureAll)) |
+ continue; |
+ |
+ DictionaryValue* feature_status = new DictionaryValue(); |
+ |
+ std::string feature_name( |
+ GpuFeatureFlags::GpuFeatureTypeToUserFriendlyString(feature)); |
+ feature_status->SetString("name", feature_name); |
+ |
+ // figure out if the feature is on or off |
+ bool flagged = false; |
+ for (size_t i = 0; i < active_entries_.size(); ++i) { |
+ if (active_entries_[i]->GetGpuFeatureFlags().flags() & feature) |
+ flagged |= true; |
zmo
2011/04/07 20:46:06
should this be flagged = (flagged || true)? | and
|
+ } |
+ |
+ feature_status->SetBoolean("enabled", !flagged); |
- ListValue* cr_bugs = new ListValue(); |
- for (size_t j = 0; j < active_entries_[i]->cr_bugs().size(); ++j) |
- cr_bugs->Append(Value::CreateIntegerValue( |
- active_entries_[i]->cr_bugs()[j])); |
- reason->Set("cr_bugs", cr_bugs); |
+ feature_status_list->Append(feature_status); |
+ } |
+ status->Set("featureStatus", feature_status_list); |
+ } |
- ListValue* webkit_bugs = new ListValue(); |
- for (size_t j = 0; j < active_entries_[i]->webkit_bugs().size(); ++j) |
- webkit_bugs->Append(Value::CreateIntegerValue( |
- active_entries_[i]->webkit_bugs()[j])); |
- reason->Set("webkit_bugs", webkit_bugs); |
+ // build the problems list |
+ { |
+ ListValue* problem_list = new ListValue(); |
+ for (size_t i = 0; i < active_entries_.size(); ++i) { |
+ GpuBlacklistEntry* entry = active_entries_[i]; |
+ DictionaryValue* problem = new DictionaryValue(); |
- reasons->Append(reason); |
+ problem->SetString("description", entry->description()); |
+ |
+ ListValue* cr_bugs = new ListValue(); |
+ for (size_t j = 0; j < entry->cr_bugs().size(); ++j) |
+ cr_bugs->Append(Value::CreateIntegerValue( |
+ entry->cr_bugs()[j])); |
+ problem->Set("crBugs", cr_bugs); |
+ |
+ ListValue* webkit_bugs = new ListValue(); |
+ for (size_t j = 0; j < entry->webkit_bugs().size(); ++j) |
+ webkit_bugs->Append(Value::CreateIntegerValue( |
+ entry->webkit_bugs()[j])); |
+ problem->Set("webkitBugs", webkit_bugs); |
+ |
+ problem_list->Append(problem); |
+ } |
+ status->Set("problems", problem_list); |
} |
- return reasons; |
+ return status; |
} |
uint32 GpuBlacklist::max_entry_id() const { |