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

Unified Diff: third_party/WebKit/Source/build/scripts/make_css_property_names.py

Issue 2228313002: Make a function to query whether a CSSPropertyID is valid and whether it has a name. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@asan
Patch Set: Adjust animation dchecks Created 4 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: third_party/WebKit/Source/build/scripts/make_css_property_names.py
diff --git a/third_party/WebKit/Source/build/scripts/make_css_property_names.py b/third_party/WebKit/Source/build/scripts/make_css_property_names.py
index e32dc5f682ec57857b5377e715ae9de30937f352..56a89951cf3fc7e6e01f51ca34ac5dbc156bda42 100755
--- a/third_party/WebKit/Source/build/scripts/make_css_property_names.py
+++ b/third_party/WebKit/Source/build/scripts/make_css_property_names.py
@@ -44,9 +44,16 @@ const WTF::AtomicString& getPropertyNameAtomicString(CSSPropertyID);
WTF::String getPropertyNameString(CSSPropertyID);
WTF::String getJSPropertyName(CSSPropertyID);
+inline bool propertyHasName(int id)
+{
+ return id >= firstCSSProperty && id <= lastUnresolvedCSSProperty;
+}
+
+
inline CSSPropertyID convertToCSSPropertyID(int value)
{
- ASSERT(value >= CSSPropertyInvalid && value <= lastCSSProperty);
+ DCHECK_GE(value, CSSPropertyInvalid);
+ DCHECK_LE(value, lastCSSProperty);
sashab 2016/08/15 07:23:13 Maybe DCHECK(propertyHasName() || property == CSSP
meade_UTC10 2016/09/29 07:39:56 Done.
meade_UTC10 2016/09/30 06:17:37 Actually that doesn't work - lastCSSProperty != la
return static_cast<CSSPropertyID>(value);
}
@@ -118,14 +125,14 @@ const Property* findProperty(register const char* str, register unsigned int len
const char* getPropertyName(CSSPropertyID id)
{
- ASSERT(id >= firstCSSProperty && id <= lastUnresolvedCSSProperty);
+ DCHECK(propertyHasName(id));
int index = id - firstCSSProperty;
return propertyNameStringsPool + propertyNameStringsOffsets[index];
}
const AtomicString& getPropertyNameAtomicString(CSSPropertyID id)
{
- ASSERT(id >= firstCSSProperty && id <= lastUnresolvedCSSProperty);
+ DCHECK(propertyHasName(id));
int index = id - firstCSSProperty;
static AtomicString* propertyStrings = new AtomicString[lastUnresolvedCSSProperty]; // Intentionally never destroyed.
AtomicString& propertyString = propertyStrings[index];

Powered by Google App Engine
This is Rietveld 408576698