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

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

Issue 2568403002: [Bindings][Refactoring] Remove attribute filters from .tmpl files (Closed)
Patch Set: 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_attributes.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_attributes import attribute_filters
16 from v8_globals import includes 15 from v8_globals import includes
17 from v8_interface import constant_filters 16 from v8_interface import constant_filters
18 from v8_types import set_component_dirs 17 from v8_types import set_component_dirs
19 from v8_methods import method_filters 18 from v8_methods import method_filters
20 from v8_utilities import capitalize, for_origin_trial_feature, unique_by 19 from v8_utilities import capitalize, for_origin_trial_feature, unique_by
21 from utilities import (idl_filename_to_component, is_valid_component_dependency, 20 from utilities import (idl_filename_to_component, is_valid_component_dependency,
22 format_remove_duplicates, format_blink_cpp_source_code) 21 format_remove_duplicates, format_blink_cpp_source_code)
23 22
24 # Path handling for libraries and templates 23 # Path handling for libraries and templates
25 # 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
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 trim_blocks=True) 81 trim_blocks=True)
83 jinja_env.filters.update({ 82 jinja_env.filters.update({
84 'blink_capitalize': capitalize, 83 'blink_capitalize': capitalize,
85 'exposed': exposed_if, 84 'exposed': exposed_if,
86 'for_origin_trial_feature': for_origin_trial_feature, 85 'for_origin_trial_feature': for_origin_trial_feature,
87 'format_blink_cpp_source_code': format_blink_cpp_source_code, 86 'format_blink_cpp_source_code': format_blink_cpp_source_code,
88 'format_remove_duplicates': format_remove_duplicates, 87 'format_remove_duplicates': format_remove_duplicates,
89 'runtime_enabled': runtime_enabled_if, 88 'runtime_enabled': runtime_enabled_if,
90 'secure_context': secure_context_if, 89 'secure_context': secure_context_if,
91 'unique_by': unique_by}) 90 'unique_by': unique_by})
92 jinja_env.filters.update(attribute_filters())
93 jinja_env.filters.update(constant_filters()) 91 jinja_env.filters.update(constant_filters())
94 jinja_env.filters.update(method_filters()) 92 jinja_env.filters.update(method_filters())
95 return jinja_env 93 return jinja_env
96 94
97 95
98 def normalize_and_sort_includes(include_paths): 96 def normalize_and_sort_includes(include_paths):
99 normalized_include_paths = [] 97 normalized_include_paths = []
100 for include_path in include_paths: 98 for include_path in include_paths:
101 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path)) 99 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path))
102 if match: 100 if match:
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 174
177 # Create a dummy file as output for the build system, 175 # Create a dummy file as output for the build system,
178 # since filenames of individual cache files are unpredictable and opaque 176 # since filenames of individual cache files are unpredictable and opaque
179 # (they are hashes of the template path, which varies based on environment) 177 # (they are hashes of the template path, which varies based on environment)
180 with open(dummy_filename, 'w') as dummy_file: 178 with open(dummy_filename, 'w') as dummy_file:
181 pass # |open| creates or touches the file 179 pass # |open| creates or touches the file
182 180
183 181
184 if __name__ == '__main__': 182 if __name__ == '__main__':
185 sys.exit(main(sys.argv)) 183 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/scripts/v8_attributes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698