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', 'SerializedScriptVal
ue') or | 134 if argument.idl_type.name in ('ByteString', |
| 135 'ScalarValueString', |
| 136 'SerializedScriptValue') or |
135 argument.idl_type.is_integer_type), | 137 argument.idl_type.is_integer_type), |
136 'idl_type': idl_type.base_type, | 138 'idl_type': idl_type.base_type, |
137 'is_call_with_execution_context': has_extended_attribute_value(method, '
CallWith', 'ExecutionContext'), | 139 'is_call_with_execution_context': has_extended_attribute_value(method, '
CallWith', 'ExecutionContext'), |
138 'is_call_with_script_arguments': is_call_with_script_arguments, | 140 'is_call_with_script_arguments': is_call_with_script_arguments, |
139 'is_call_with_script_state': is_call_with_script_state, | 141 'is_call_with_script_state': is_call_with_script_state, |
140 'is_check_security_for_frame': is_check_security_for_frame, | 142 'is_check_security_for_frame': is_check_security_for_frame, |
141 'is_check_security_for_node': is_check_security_for_node, | 143 'is_check_security_for_node': is_check_security_for_node, |
142 'is_custom': 'Custom' in extended_attributes, | 144 'is_custom': 'Custom' in extended_attributes, |
143 'is_custom_element_callbacks': is_custom_element_callbacks, | 145 'is_custom_element_callbacks': is_custom_element_callbacks, |
144 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, | 146 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 return '%s(%s)' % (macro, ', '.join(macro_args)) | 294 return '%s(%s)' % (macro, ', '.join(macro_args)) |
293 | 295 |
294 | 296 |
295 def v8_value_to_local_cpp_value(argument, index): | 297 def v8_value_to_local_cpp_value(argument, index): |
296 extended_attributes = argument.extended_attributes | 298 extended_attributes = argument.extended_attributes |
297 idl_type = argument.idl_type | 299 idl_type = argument.idl_type |
298 name = argument.name | 300 name = argument.name |
299 if argument.is_variadic: | 301 if argument.is_variadic: |
300 return v8_value_to_local_cpp_variadic_value(argument, index) | 302 return v8_value_to_local_cpp_variadic_value(argument, index) |
301 # [Default=NullString] | 303 # [Default=NullString] |
302 if (argument.is_optional and idl_type.name in ('String', 'ByteString') and | 304 if (argument.is_optional and |
| 305 idl_type.name in ('String', 'ByteString', 'ScalarValueString') and |
303 extended_attributes.get('Default') == 'NullString'): | 306 extended_attributes.get('Default') == 'NullString'): |
304 v8_value = 'argumentOrNull(info, %s)' % index | 307 v8_value = 'argumentOrNull(info, %s)' % index |
305 else: | 308 else: |
306 v8_value = 'info[%s]' % index | 309 v8_value = 'info[%s]' % index |
307 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, | 310 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value, |
308 name, index=index, declare_varia
ble=False) | 311 name, index=index, declare_varia
ble=False) |
309 | 312 |
310 | 313 |
311 ################################################################################ | 314 ################################################################################ |
312 # Auxiliary functions | 315 # Auxiliary functions |
(...skipping 13 matching lines...) Expand all Loading... |
326 | 329 |
327 | 330 |
328 def union_arguments(idl_type): | 331 def union_arguments(idl_type): |
329 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" | 332 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u
nion types, for use in setting return value""" |
330 return [arg | 333 return [arg |
331 for i in range(len(idl_type.member_types)) | 334 for i in range(len(idl_type.member_types)) |
332 for arg in ['result%sEnabled' % i, 'result%s' % i]] | 335 for arg in ['result%sEnabled' % i, 'result%s' % i]] |
333 | 336 |
334 IdlType.union_arguments = property(lambda self: None) | 337 IdlType.union_arguments = property(lambda self: None) |
335 IdlUnionType.union_arguments = property(union_arguments) | 338 IdlUnionType.union_arguments = property(union_arguments) |
OLD | NEW |