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

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

Issue 2057273002: [OriginTrials] Support OriginTrialEnabled IDL attribute on constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move signature creation out of for loop Created 4 years, 6 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
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 from idl_definitions import Visitor 75 from idl_definitions import Visitor
76 import idl_types 76 import idl_types
77 from idl_types import IdlType 77 from idl_types import IdlType
78 from v8_attributes import attribute_filters 78 from v8_attributes import attribute_filters
79 import v8_callback_interface 79 import v8_callback_interface
80 import v8_dictionary 80 import v8_dictionary
81 from v8_globals import includes, interfaces 81 from v8_globals import includes, interfaces
82 import v8_interface 82 import v8_interface
83 import v8_types 83 import v8_types
84 import v8_union 84 import v8_union
85 from v8_utilities import capitalize, cpp_name, unique_by 85 from v8_utilities import capitalize, cpp_name, for_origin_trial_feature, unique_ by
86 from utilities import idl_filename_to_component, is_valid_component_dependency, is_testing_target, shorten_union_name 86 from utilities import idl_filename_to_component, is_valid_component_dependency, is_testing_target, shorten_union_name
87 87
88 88
89 def normalize_and_sort_includes(include_paths): 89 def normalize_and_sort_includes(include_paths):
90 normalized_include_paths = [] 90 normalized_include_paths = []
91 for include_path in include_paths: 91 for include_path in include_paths:
92 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path)) 92 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path))
93 if match: 93 if match:
94 include_path = match.group(1) 94 include_path = match.group(1)
95 normalized_include_paths.append(include_path) 95 normalized_include_paths.append(include_path)
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 loader=jinja2.FileSystemLoader(templates_dir), 418 loader=jinja2.FileSystemLoader(templates_dir),
419 # Bytecode cache is not concurrency-safe unless pre-cached: 419 # Bytecode cache is not concurrency-safe unless pre-cached:
420 # if pre-cached this is read-only, but writing creates a race condition. 420 # if pre-cached this is read-only, but writing creates a race condition.
421 bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), 421 bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir),
422 keep_trailing_newline=True, # newline-terminate generated files 422 keep_trailing_newline=True, # newline-terminate generated files
423 lstrip_blocks=True, # so can indent control flow tags 423 lstrip_blocks=True, # so can indent control flow tags
424 trim_blocks=True) 424 trim_blocks=True)
425 jinja_env.filters.update({ 425 jinja_env.filters.update({
426 'blink_capitalize': capitalize, 426 'blink_capitalize': capitalize,
427 'exposed': exposed_if, 427 'exposed': exposed_if,
428 'for_origin_trial_feature': for_origin_trial_feature,
428 'runtime_enabled': runtime_enabled_if, 429 'runtime_enabled': runtime_enabled_if,
429 'unique_by': unique_by, 430 'unique_by': unique_by,
430 }) 431 })
431 jinja_env.filters.update(attribute_filters()) 432 jinja_env.filters.update(attribute_filters())
432 jinja_env.filters.update(v8_interface.constant_filters()) 433 jinja_env.filters.update(v8_interface.constant_filters())
433 return jinja_env 434 return jinja_env
434 435
435 436
436 def generate_indented_conditional(code, conditional): 437 def generate_indented_conditional(code, conditional):
437 # Indent if statement to level of original code 438 # Indent if statement to level of original code
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 477
477 # Create a dummy file as output for the build system, 478 # Create a dummy file as output for the build system,
478 # since filenames of individual cache files are unpredictable and opaque 479 # since filenames of individual cache files are unpredictable and opaque
479 # (they are hashes of the template path, which varies based on environment) 480 # (they are hashes of the template path, which varies based on environment)
480 with open(dummy_filename, 'w') as dummy_file: 481 with open(dummy_filename, 'w') as dummy_file:
481 pass # |open| creates or touches the file 482 pass # |open| creates or touches the file
482 483
483 484
484 if __name__ == '__main__': 485 if __name__ == '__main__':
485 sys.exit(main(sys.argv)) 486 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698