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

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

Issue 839633003: IDL: [NoImplHeader] should not add '#include "None"' (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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 | Source/bindings/scripts/v8_types.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 (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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 header_template_filename = 'interface.h' 184 header_template_filename = 'interface.h'
185 cpp_template_filename = 'interface.cpp' 185 cpp_template_filename = 'interface.cpp'
186 interface_context = v8_interface.interface_context 186 interface_context = v8_interface.interface_context
187 header_template = self.jinja_env.get_template(header_template_filename) 187 header_template = self.jinja_env.get_template(header_template_filename)
188 cpp_template = self.jinja_env.get_template(cpp_template_filename) 188 cpp_template = self.jinja_env.get_template(cpp_template_filename)
189 189
190 template_context = interface_context(interface) 190 template_context = interface_context(interface)
191 # Add the include for interface itself 191 # Add the include for interface itself
192 if IdlType(interface_name).is_typed_array: 192 if IdlType(interface_name).is_typed_array:
193 template_context['header_includes'].add('core/dom/DOMTypedArray.h') 193 template_context['header_includes'].add('core/dom/DOMTypedArray.h')
194 else: 194 elif interface_info['include_path']:
195 template_context['header_includes'].add(interface_info['include_path ']) 195 template_context['header_includes'].add(interface_info['include_path '])
196 header_text, cpp_text = render_template( 196 header_text, cpp_text = render_template(
197 include_paths, header_template, cpp_template, template_context, 197 include_paths, header_template, cpp_template, template_context,
198 component) 198 component)
199 header_path, cpp_path = self.output_paths(interface_name) 199 header_path, cpp_path = self.output_paths(interface_name)
200 return ( 200 return (
201 (header_path, header_text), 201 (header_path, header_text),
202 (cpp_path, cpp_text), 202 (cpp_path, cpp_text),
203 ) 203 )
204 204
205 def generate_dictionary_code(self, definitions, dictionary_name, 205 def generate_dictionary_code(self, definitions, dictionary_name,
206 dictionary): 206 dictionary):
207 interfaces_info = self.info_provider.interfaces_info 207 interfaces_info = self.info_provider.interfaces_info
208 header_template = self.jinja_env.get_template('dictionary_v8.h') 208 header_template = self.jinja_env.get_template('dictionary_v8.h')
209 cpp_template = self.jinja_env.get_template('dictionary_v8.cpp') 209 cpp_template = self.jinja_env.get_template('dictionary_v8.cpp')
210 template_context = v8_dictionary.dictionary_context( 210 template_context = v8_dictionary.dictionary_context(
211 dictionary, interfaces_info) 211 dictionary, interfaces_info)
212 interface_info = interfaces_info[dictionary_name] 212 interface_info = interfaces_info[dictionary_name]
213 include_paths = interface_info.get('dependencies_include_paths') 213 include_paths = interface_info.get('dependencies_include_paths')
214 # Add the include for interface itself 214 # Add the include for interface itself
215 template_context['header_includes'].add(interface_info['include_path']) 215 if interface_info['include_path']:
216 template_context['header_includes'].add(interface_info['include_path '])
216 header_text, cpp_text = render_template( 217 header_text, cpp_text = render_template(
217 include_paths, header_template, cpp_template, template_context) 218 include_paths, header_template, cpp_template, template_context)
218 header_path, cpp_path = self.output_paths(dictionary_name) 219 header_path, cpp_path = self.output_paths(dictionary_name)
219 return ( 220 return (
220 (header_path, header_text), 221 (header_path, header_text),
221 (cpp_path, cpp_text), 222 (cpp_path, cpp_text),
222 ) 223 )
223 224
224 225
225 class CodeGeneratorDictionaryImpl(CodeGeneratorBase): 226 class CodeGeneratorDictionaryImpl(CodeGeneratorBase):
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 390
390 # Create a dummy file as output for the build system, 391 # Create a dummy file as output for the build system,
391 # since filenames of individual cache files are unpredictable and opaque 392 # since filenames of individual cache files are unpredictable and opaque
392 # (they are hashes of the template path, which varies based on environment) 393 # (they are hashes of the template path, which varies based on environment)
393 with open(dummy_filename, 'w') as dummy_file: 394 with open(dummy_filename, 'w') as dummy_file:
394 pass # |open| creates or touches the file 395 pass # |open| creates or touches the file
395 396
396 397
397 if __name__ == '__main__': 398 if __name__ == '__main__':
398 sys.exit(main(sys.argv)) 399 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698