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

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 else:
Jens Widell 2015/01/09 09:09:17 Use "elif"?
bashi 2015/01/09 09:13:21 Done.
195 template_context['header_includes'].add(interface_info['include_path ']) 195 if interface_info['include_path']:
196 template_context['header_includes'].add(interface_info['include_ path'])
196 header_text, cpp_text = render_template( 197 header_text, cpp_text = render_template(
197 include_paths, header_template, cpp_template, template_context, 198 include_paths, header_template, cpp_template, template_context,
198 component) 199 component)
199 header_path, cpp_path = self.output_paths(interface_name) 200 header_path, cpp_path = self.output_paths(interface_name)
200 return ( 201 return (
201 (header_path, header_text), 202 (header_path, header_text),
202 (cpp_path, cpp_text), 203 (cpp_path, cpp_text),
203 ) 204 )
204 205
205 def generate_dictionary_code(self, definitions, dictionary_name, 206 def generate_dictionary_code(self, definitions, dictionary_name,
206 dictionary): 207 dictionary):
207 interfaces_info = self.info_provider.interfaces_info 208 interfaces_info = self.info_provider.interfaces_info
208 header_template = self.jinja_env.get_template('dictionary_v8.h') 209 header_template = self.jinja_env.get_template('dictionary_v8.h')
209 cpp_template = self.jinja_env.get_template('dictionary_v8.cpp') 210 cpp_template = self.jinja_env.get_template('dictionary_v8.cpp')
210 template_context = v8_dictionary.dictionary_context( 211 template_context = v8_dictionary.dictionary_context(
211 dictionary, interfaces_info) 212 dictionary, interfaces_info)
212 interface_info = interfaces_info[dictionary_name] 213 interface_info = interfaces_info[dictionary_name]
213 include_paths = interface_info.get('dependencies_include_paths') 214 include_paths = interface_info.get('dependencies_include_paths')
214 # Add the include for interface itself 215 # Add the include for interface itself
215 template_context['header_includes'].add(interface_info['include_path']) 216 if interface_info['include_path']:
217 template_context['header_includes'].add(interface_info['include_path '])
216 header_text, cpp_text = render_template( 218 header_text, cpp_text = render_template(
217 include_paths, header_template, cpp_template, template_context) 219 include_paths, header_template, cpp_template, template_context)
218 header_path, cpp_path = self.output_paths(dictionary_name) 220 header_path, cpp_path = self.output_paths(dictionary_name)
219 return ( 221 return (
220 (header_path, header_text), 222 (header_path, header_text),
221 (cpp_path, cpp_text), 223 (cpp_path, cpp_text),
222 ) 224 )
223 225
224 226
225 class CodeGeneratorDictionaryImpl(CodeGeneratorBase): 227 class CodeGeneratorDictionaryImpl(CodeGeneratorBase):
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 391
390 # Create a dummy file as output for the build system, 392 # Create a dummy file as output for the build system,
391 # since filenames of individual cache files are unpredictable and opaque 393 # since filenames of individual cache files are unpredictable and opaque
392 # (they are hashes of the template path, which varies based on environment) 394 # (they are hashes of the template path, which varies based on environment)
393 with open(dummy_filename, 'w') as dummy_file: 395 with open(dummy_filename, 'w') as dummy_file:
394 pass # |open| creates or touches the file 396 pass # |open| creates or touches the file
395 397
396 398
397 if __name__ == '__main__': 399 if __name__ == '__main__':
398 sys.exit(main(sys.argv)) 400 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