OLD | NEW |
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 'function_template': function_template(), | 124 'function_template': function_template(), |
125 'has_custom_registration': is_static or | 125 'has_custom_registration': is_static or |
126 v8_utilities.has_extended_attribute( | 126 v8_utilities.has_extended_attribute( |
127 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), | 127 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), |
128 'has_event_listener_argument': has_event_listener_argument, | 128 'has_event_listener_argument': has_event_listener_argument, |
129 'has_exception_state': | 129 'has_exception_state': |
130 has_event_listener_argument or | 130 has_event_listener_argument or |
131 is_raises_exception or | 131 is_raises_exception or |
132 is_check_security_for_frame or | 132 is_check_security_for_frame or |
133 any(argument for argument in arguments | 133 any(argument for argument in arguments |
134 if argument.idl_type.name in ('ByteString', | 134 if argument.idl_type.name == 'SerializedScriptValue' or |
135 'ScalarValueString', | 135 argument.idl_type.may_raise_exception_on_conversion), |
136 'SerializedScriptValue') or | |
137 argument.idl_type.is_integer_type), | |
138 'idl_type': idl_type.base_type, | 136 'idl_type': idl_type.base_type, |
139 'is_call_with_execution_context': has_extended_attribute_value(method, '
CallWith', 'ExecutionContext'), | 137 'is_call_with_execution_context': has_extended_attribute_value(method, '
CallWith', 'ExecutionContext'), |
140 'is_call_with_script_arguments': is_call_with_script_arguments, | 138 'is_call_with_script_arguments': is_call_with_script_arguments, |
141 'is_call_with_script_state': is_call_with_script_state, | 139 'is_call_with_script_state': is_call_with_script_state, |
142 'is_check_security_for_frame': is_check_security_for_frame, | 140 'is_check_security_for_frame': is_check_security_for_frame, |
143 'is_check_security_for_node': is_check_security_for_node, | 141 'is_check_security_for_node': is_check_security_for_node, |
144 'is_custom': 'Custom' in extended_attributes, | 142 'is_custom': 'Custom' in extended_attributes, |
145 'is_custom_element_callbacks': is_custom_element_callbacks, | 143 'is_custom_element_callbacks': is_custom_element_callbacks, |
146 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, | 144 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, |
147 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute
s, | 145 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute
s, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 | 304 |
307 def v8_value_to_local_cpp_value(argument, index): | 305 def v8_value_to_local_cpp_value(argument, index): |
308 extended_attributes = argument.extended_attributes | 306 extended_attributes = argument.extended_attributes |
309 idl_type = argument.idl_type | 307 idl_type = argument.idl_type |
310 name = argument.name | 308 name = argument.name |
311 if argument.is_variadic: | 309 if argument.is_variadic: |
312 return v8_value_to_local_cpp_variadic_value(argument, index) | 310 return v8_value_to_local_cpp_variadic_value(argument, index) |
313 # FIXME: This special way of handling string arguments with null defaults | 311 # FIXME: This special way of handling string arguments with null defaults |
314 # can go away once we fully support default values. | 312 # can go away once we fully support default values. |
315 if (argument.is_optional and | 313 if (argument.is_optional and |
316 idl_type.name in ('String', 'ByteString', 'ScalarValueString') and | 314 idl_type.is_string_type and |
317 argument.default_value and argument.default_value.is_null): | 315 argument.default_value and argument.default_value.is_null): |
318 v8_value = 'argumentOrNull(info, %s)' % index | 316 v8_value = 'argumentOrNull(info, %s)' % index |
319 else: | 317 else: |
320 v8_value = 'info[%s]' % index | 318 v8_value = 'info[%s]' % index |
321 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, | 319 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, |
322 name, index=index, declare_varia
ble=False) | 320 name, index=index, declare_varia
ble=False) |
323 | 321 |
324 | 322 |
325 ################################################################################ | 323 ################################################################################ |
326 # Auxiliary functions | 324 # Auxiliary functions |
(...skipping 13 matching lines...) Expand all Loading... |
340 | 338 |
341 | 339 |
342 def union_arguments(idl_type): | 340 def union_arguments(idl_type): |
343 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 341 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" |
344 return [arg | 342 return [arg |
345 for i in range(len(idl_type.member_types)) | 343 for i in range(len(idl_type.member_types)) |
346 for arg in ['result%sEnabled' % i, 'result%s' % i]] | 344 for arg in ['result%sEnabled' % i, 'result%s' % i]] |
347 | 345 |
348 IdlType.union_arguments = property(lambda self: None) | 346 IdlType.union_arguments = property(lambda self: None) |
349 IdlUnionType.union_arguments = property(union_arguments) | 347 IdlUnionType.union_arguments = property(union_arguments) |
OLD | NEW |