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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/code_generator.py

Issue 2573713002: [Bindings][Refactoring] Remove filters for origin trial features (Closed)
Patch Set: Rebase Created 4 years 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/bindings/scripts/v8_interface.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # pylint: disable=import-error,print-statement,relative-import 5 # pylint: disable=import-error,print-statement,relative-import
6 6
7 """Plumbing for a Jinja-based code generator, including CodeGeneratorBase, a bas e class for all generators.""" 7 """Plumbing for a Jinja-based code generator, including CodeGeneratorBase, a bas e class for all generators."""
8 8
9 import os 9 import os
10 import posixpath 10 import posixpath
11 import re 11 import re
12 import sys 12 import sys
13 13
14 from idl_types import set_ancestors, IdlType 14 from idl_types import set_ancestors, IdlType
15 from v8_globals import includes 15 from v8_globals import includes
16 from v8_interface import constant_filters 16 from v8_interface import constant_filters
17 from v8_types import set_component_dirs 17 from v8_types import set_component_dirs
18 from v8_methods import method_filters 18 from v8_methods import method_filters
19 from v8_utilities import capitalize, for_origin_trial_feature, unique_by 19 from v8_utilities import capitalize, unique_by
20 from utilities import (idl_filename_to_component, is_valid_component_dependency, 20 from utilities import (idl_filename_to_component, is_valid_component_dependency,
21 format_remove_duplicates, format_blink_cpp_source_code) 21 format_remove_duplicates, format_blink_cpp_source_code)
22 22
23 # Path handling for libraries and templates 23 # Path handling for libraries and templates
24 # Paths have to be normalized because Jinja uses the exact template path to 24 # Paths have to be normalized because Jinja uses the exact template path to
25 # determine the hash used in the cache filename, and we need a pre-caching step 25 # determine the hash used in the cache filename, and we need a pre-caching step
26 # to be concurrency-safe. Use absolute path because __file__ is absolute if 26 # to be concurrency-safe. Use absolute path because __file__ is absolute if
27 # module is imported, and relative if executed directly. 27 # module is imported, and relative if executed directly.
28 # If paths differ between pre-caching and individual file compilation, the cache 28 # If paths differ between pre-caching and individual file compilation, the cache
29 # is regenerated, which causes a race condition and breaks concurrent build, 29 # is regenerated, which causes a race condition and breaks concurrent build,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 loader=jinja2.FileSystemLoader(TEMPLATES_DIR), 75 loader=jinja2.FileSystemLoader(TEMPLATES_DIR),
76 # Bytecode cache is not concurrency-safe unless pre-cached: 76 # Bytecode cache is not concurrency-safe unless pre-cached:
77 # if pre-cached this is read-only, but writing creates a race condition. 77 # if pre-cached this is read-only, but writing creates a race condition.
78 bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), 78 bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir),
79 keep_trailing_newline=True, # newline-terminate generated files 79 keep_trailing_newline=True, # newline-terminate generated files
80 lstrip_blocks=True, # so can indent control flow tags 80 lstrip_blocks=True, # so can indent control flow tags
81 trim_blocks=True) 81 trim_blocks=True)
82 jinja_env.filters.update({ 82 jinja_env.filters.update({
83 'blink_capitalize': capitalize, 83 'blink_capitalize': capitalize,
84 'exposed': exposed_if, 84 'exposed': exposed_if,
85 'for_origin_trial_feature': for_origin_trial_feature,
86 'format_blink_cpp_source_code': format_blink_cpp_source_code, 85 'format_blink_cpp_source_code': format_blink_cpp_source_code,
87 'format_remove_duplicates': format_remove_duplicates, 86 'format_remove_duplicates': format_remove_duplicates,
88 'runtime_enabled': runtime_enabled_if, 87 'runtime_enabled': runtime_enabled_if,
89 'secure_context': secure_context_if, 88 'secure_context': secure_context_if,
90 'unique_by': unique_by}) 89 'unique_by': unique_by})
91 jinja_env.filters.update(constant_filters()) 90 jinja_env.filters.update(constant_filters())
92 jinja_env.filters.update(method_filters()) 91 jinja_env.filters.update(method_filters())
93 return jinja_env 92 return jinja_env
94 93
95 94
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 180
182 # Create a dummy file as output for the build system, 181 # Create a dummy file as output for the build system,
183 # since filenames of individual cache files are unpredictable and opaque 182 # since filenames of individual cache files are unpredictable and opaque
184 # (they are hashes of the template path, which varies based on environment) 183 # (they are hashes of the template path, which varies based on environment)
185 with open(dummy_filename, 'w') as dummy_file: 184 with open(dummy_filename, 'w') as dummy_file:
186 pass # |open| creates or touches the file 185 pass # |open| creates or touches the file
187 186
188 187
189 if __name__ == '__main__': 188 if __name__ == '__main__':
190 sys.exit(main(sys.argv)) 189 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698