| 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 is_post_message = 'PostMessage' in extended_attributes | 111 is_post_message = 'PostMessage' in extended_attributes |
| 112 if is_post_message: | 112 if is_post_message: |
| 113 includes.add('bindings/core/v8/SerializedScriptValueFactory.h') | 113 includes.add('bindings/core/v8/SerializedScriptValueFactory.h') |
| 114 includes.add('core/dom/DOMArrayBuffer.h') | 114 includes.add('core/dom/DOMArrayBuffer.h') |
| 115 includes.add('core/dom/MessagePort.h') | 115 includes.add('core/dom/MessagePort.h') |
| 116 includes.add('core/frame/ImageBitmap.h') | 116 includes.add('core/frame/ImageBitmap.h') |
| 117 | 117 |
| 118 if 'LenientThis' in extended_attributes: | 118 if 'LenientThis' in extended_attributes: |
| 119 raise Exception('[LenientThis] is not supported for operations.') | 119 raise Exception('[LenientThis] is not supported for operations.') |
| 120 | 120 |
| 121 argument_contexts = [ |
| 122 argument_context(interface, method, argument, index, is_visible=is_visib
le) |
| 123 for index, argument in enumerate(arguments)] |
| 124 |
| 121 return { | 125 return { |
| 122 'activity_logging_world_list': v8_utilities.activity_logging_world_list(
method), # [ActivityLogging] | 126 'activity_logging_world_list': v8_utilities.activity_logging_world_list(
method), # [ActivityLogging] |
| 123 'arguments': [argument_context(interface, method, argument, index, is_vi
sible=is_visible) | 127 'arguments': argument_contexts, |
| 124 for index, argument in enumerate(arguments)], | |
| 125 'argument_declarations_for_private_script': | 128 'argument_declarations_for_private_script': |
| 126 argument_declarations_for_private_script(interface, method), | 129 argument_declarations_for_private_script(interface, method), |
| 127 'conditional_string': v8_utilities.conditional_string(method), | 130 'conditional_string': v8_utilities.conditional_string(method), |
| 128 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) | 131 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) |
| 129 if idl_type.is_explicit_nullable else idl_type.cpp_type), | 132 if idl_type.is_explicit_nullable else idl_type.cpp_type), |
| 130 'cpp_value': this_cpp_value, | 133 'cpp_value': this_cpp_value, |
| 131 'cpp_type_initializer': idl_type.cpp_type_initializer, | 134 'cpp_type_initializer': idl_type.cpp_type_initializer, |
| 132 'custom_registration_extended_attributes': | 135 'custom_registration_extended_attributes': |
| 133 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( | 136 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( |
| 134 extended_attributes.iterkeys()), | 137 extended_attributes.iterkeys()), |
| 135 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] | 138 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] |
| 136 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] | 139 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] |
| 137 # TODO(yukishiino): Retire has_custom_registration flag. Should be | 140 # TODO(yukishiino): Retire has_custom_registration flag. Should be |
| 138 # replaced with V8DOMConfiguration::PropertyLocationConfiguration. | 141 # replaced with V8DOMConfiguration::PropertyLocationConfiguration. |
| 139 'has_custom_registration': | 142 'has_custom_registration': |
| 140 v8_utilities.has_extended_attribute( | 143 v8_utilities.has_extended_attribute( |
| 141 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), | 144 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), |
| 142 'has_exception_state': | 145 'has_exception_state': |
| 143 is_raises_exception or | 146 is_raises_exception or |
| 144 is_check_security_for_receiver or | 147 is_check_security_for_receiver or |
| 145 any(argument for argument in arguments | 148 any(argument for argument in arguments |
| 146 if (argument.idl_type.name == 'SerializedScriptValue' or | 149 if (argument.idl_type.name == 'SerializedScriptValue' or |
| 147 argument_conversion_needs_exception_state(method, argument))
), | 150 argument_conversion_needs_exception_state(method, argument))
), |
| 151 'has_optional_argument_without_default_value': |
| 152 any(True for argument_context in argument_contexts |
| 153 if argument_context['is_optional_without_default_value']), |
| 148 'idl_type': idl_type.base_type, | 154 'idl_type': idl_type.base_type, |
| 149 'is_call_with_execution_context': has_extended_attribute_value(method, '
CallWith', 'ExecutionContext'), | 155 'is_call_with_execution_context': has_extended_attribute_value(method, '
CallWith', 'ExecutionContext'), |
| 150 'is_call_with_script_arguments': is_call_with_script_arguments, | 156 'is_call_with_script_arguments': is_call_with_script_arguments, |
| 151 'is_call_with_script_state': is_call_with_script_state, | 157 'is_call_with_script_state': is_call_with_script_state, |
| 152 'is_call_with_this_value': is_call_with_this_value, | 158 'is_call_with_this_value': is_call_with_this_value, |
| 153 'is_check_security_for_receiver': is_check_security_for_receiver, | 159 'is_check_security_for_receiver': is_check_security_for_receiver, |
| 154 'is_check_security_for_return_value': is_check_security_for_return_value
, | 160 'is_check_security_for_return_value': is_check_security_for_return_value
, |
| 155 'is_custom': 'Custom' in extended_attributes and | 161 'is_custom': 'Custom' in extended_attributes and |
| 156 not (is_custom_call_prologue or is_custom_call_epilogue), | 162 not (is_custom_call_prologue or is_custom_call_epilogue), |
| 157 'is_custom_call_prologue': is_custom_call_prologue, | 163 'is_custom_call_prologue': is_custom_call_prologue, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 | 218 |
| 213 if ('ImplementedInPrivateScript' in extended_attributes and | 219 if ('ImplementedInPrivateScript' in extended_attributes and |
| 214 not idl_type.is_wrapper_type and | 220 not idl_type.is_wrapper_type and |
| 215 not idl_type.is_basic_type): | 221 not idl_type.is_basic_type): |
| 216 raise Exception('Private scripts supports only primitive types and DOM w
rappers.') | 222 raise Exception('Private scripts supports only primitive types and DOM w
rappers.') |
| 217 | 223 |
| 218 set_default_value = argument.set_default_value | 224 set_default_value = argument.set_default_value |
| 219 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut
es, | 225 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut
es, |
| 220 raw_type=True, | 226 raw_type=True, |
| 221 used_as_variadic_argument=argument.is
_variadic) | 227 used_as_variadic_argument=argument.is
_variadic) |
| 222 return { | 228 context = { |
| 223 'cpp_type': ( | 229 'cpp_type': ( |
| 224 v8_types.cpp_template_type('Nullable', this_cpp_type) | 230 v8_types.cpp_template_type('Nullable', this_cpp_type) |
| 225 if idl_type.is_explicit_nullable and not argument.is_variadic | 231 if idl_type.is_explicit_nullable and not argument.is_variadic |
| 226 else this_cpp_type), | 232 else this_cpp_type), |
| 227 'cpp_value': this_cpp_value, | 233 'cpp_value': this_cpp_value, |
| 228 # FIXME: check that the default value's type is compatible with the argu
ment's | 234 # FIXME: check that the default value's type is compatible with the argu
ment's |
| 229 'set_default_value': set_default_value, | 235 'set_default_value': set_default_value, |
| 230 'enum_type': idl_type.enum_type, | 236 'enum_type': idl_type.enum_type, |
| 231 'enum_values': idl_type.enum_values, | 237 'enum_values': idl_type.enum_values, |
| 232 'handle': '%sHandle' % argument.name, | 238 'handle': '%sHandle' % argument.name, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 249 'is_wrapper_type': idl_type.is_wrapper_type, | 255 'is_wrapper_type': idl_type.is_wrapper_type, |
| 250 'name': argument.name, | 256 'name': argument.name, |
| 251 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 257 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
| 252 argument.name, isolate='scriptState->isolate()', | 258 argument.name, isolate='scriptState->isolate()', |
| 253 creation_context='scriptState->context()->Global()'), | 259 creation_context='scriptState->context()->Global()'), |
| 254 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in extended_attributes, | 260 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion'
in extended_attributes, |
| 255 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), | 261 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), |
| 256 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), | 262 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), |
| 257 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(method, argum
ent, index), | 263 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(method, argum
ent, index), |
| 258 } | 264 } |
| 265 context.update({ |
| 266 'is_optional_without_default_value': |
| 267 context['is_optional'] and |
| 268 not context['has_default'] and |
| 269 not context['is_dictionary'] and |
| 270 not context['is_callback_interface'], |
| 271 }) |
| 272 return context |
| 259 | 273 |
| 260 | 274 |
| 261 def argument_declarations_for_private_script(interface, method): | 275 def argument_declarations_for_private_script(interface, method): |
| 262 argument_declarations = ['LocalFrame* frame'] | 276 argument_declarations = ['LocalFrame* frame'] |
| 263 argument_declarations.append('%s* holderImpl' % interface.name) | 277 argument_declarations.append('%s* holderImpl' % interface.name) |
| 264 argument_declarations.extend(['%s %s' % (argument.idl_type.cpp_type_args( | 278 argument_declarations.extend(['%s %s' % (argument.idl_type.cpp_type_args( |
| 265 used_as_rvalue_type=True), argument.name) for argument in method.argumen
ts]) | 279 used_as_rvalue_type=True), argument.name) for argument in method.argumen
ts]) |
| 266 if method.idl_type.name != 'void': | 280 if method.idl_type.name != 'void': |
| 267 argument_declarations.append('%s* %s' % (method.idl_type.cpp_type, 'resu
lt')) | 281 argument_declarations.append('%s* %s' % (method.idl_type.cpp_type, 'resu
lt')) |
| 268 return argument_declarations | 282 return argument_declarations |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 return method.idl_type and method.idl_type.name == 'Promise' | 473 return method.idl_type and method.idl_type.name == 'Promise' |
| 460 | 474 |
| 461 IdlOperation.returns_promise = property(method_returns_promise) | 475 IdlOperation.returns_promise = property(method_returns_promise) |
| 462 | 476 |
| 463 | 477 |
| 464 def argument_conversion_needs_exception_state(method, argument): | 478 def argument_conversion_needs_exception_state(method, argument): |
| 465 idl_type = argument.idl_type | 479 idl_type = argument.idl_type |
| 466 return (idl_type.v8_conversion_needs_exception_state or | 480 return (idl_type.v8_conversion_needs_exception_state or |
| 467 argument.is_variadic or | 481 argument.is_variadic or |
| 468 (method.returns_promise and idl_type.is_string_type)) | 482 (method.returns_promise and idl_type.is_string_type)) |
| OLD | NEW |