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

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

Issue 2458913003: Add first sketch of the webmodules code generator. (Closed)
Patch Set: Implemented WebModuleAPI extended attribute. Created 4 years, 1 month 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (C) 2013 Google Inc. All rights reserved. 2 # Copyright (C) 2013 Google Inc. All rights reserved.
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 self.code_generator = code_generator_class(self.info_provider, 108 self.code_generator = code_generator_class(self.info_provider,
109 self.cache_directory, 109 self.cache_directory,
110 self.output_directory) 110 self.output_directory)
111 111
112 def compile_and_write(self, idl_filename): 112 def compile_and_write(self, idl_filename):
113 interface_name = idl_filename_to_interface_name(idl_filename) 113 interface_name = idl_filename_to_interface_name(idl_filename)
114 definitions = self.reader.read_idl_definitions(idl_filename) 114 definitions = self.reader.read_idl_definitions(idl_filename)
115 target_definitions = definitions[self.target_component] 115 target_definitions = definitions[self.target_component]
116 output_code_list = self.code_generator.generate_code( 116 output_code_list = self.code_generator.generate_code(
117 target_definitions, interface_name) 117 target_definitions, interface_name)
118
119 # Generator may choose to omit the file.
120 if output_code_list is None:
121 return
122
118 for output_path, output_code in output_code_list: 123 for output_path, output_code in output_code_list:
119 write_file(output_code, output_path) 124 write_file(output_code, output_path)
120 125
121 def compile_file(self, idl_filename): 126 def compile_file(self, idl_filename):
122 self.compile_and_write(idl_filename) 127 self.compile_and_write(idl_filename)
123 128
124 129
125 def generate_bindings(code_generator_class, info_provider, options, 130 def generate_bindings(code_generator_class, info_provider, options,
126 input_filenames): 131 input_filenames):
127 idl_compiler = IdlCompiler( 132 idl_compiler = IdlCompiler(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 generate_callback_function_impl(CodeGeneratorCallbackFunction, 196 generate_callback_function_impl(CodeGeneratorCallbackFunction,
192 info_provider, options) 197 info_provider, options)
193 else: 198 else:
194 # |input_filename| should be a path of an IDL file. 199 # |input_filename| should be a path of an IDL file.
195 generate_bindings(CodeGeneratorV8, info_provider, options, 200 generate_bindings(CodeGeneratorV8, info_provider, options,
196 [input_filename]) 201 [input_filename])
197 202
198 203
199 if __name__ == '__main__': 204 if __name__ == '__main__':
200 sys.exit(main()) 205 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698