summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
authorzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-26 02:37:38 +0000
committerzmo@google.com <zmo@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-26 02:37:38 +0000
commitbb4bf9d76e99ba7e1c7f4246dde03e2f9cf92227 (patch)
tree3acdd3c5c16508bed92f2749916aec15f35b6281 /content
parentb2d08988ad842790cabeb728a34473db064a660a (diff)
downloadchromium_src-bb4bf9d76e99ba7e1c7f4246dde03e2f9cf92227.zip
chromium_src-bb4bf9d76e99ba7e1c7f4246dde03e2f9cf92227.tar.gz
chromium_src-bb4bf9d76e99ba7e1c7f4246dde03e2f9cf92227.tar.bz2
With this CL, GPU blacklist auto update from the web is implemented. This allows us to blacklist bad GPU/drivers as soon as we discover them.
Note that this patch does not turn the auto update on. We will turn it on in a separate CL. Reland this patch after fixing a bug causing a XP test failure. BUG=68802 TEST=bots green TBR=kbr Review URL: http://codereview.chromium.org/6588035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76143 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r--content/browser/gpu_blacklist.cc31
-rw-r--r--content/browser/gpu_blacklist.h7
2 files changed, 35 insertions, 3 deletions
diff --git a/content/browser/gpu_blacklist.cc b/content/browser/gpu_blacklist.cc
index 544a656..771de1d 100644
--- a/content/browser/gpu_blacklist.cc
+++ b/content/browser/gpu_blacklist.cc
@@ -426,7 +426,6 @@ GpuBlacklist::~GpuBlacklist() {
bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context,
bool current_os_only) {
- std::vector<GpuBlacklistEntry*> entries;
scoped_ptr<Value> root;
root.reset(base::JSONReader::Read(json_context, false));
if (root.get() == NULL || !root->IsType(Value::TYPE_DICTIONARY))
@@ -434,14 +433,21 @@ bool GpuBlacklist::LoadGpuBlacklist(const std::string& json_context,
DictionaryValue* root_dictionary = static_cast<DictionaryValue*>(root.get());
DCHECK(root_dictionary);
+ return LoadGpuBlacklist(*root_dictionary, current_os_only);
+}
+
+bool GpuBlacklist::LoadGpuBlacklist(const DictionaryValue& parsed_json,
+ bool current_os_only) {
+ std::vector<GpuBlacklistEntry*> entries;
+
std::string version_string;
- root_dictionary->GetString("version", &version_string);
+ parsed_json.GetString("version", &version_string);
version_.reset(Version::GetVersionFromString(version_string));
if (version_.get() == NULL)
return false;
ListValue* list = NULL;
- root_dictionary->GetList("entries", &list);
+ parsed_json.GetList("entries", &list);
if (list == NULL)
return false;
@@ -556,6 +562,25 @@ bool GpuBlacklist::GetVersion(uint16* major, uint16* minor) const {
return true;
}
+bool GpuBlacklist::GetVersion(
+ const DictionaryValue& parsed_json, uint16* major, uint16* minor) {
+ DCHECK(major && minor);
+ *major = 0;
+ *minor = 0;
+ std::string version_string;
+ if (!parsed_json.GetString("version", &version_string))
+ return false;
+ scoped_ptr<Version> version(Version::GetVersionFromString(version_string));
+ if (version.get() == NULL)
+ return false;
+ const std::vector<uint16>& components_reference = version->components();
+ if (components_reference.size() != 2)
+ return false;
+ *major = components_reference[0];
+ *minor = components_reference[1];
+ return true;
+}
+
GpuBlacklist::OsType GpuBlacklist::GetOsType() {
#if defined(OS_WIN)
return kOsWin;
diff --git a/content/browser/gpu_blacklist.h b/content/browser/gpu_blacklist.h
index f732af9..7758b65 100644
--- a/content/browser/gpu_blacklist.h
+++ b/content/browser/gpu_blacklist.h
@@ -37,6 +37,8 @@ class GpuBlacklist {
// If failed, the current GpuBlacklist is un-touched.
bool LoadGpuBlacklist(const std::string& json_context,
bool current_os_only);
+ bool LoadGpuBlacklist(const DictionaryValue& parsed_json,
+ bool current_os_only);
// Collects system information and combines them with gpu_info and blacklist
// information to determine gpu feature flags.
@@ -63,6 +65,11 @@ class GpuBlacklist {
// major and minor to 0 on failure.
bool GetVersion(uint16* major, uint16* monir) const;
+ // Collects the version of the current blacklist from a parsed json file.
+ // Returns false and sets major and minor to 0 on failure.
+ static bool GetVersion(
+ const DictionaryValue& parsed_json, uint16* major, uint16* minor);
+
private:
class VersionInfo {
public: