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

Unified Diff: components/policy/core/common/schema_internal.h

Issue 31273002: Generate the Chrome policy schema at compile time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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
« no previous file with comments | « components/policy/core/common/schema.cc ('k') | components/policy/core/common/schema_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/schema_internal.h
diff --git a/components/policy/core/common/schema_internal.h b/components/policy/core/common/schema_internal.h
index 025a4373ee75cc50475c824c380f09c635d3e665..40d557a408d72ff868b0bfd3bf58ce537e75f9e9 100644
--- a/components/policy/core/common/schema_internal.h
+++ b/components/policy/core/common/schema_internal.h
@@ -14,29 +14,64 @@ namespace internal {
// These types are used internally by the SchemaOwner parser, and by the
// compile-time code generator. They shouldn't be used directly.
+// Represents the type of one policy, or an item of a list policy, or a
+// property of a map policy.
struct POLICY_EXPORT SchemaNode {
+ // The policy type.
base::Value::Type type;
- // If |type| is TYPE_LIST then this is a SchemaNode* describing the
- // element type.
+ // If |type| is TYPE_DICTIONARY then |extra| is an offset into
+ // SchemaData::properties_nodes that indexes the PropertiesNode describing
+ // the entries of this dictionary.
//
- // If |type| is TYPE_DICTIONARY then this is a PropertiesNode* that can
- // contain any number of named properties and optionally a SchemaNode* for
- // additional properties.
+ // If |type| is TYPE_LIST then |extra| is an offset into
+ // SchemaData::schema_nodes that indexes the SchemaNode describing the items
+ // of this list.
//
- // This is NULL if |type| has any other values.
- const void* extra;
+ // Otherwise extra is -1 and is invalid.
+ int extra;
};
+// Represents an entry of a map policy.
struct POLICY_EXPORT PropertyNode {
+ // The entry key.
const char* key;
- const SchemaNode* schema;
+
+ // An offset into SchemaData::schema_nodes that indexes the SchemaNode
+ // describing the structure of this key.
+ int schema;
};
+// Represents the list of keys of a map policy.
struct POLICY_EXPORT PropertiesNode {
- const PropertyNode* begin;
- const PropertyNode* end;
- const SchemaNode* additional;
+ // An offset into SchemaData::property_nodes that indexes the PropertyNode
+ // describing the first known property of this map policy.
+ int begin;
+
+ // An offset into SchemaData::property_nodes that indexes the PropertyNode
+ // right beyond the last known property of this map policy.
+ //
+ // If |begin == end| then the map policy that this PropertiesNode corresponds
+ // to does not have known properties.
+ //
+ // Note that the range [begin, end) is sorted by PropertyNode::key, so that
+ // properties can be looked up by binary searching in the range.
+ int end;
+
+ // If this map policy supports keys with any value (besides the well-known
+ // values described in the range [begin, end)) then |additional| is an offset
+ // into SchemaData::schema_nodes that indexes the SchemaNode describing the
+ // structure of the values for those keys. Otherwise |additional| is -1 and
+ // is invalid.
+ int additional;
+};
+
+// Contains arrays of related nodes. All of the offsets in these nodes reference
+// other nodes in these arrays.
+struct POLICY_EXPORT SchemaData {
+ const SchemaNode* schema_nodes;
+ const PropertyNode* property_nodes;
+ const PropertiesNode* properties_nodes;
};
} // namespace internal
« no previous file with comments | « components/policy/core/common/schema.cc ('k') | components/policy/core/common/schema_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698