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

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

Issue 470063003: IDL: Use IdlArrayOrSequenceType for array/sequence IDL types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-extend-IdlTypeBase
Patch Set: set is_sequence=True for sequence types Created 6 years, 4 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
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([ 46 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([
47 'DoNotCheckSecurity', 47 'DoNotCheckSecurity',
48 'DoNotCheckSignature', 48 'DoNotCheckSignature',
49 'NotEnumerable', 49 'NotEnumerable',
50 'Unforgeable', 50 'Unforgeable',
51 ]) 51 ])
52 52
53 53
54 def argument_needs_try_catch(argument, return_promise): 54 def argument_needs_try_catch(argument, return_promise):
55 idl_type = argument.idl_type 55 idl_type = argument.idl_type
56 base_type = not idl_type.native_array_element_type and idl_type.base_type 56 base_type = idl_type.base_type
57 57
58 return not ( 58 return not (
59 # These cases are handled by separate code paths in the 59 # These cases are handled by separate code paths in the
60 # generate_argument() macro in Source/bindings/templates/methods.cpp. 60 # generate_argument() macro in Source/bindings/templates/methods.cpp.
61 idl_type.is_callback_interface or 61 idl_type.is_callback_interface or
62 base_type == 'SerializedScriptValue' or 62 base_type == 'SerializedScriptValue' or
63 (argument.is_variadic and idl_type.is_wrapper_type) or 63 (argument.is_variadic and idl_type.is_wrapper_type) or
64 # String and enumeration arguments converted using one of the 64 # String and enumeration arguments converted using one of the
65 # TOSTRING_* macros except for _PROMISE variants in 65 # TOSTRING_* macros except for _PROMISE variants in
66 # Source/bindings/core/v8/V8BindingMacros.h don't use a v8::TryCatch. 66 # Source/bindings/core/v8/V8BindingMacros.h don't use a v8::TryCatch.
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 'has_default': 'Default' in extended_attributes or argument.default_valu e, 226 'has_default': 'Default' in extended_attributes or argument.default_valu e,
227 'has_type_checking_interface': 227 'has_type_checking_interface':
228 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or 228 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or
229 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and 229 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and
230 idl_type.is_wrapper_type, 230 idl_type.is_wrapper_type,
231 'has_type_checking_unrestricted': 231 'has_type_checking_unrestricted':
232 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or 232 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or
233 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and 233 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and
234 idl_type.name in ('Float', 'Double'), 234 idl_type.name in ('Float', 'Double'),
235 # Dictionary is special-cased, but arrays and sequences shouldn't be 235 # Dictionary is special-cased, but arrays and sequences shouldn't be
236 'idl_type': not idl_type.native_array_element_type and idl_type.base_typ e, 236 'idl_type': idl_type.base_type,
237 'idl_type_object': idl_type, 237 'idl_type_object': idl_type,
238 'index': index, 238 'index': index,
239 'is_clamp': 'Clamp' in extended_attributes, 239 'is_clamp': 'Clamp' in extended_attributes,
240 'is_callback_interface': idl_type.is_callback_interface, 240 'is_callback_interface': idl_type.is_callback_interface,
241 'is_nullable': idl_type.is_nullable, 241 'is_nullable': idl_type.is_nullable,
242 'is_optional': argument.is_optional, 242 'is_optional': argument.is_optional,
243 'is_variadic_wrapper_type': is_variadic_wrapper_type, 243 'is_variadic_wrapper_type': is_variadic_wrapper_type,
244 'is_wrapper_type': idl_type.is_wrapper_type, 244 'is_wrapper_type': idl_type.is_wrapper_type,
245 'name': argument.name, 245 'name': argument.name,
246 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( 246 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 408
409 409
410 def argument_default_cpp_value(argument): 410 def argument_default_cpp_value(argument):
411 if not argument.default_value: 411 if not argument.default_value:
412 return None 412 return None
413 return argument.idl_type.literal_cpp_value(argument.default_value) 413 return argument.idl_type.literal_cpp_value(argument.default_value)
414 414
415 IdlTypeBase.union_arguments = None 415 IdlTypeBase.union_arguments = None
416 IdlUnionType.union_arguments = property(union_arguments) 416 IdlUnionType.union_arguments = property(union_arguments)
417 IdlArgument.default_cpp_value = property(argument_default_cpp_value) 417 IdlArgument.default_cpp_value = property(argument_default_cpp_value)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698