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

Side by Side Diff: third_party/WebKit/Source/build/scripts/make_css_property_names.py

Issue 2007073003: Move CSSPropertyID templates instantiations to a separate file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove more includes from CSSPropertyNames.h Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/CSSOMKeywords.cpp.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 import subprocess 3 import subprocess
4 import sys 4 import sys
5 5
6 import css_properties 6 import css_properties
7 import in_generator 7 import in_generator
8 import license 8 import license
9 9
10 10
11 HEADER_TEMPLATE = """ 11 HEADER_TEMPLATE = """
12 %(license)s 12 %(license)s
13 13
14 #ifndef %(class_name)s_h 14 #ifndef %(class_name)s_h
15 #define %(class_name)s_h 15 #define %(class_name)s_h
16 16
17 #include "core/CoreExport.h" 17 #include "core/CoreExport.h"
18 #include "core/css/parser/CSSParserMode.h" 18 #include "wtf/Assertions.h"
19 #include "wtf/HashFunctions.h" 19 #include <stddef.h>
20 #include "wtf/HashTraits.h"
21 #include <string.h>
22 20
23 namespace WTF { 21 namespace WTF {
24 class AtomicString; 22 class AtomicString;
25 class String; 23 class String;
26 } 24 }
27 25
28 namespace blink { 26 namespace blink {
29 27
30 enum CSSPropertyID { 28 enum CSSPropertyID {
31 CSSPropertyInvalid = 0, 29 CSSPropertyInvalid = 0,
(...skipping 26 matching lines...) Expand all
58 } 56 }
59 57
60 inline bool isPropertyAlias(CSSPropertyID id) { return id & 512; } 58 inline bool isPropertyAlias(CSSPropertyID id) { return id & 512; }
61 59
62 CSSPropertyID unresolvedCSSPropertyID(const WTF::String&); 60 CSSPropertyID unresolvedCSSPropertyID(const WTF::String&);
63 61
64 CSSPropertyID CORE_EXPORT cssPropertyID(const WTF::String&); 62 CSSPropertyID CORE_EXPORT cssPropertyID(const WTF::String&);
65 63
66 } // namespace blink 64 } // namespace blink
67 65
68 namespace WTF {
69 template<> struct DefaultHash<blink::CSSPropertyID> { typedef IntHash<unsigned> Hash; };
70 template<> struct HashTraits<blink::CSSPropertyID> : GenericHashTraits<blink::CS SPropertyID> {
71 static const bool emptyValueIsZero = true;
72 static void constructDeletedValue(blink::CSSPropertyID& slot, bool) { slot = static_cast<blink::CSSPropertyID>(blink::lastUnresolvedCSSProperty + 1); }
73 static bool isDeletedValue(blink::CSSPropertyID value) { return value == (bl ink::lastUnresolvedCSSProperty + 1); }
74 };
75 }
76
77 #endif // %(class_name)s_h 66 #endif // %(class_name)s_h
78 """ 67 """
79 68
80 GPERF_TEMPLATE = """ 69 GPERF_TEMPLATE = """
81 %%{ 70 %%{
82 %(license)s 71 %(license)s
83 72
84 #include "%(class_name)s.h" 73 #include "%(class_name)s.h"
85 #include "core/css/HashTools.h" 74 #include "core/css/HashTools.h"
86 #include <string.h> 75 #include <string.h>
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 # FIXME: If we could depend on Python 2.7, we would use subprocess.check _output 219 # FIXME: If we could depend on Python 2.7, we would use subprocess.check _output
231 gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n'] 220 gperf_args = [self.gperf_path, '--key-positions=*', '-P', '-n']
232 gperf_args.extend(['-m', '50']) # Pick best of 50 attempts. 221 gperf_args.extend(['-m', '50']) # Pick best of 50 attempts.
233 gperf_args.append('-D') # Allow duplicate hashes -> More compact code. 222 gperf_args.append('-D') # Allow duplicate hashes -> More compact code.
234 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr ocess.PIPE, universal_newlines=True) 223 gperf = subprocess.Popen(gperf_args, stdin=subprocess.PIPE, stdout=subpr ocess.PIPE, universal_newlines=True)
235 return gperf.communicate(gperf_input)[0] 224 return gperf.communicate(gperf_input)[0]
236 225
237 226
238 if __name__ == "__main__": 227 if __name__ == "__main__":
239 in_generator.Maker(CSSPropertyNamesWriter).main(sys.argv) 228 in_generator.Maker(CSSPropertyNamesWriter).main(sys.argv)
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/scripts/templates/CSSOMKeywords.cpp.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698