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

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

Issue 698423002: IDL union: nullable support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | Source/bindings/scripts/idl_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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 self.output_dir = output_dir 262 self.output_dir = output_dir
263 self.target_component = target_component 263 self.target_component = target_component
264 set_global_type_info(interfaces_info) 264 set_global_type_info(interfaces_info)
265 265
266 def generate_code(self, union_types): 266 def generate_code(self, union_types):
267 if not union_types: 267 if not union_types:
268 return () 268 return ()
269 header_template = self.jinja_env.get_template('union.h') 269 header_template = self.jinja_env.get_template('union.h')
270 cpp_template = self.jinja_env.get_template('union.cpp') 270 cpp_template = self.jinja_env.get_template('union.cpp')
271 template_context = v8_union.union_context( 271 template_context = v8_union.union_context(
272 sorted(union_types, key=lambda union_type: union_type.name), 272 union_types, self.interfaces_info)
273 self.interfaces_info)
274 template_context['code_generator'] = module_pyname 273 template_context['code_generator'] = module_pyname
275 capitalized_component = self.target_component.capitalize() 274 capitalized_component = self.target_component.capitalize()
276 template_context['header_filename'] = 'bindings/%s/v8/UnionTypes%s.h' % ( 275 template_context['header_filename'] = 'bindings/%s/v8/UnionTypes%s.h' % (
277 self.target_component, capitalized_component) 276 self.target_component, capitalized_component)
278 template_context['macro_guard'] = 'UnionType%s_h' % capitalized_componen t 277 template_context['macro_guard'] = 'UnionType%s_h' % capitalized_componen t
279 header_text = header_template.render(template_context) 278 header_text = header_template.render(template_context)
280 cpp_text = cpp_template.render(template_context) 279 cpp_text = cpp_template.render(template_context)
281 header_path = posixpath.join(self.output_dir, 280 header_path = posixpath.join(self.output_dir,
282 'UnionTypes%s.h' % capitalized_component) 281 'UnionTypes%s.h' % capitalized_component)
283 cpp_path = posixpath.join(self.output_dir, 282 cpp_path = posixpath.join(self.output_dir,
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 366
368 # Create a dummy file as output for the build system, 367 # Create a dummy file as output for the build system,
369 # since filenames of individual cache files are unpredictable and opaque 368 # since filenames of individual cache files are unpredictable and opaque
370 # (they are hashes of the template path, which varies based on environment) 369 # (they are hashes of the template path, which varies based on environment)
371 with open(dummy_filename, 'w') as dummy_file: 370 with open(dummy_filename, 'w') as dummy_file:
372 pass # |open| creates or touches the file 371 pass # |open| creates or touches the file
373 372
374 373
375 if __name__ == '__main__': 374 if __name__ == '__main__':
376 sys.exit(main(sys.argv)) 375 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/idl_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698