summaryrefslogtreecommitdiffstats
path: root/content/browser/gpu_blacklist.cc
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-01 16:48:39 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-01 16:48:39 +0000
commit88a9e7842e67330861444184a0a3446c08eddd29 (patch)
treee471e90d1c3604f3ece870275f84d8db0fd6cf3f /content/browser/gpu_blacklist.cc
parentb7a759d926a64789d8b397097b645a3d4051884d (diff)
downloadchromium_src-88a9e7842e67330861444184a0a3446c08eddd29.zip
chromium_src-88a9e7842e67330861444184a0a3446c08eddd29.tar.gz
chromium_src-88a9e7842e67330861444184a0a3446c08eddd29.tar.bz2
Add a exception field to the GPU software rendering list entry, so in the future we can do whitelisting if we need to. This is an effort to improve software rendering list logic as much as we can before turning on auto-update, so we could avoid version issues in the future.
BUG=none TEST=unittest Review URL: http://codereview.chromium.org/6596061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76383 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/gpu_blacklist.cc')
-rw-r--r--content/browser/gpu_blacklist.cc73
1 files changed, 52 insertions, 21 deletions
diff --git a/content/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc
index 771de1d..d9b934f 100644
--- a/content/browser/gpu_blacklist.cc
+++ b/content/browser/gpu_blacklist.cc
@@ -176,16 +176,18 @@ GpuBlacklist::StringInfo::Op GpuBlacklist::StringInfo::StringToOp(
GpuBlacklist::GpuBlacklistEntry*
GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
- DictionaryValue* value) {
+ DictionaryValue* value, bool top_level) {
if (value == NULL)
return NULL;
GpuBlacklistEntry* entry = new GpuBlacklistEntry();
- std::string id;
- if (!value->GetString("id", &id) || !entry->SetId(id)) {
- delete entry;
- return NULL;
+ if (top_level) {
+ std::string id;
+ if (!value->GetString("id", &id) || !entry->SetId(id)) {
+ delete entry;
+ return NULL;
+ }
}
DictionaryValue* os_value = NULL;
@@ -263,30 +265,50 @@ GpuBlacklist::GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(
}
}
- ListValue* blacklist_value = NULL;
- if (!value->GetList("blacklist", &blacklist_value)) {
- delete entry;
- return NULL;
- }
- std::vector<std::string> blacklist;
- for (size_t i = 0; i < blacklist_value->GetSize(); ++i) {
- std::string feature;
- if (blacklist_value->GetString(i, &feature)) {
- blacklist.push_back(feature);
- } else {
+ if (top_level) {
+ ListValue* blacklist_value = NULL;
+ if (!value->GetList("blacklist", &blacklist_value)) {
+ delete entry;
+ return NULL;
+ }
+ std::vector<std::string> blacklist;
+ for (size_t i = 0; i < blacklist_value->GetSize(); ++i) {
+ std::string feature;
+ if (blacklist_value->GetString(i, &feature)) {
+ blacklist.push_back(feature);
+ } else {
+ delete entry;
+ return NULL;
+ }
+ }
+ if (!entry->SetBlacklistedFeatures(blacklist)) {
delete entry;
return NULL;
}
}
- if (!entry->SetBlacklistedFeatures(blacklist)) {
- delete entry;
- return NULL;
+
+ if (top_level) {
+ ListValue* exception_list_value = NULL;
+ if (value->GetList("exceptions", &exception_list_value)) {
+ for (size_t i = 0; i < exception_list_value->GetSize(); ++i) {
+ DictionaryValue* exception_value = NULL;
+ if (!exception_list_value->GetDictionary(i, &exception_value))
+ continue;
+ GpuBlacklistEntry* exception = GetGpuBlacklistEntryFromValue(
+ exception_value, false);
+ if (exception)
+ entry->AddException(exception);
+ }
+ }
}
return entry;
}
-GpuBlacklist::GpuBlacklistEntry::~GpuBlacklistEntry() {}
+GpuBlacklist::GpuBlacklistEntry::~GpuBlacklistEntry() {
+ for (size_t i = 0; i < exceptions_.size(); ++i)
+ delete exceptions_[i];
+}
GpuBlacklist::GpuBlacklistEntry::GpuBlacklistEntry()
: id_(0),
@@ -377,6 +399,11 @@ bool GpuBlacklist::GpuBlacklistEntry::SetBlacklistedFeatures(
return true;
}
+void GpuBlacklist::GpuBlacklistEntry::AddException(
+ GpuBlacklistEntry* exception) {
+ exceptions_.push_back(exception);
+}
+
bool GpuBlacklist::GpuBlacklistEntry::Contains(
OsType os_type, const Version& os_version, const GPUInfo& gpu_info) const {
DCHECK(os_type != kOsAny);
@@ -399,6 +426,10 @@ bool GpuBlacklist::GpuBlacklistEntry::Contains(
if (gl_renderer_info_.get() != NULL &&
!gl_renderer_info_->Contains(gpu_info.gl_renderer()))
return false;
+ for (size_t i = 0; i < exceptions_.size(); ++i) {
+ if (exceptions_[i]->Contains(os_type, os_version, gpu_info))
+ return false;
+ }
return true;
}
@@ -458,7 +489,7 @@ bool GpuBlacklist::LoadGpuBlacklist(const DictionaryValue& parsed_json,
if (!valid)
break;
GpuBlacklistEntry* entry =
- GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(list_item);
+ GpuBlacklistEntry::GetGpuBlacklistEntryFromValue(list_item, true);
if (entry == NULL)
break;
if (entry->id() > max_entry_id)