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

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

Issue 350033005: Protect against unknown idl types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 | no next file » | 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 if base_idl_type.endswith('ConstructorConstructor'): 336 if base_idl_type.endswith('ConstructorConstructor'):
337 # FIXME: rename to NamedConstructor 337 # FIXME: rename to NamedConstructor
338 # FIXME: replace with a [NamedConstructorAttribute] extended attribute 338 # FIXME: replace with a [NamedConstructorAttribute] extended attribute
339 # Ending with 'ConstructorConstructor' indicates a named constructor, 339 # Ending with 'ConstructorConstructor' indicates a named constructor,
340 # and these do not have header files, as they are part of the generated 340 # and these do not have header files, as they are part of the generated
341 # bindings for the interface 341 # bindings for the interface
342 return set() 342 return set()
343 if base_idl_type.endswith('Constructor'): 343 if base_idl_type.endswith('Constructor'):
344 # FIXME: replace with a [ConstructorAttribute] extended attribute 344 # FIXME: replace with a [ConstructorAttribute] extended attribute
345 base_idl_type = idl_type.constructor_type_name 345 base_idl_type = idl_type.constructor_type_name
346 if base_idl_type not in component_dir:
347 return set()
346 return set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type], 348 return set(['bindings/%s/v8/V8%s.h' % (component_dir[base_idl_type],
347 base_idl_type)]) 349 base_idl_type)])
348 350
349 IdlType.includes_for_type = property(includes_for_type) 351 IdlType.includes_for_type = property(includes_for_type)
350 IdlUnionType.includes_for_type = property( 352 IdlUnionType.includes_for_type = property(
351 lambda self: set.union(*[includes_for_type(member_type) 353 lambda self: set.union(*[includes_for_type(member_type)
352 for member_type in self.member_types])) 354 for member_type in self.member_types]))
353 355
354 356
355 def add_includes_for_type(idl_type): 357 def add_includes_for_type(idl_type):
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 702
701 def literal_cpp_value(idl_type, idl_literal): 703 def literal_cpp_value(idl_type, idl_literal):
702 """Converts an expression that is a valid C++ literal for this type.""" 704 """Converts an expression that is a valid C++ literal for this type."""
703 # FIXME: add validation that idl_type and idl_literal are compatible 705 # FIXME: add validation that idl_type and idl_literal are compatible
704 literal_value = str(idl_literal) 706 literal_value = str(idl_literal)
705 if idl_type.base_type in CPP_UNSIGNED_TYPES: 707 if idl_type.base_type in CPP_UNSIGNED_TYPES:
706 return literal_value + 'u' 708 return literal_value + 'u'
707 return literal_value 709 return literal_value
708 710
709 IdlType.literal_cpp_value = literal_cpp_value 711 IdlType.literal_cpp_value = literal_cpp_value
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698