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

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

Issue 1557363002: Remove the WEB_AUDIO compile time flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/features.gypi » ('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 (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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 import v8_callback_interface 76 import v8_callback_interface
77 import v8_dictionary 77 import v8_dictionary
78 from v8_globals import includes, interfaces 78 from v8_globals import includes, interfaces
79 import v8_interface 79 import v8_interface
80 import v8_types 80 import v8_types
81 import v8_union 81 import v8_union
82 from v8_utilities import capitalize, cpp_name, conditional_string, v8_class_name 82 from v8_utilities import capitalize, cpp_name, conditional_string, v8_class_name
83 from utilities import KNOWN_COMPONENTS, idl_filename_to_component, is_valid_comp onent_dependency, is_testing_target 83 from utilities import KNOWN_COMPONENTS, idl_filename_to_component, is_valid_comp onent_dependency, is_testing_target
84 84
85 85
86 def normalize_and_sort_includes(include_paths):
87 normalized_include_paths = []
88 for include_path in include_paths:
89 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path))
90 if match:
91 include_path = match.group(1)
92 normalized_include_paths.append(include_path)
93 return sorted(normalized_include_paths)
94
95
86 def render_template(include_paths, header_template, cpp_template, 96 def render_template(include_paths, header_template, cpp_template,
87 template_context, component=None): 97 template_context, component=None):
88 template_context['code_generator'] = module_pyname 98 template_context['code_generator'] = module_pyname
89 99
90 # Add includes for any dependencies 100 # Add includes for any dependencies
91 template_context['header_includes'] = sorted( 101 template_context['header_includes'] = normalize_and_sort_includes(
92 template_context['header_includes']) 102 template_context['header_includes'])
93 103
94 for include_path in include_paths: 104 for include_path in include_paths:
95 if component: 105 if component:
96 dependency = idl_filename_to_component(include_path) 106 dependency = idl_filename_to_component(include_path)
97 assert is_valid_component_dependency(component, dependency) 107 assert is_valid_component_dependency(component, dependency)
98 includes.add(include_path) 108 includes.add(include_path)
99 109
100 template_context['cpp_includes'] = sorted(includes) 110 template_context['cpp_includes'] = normalize_and_sort_includes(includes)
101 111
102 header_text = header_template.render(template_context) 112 header_text = header_template.render(template_context)
103 cpp_text = cpp_template.render(template_context) 113 cpp_text = cpp_template.render(template_context)
104 return header_text, cpp_text 114 return header_text, cpp_text
105 115
106 116
107 def set_global_type_info(info_provider): 117 def set_global_type_info(info_provider):
108 interfaces_info = info_provider.interfaces_info 118 interfaces_info = info_provider.interfaces_info
109 idl_types.set_ancestors(interfaces_info['ancestors']) 119 idl_types.set_ancestors(interfaces_info['ancestors'])
110 IdlType.set_callback_interfaces(interfaces_info['callback_interfaces']) 120 IdlType.set_callback_interfaces(interfaces_info['callback_interfaces'])
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 375
366 # Add UnionTypesCore.h as a dependency when we generate modules union ty pes 376 # Add UnionTypesCore.h as a dependency when we generate modules union ty pes
367 # because we only generate union type containers which are used by both 377 # because we only generate union type containers which are used by both
368 # core and modules in UnionTypesCore.h. 378 # core and modules in UnionTypesCore.h.
369 # FIXME: This is an ad hoc workaround and we need a general way to 379 # FIXME: This is an ad hoc workaround and we need a general way to
370 # handle core <-> modules dependency. 380 # handle core <-> modules dependency.
371 if self.target_component == 'modules': 381 if self.target_component == 'modules':
372 additional_header_includes.append( 382 additional_header_includes.append(
373 'bindings/core/v8/UnionTypesCore.h') 383 'bindings/core/v8/UnionTypesCore.h')
374 384
375 template_context['header_includes'] = sorted( 385 template_context['header_includes'] = normalize_and_sort_includes(
376 template_context['header_includes'] + additional_header_includes) 386 template_context['header_includes'] + additional_header_includes)
377 387
378 header_text = header_template.render(template_context) 388 header_text = header_template.render(template_context)
379 cpp_text = cpp_template.render(template_context) 389 cpp_text = cpp_template.render(template_context)
380 header_path = posixpath.join(self.output_dir, 390 header_path = posixpath.join(self.output_dir,
381 'UnionTypes%s.h' % capitalized_component) 391 'UnionTypes%s.h' % capitalized_component)
382 cpp_path = posixpath.join(self.output_dir, 392 cpp_path = posixpath.join(self.output_dir,
383 'UnionTypes%s.cpp' % capitalized_component) 393 'UnionTypes%s.cpp' % capitalized_component)
384 return ( 394 return (
385 (header_path, header_text), 395 (header_path, header_text),
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 469
460 # Create a dummy file as output for the build system, 470 # Create a dummy file as output for the build system,
461 # since filenames of individual cache files are unpredictable and opaque 471 # since filenames of individual cache files are unpredictable and opaque
462 # (they are hashes of the template path, which varies based on environment) 472 # (they are hashes of the template path, which varies based on environment)
463 with open(dummy_filename, 'w') as dummy_file: 473 with open(dummy_filename, 'w') as dummy_file:
464 pass # |open| creates or touches the file 474 pass # |open| creates or touches the file
465 475
466 476
467 if __name__ == '__main__': 477 if __name__ == '__main__':
468 sys.exit(main(sys.argv)) 478 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/build/features.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698