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

Unified Diff: content/browser/gpu/gpu_blacklist.h

Issue 7633038: Relax software rendering list parsing. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 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
Index: content/browser/gpu/gpu_blacklist.h
===================================================================
--- content/browser/gpu/gpu_blacklist.h (revision 97470)
+++ content/browser/gpu/gpu_blacklist.h (working copy)
@@ -10,6 +10,8 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/gtest_prod_util.h"
+#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/values.h"
#include "content/common/gpu/gpu_feature_flags.h"
@@ -32,18 +34,21 @@
kOsUnknown
};
+ enum OsFilter {
+ // In loading, Ignore all entries that belong to other OS.
vangelis 2011/08/24 19:00:17 typo: Ignore->ignore
Zhenyao Mo 2011/08/24 22:29:57 Done.
+ kCurrentOsOnly,
+ // In loading, keep all entries. This is for testing only.
+ kAllOs
+ };
+
explicit GpuBlacklist(const std::string& browser_version_string);
~GpuBlacklist();
// Loads blacklist information from a json file.
- // current_os_only==true indicates all blacklist entries that don't belong to
- // the current OS are discarded; current_os_only==false should only be used
- // for testing purpose.
// If failed, the current GpuBlacklist is un-touched.
- bool LoadGpuBlacklist(const std::string& json_context,
- bool current_os_only);
+ bool LoadGpuBlacklist(const std::string& json_context, OsFilter os_filter);
bool LoadGpuBlacklist(const base::DictionaryValue& parsed_json,
- bool current_os_only);
+ OsFilter os_filter);
// Collects system information and combines them with gpu_info and blacklist
// information to determine gpu feature flags.
@@ -63,7 +68,6 @@
void GetGpuFeatureFlagEntries(GpuFeatureFlags::GpuFeatureType feature,
std::vector<uint32>& entry_ids) const;
-
// Returns status information on the blacklist. This is two parted:
// {
// featureStatus: []
@@ -109,6 +113,11 @@
const base::DictionaryValue& parsed_json, uint16* major, uint16* minor);
private:
+ FRIEND_TEST_ALL_PREFIXES(GpuBlacklistTest, CurrentBlacklistValidation);
+ FRIEND_TEST_ALL_PREFIXES(GpuBlacklistTest, UnknownField);
+ FRIEND_TEST_ALL_PREFIXES(GpuBlacklistTest, UnknownExceptionField);
+ FRIEND_TEST_ALL_PREFIXES(GpuBlacklistTest, UnknownFeature);
+
class VersionInfo {
public:
VersionInfo(const std::string& version_op,
@@ -192,7 +201,10 @@
std::string value_;
};
- class GpuBlacklistEntry {
+ class GpuBlacklistEntry;
+ typedef scoped_refptr<GpuBlacklistEntry> ScopedGpuBlacklistEntry;
+
+ class GpuBlacklistEntry : public base::RefCounted<GpuBlacklistEntry> {
public:
// Constructs GpuBlacklistEntry from DictionaryValue loaded from json.
// Top-level entry must have an id number. Others are exceptions.
@@ -213,17 +225,28 @@
// Returns the description of the entry
const std::string& description() const { return description_; }
- // Returs a list of Chromium and Webkit bugs applicable to this entry
+ // Returns a list of Chromium and Webkit bugs applicable to this entry
const std::vector<int>& cr_bugs() const { return cr_bugs_; }
const std::vector<int>& webkit_bugs() const { return webkit_bugs_; }
// Returns the GpuFeatureFlags.
GpuFeatureFlags GetGpuFeatureFlags() const;
- ~GpuBlacklistEntry();
+ // Returns true if an unknown filed of an unknown blacklist feature
vangelis 2011/08/24 19:00:17 typo: filed -> field
Zhenyao Mo 2011/08/24 22:29:57 Done.
+ // is encountered.
+ bool contains_unknown_fields() const {
+ return contains_unknown_fields_;
+ }
+ // Returns true if an exception contains an unknown field.
+ bool contains_exceptions_with_unknown_fields() const {
+ return contains_exceptions_with_unknown_fields_;
+ }
private:
+ friend class base::RefCounted<GpuBlacklistEntry>;
+
GpuBlacklistEntry();
+ ~GpuBlacklistEntry() { }
bool SetId(uint32 id);
@@ -267,7 +290,9 @@
scoped_ptr<VersionInfo> driver_date_info_;
scoped_ptr<StringInfo> gl_renderer_info_;
scoped_ptr<GpuFeatureFlags> feature_flags_;
- std::vector<GpuBlacklistEntry*> exceptions_;
+ std::vector<ScopedGpuBlacklistEntry> exceptions_;
+ bool contains_unknown_fields_;
+ bool contains_exceptions_with_unknown_fields_;
};
enum BrowserVersionSupport {
@@ -289,18 +314,26 @@
BrowserVersionSupport IsEntrySupportedByCurrentBrowserVersion(
base::DictionaryValue* value);
+ // Returns the number of entries. This is only for tests.
+ size_t num_entries() const;
+
+ // Check if any entries contain unknown field. This is only for tests.
+ bool contains_unknown_fields() const { return contains_unknown_fields_; }
+
scoped_ptr<Version> version_;
- std::vector<GpuBlacklistEntry*> blacklist_;
+ std::vector<ScopedGpuBlacklistEntry> blacklist_;
scoped_ptr<Version> browser_version_;
// This records all the blacklist entries that are appliable to the current
// user machine. It is updated everytime DetermineGpuFeatureFlags() is
// called and is used later by GetGpuFeatureFlagEntries().
- std::vector<GpuBlacklistEntry*> active_entries_;
+ std::vector<ScopedGpuBlacklistEntry> active_entries_;
uint32 max_entry_id_;
+ bool contains_unknown_fields_;
+
DISALLOW_COPY_AND_ASSIGN(GpuBlacklist);
};

Powered by Google App Engine
This is Rietveld 408576698